@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/lib/postHelpers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { POLL_OPTION_MAX_LENGTH, visibilityTypeValues, } from '../types/index.js';
|
|
2
2
|
import { canModerateJam } from './jamHelpers.js';
|
|
3
|
-
import { sameRecurrenceId } from './eventRecurrence.js';
|
|
3
|
+
import { defaultRsvpRecurrenceId, effectiveEventTimes, isRecurringEvent, listRsvpOccurrences, normalizeRecurrenceId, sameRecurrenceId, } from './eventRecurrence.js';
|
|
4
|
+
import { formatEventWhen } from './eventTime.js';
|
|
4
5
|
import { checkGroupCapabilities, checkPostCapabilities, checkRoleCapabilities, } from './capabilitiesHelpers.js';
|
|
5
6
|
import { scopeMatches } from './scopeHelpers.js';
|
|
6
7
|
import { countBy, dateSorter, groupBy, transformValues } from './utils.js';
|
|
@@ -14,6 +15,73 @@ export const buildThreads = (posts) => posts
|
|
|
14
15
|
.filter((p) => !posts.find((p2) => p2.id === p.inReplyToId))
|
|
15
16
|
.map((post) => buildThread(post, posts))
|
|
16
17
|
.sort(dateSorter());
|
|
18
|
+
const parentIdOf = (post) => post.inReplyToId ?? post.replyTo?.id;
|
|
19
|
+
export const buildThreadPreview = (rootId, replies) => {
|
|
20
|
+
const sorted = [...replies].sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id));
|
|
21
|
+
if (!sorted.length)
|
|
22
|
+
return [];
|
|
23
|
+
const ids = new Set(sorted.map((post) => post.id));
|
|
24
|
+
const parent = new Map(sorted.map((post) => [post.id, post.id]));
|
|
25
|
+
const find = (id) => {
|
|
26
|
+
const current = parent.get(id) ?? id;
|
|
27
|
+
if (current !== id) {
|
|
28
|
+
const root = find(current);
|
|
29
|
+
parent.set(id, root);
|
|
30
|
+
return root;
|
|
31
|
+
}
|
|
32
|
+
return id;
|
|
33
|
+
};
|
|
34
|
+
const union = (a, b) => {
|
|
35
|
+
const ra = find(a);
|
|
36
|
+
const rb = find(b);
|
|
37
|
+
if (ra !== rb)
|
|
38
|
+
parent.set(ra, rb);
|
|
39
|
+
};
|
|
40
|
+
for (const post of sorted) {
|
|
41
|
+
const parentId = parentIdOf(post);
|
|
42
|
+
if (parentId && ids.has(parentId))
|
|
43
|
+
union(post.id, parentId);
|
|
44
|
+
}
|
|
45
|
+
const grouped = new Map();
|
|
46
|
+
for (const post of sorted) {
|
|
47
|
+
const key = find(post.id);
|
|
48
|
+
const list = grouped.get(key) ?? [];
|
|
49
|
+
list.push(post);
|
|
50
|
+
grouped.set(key, list);
|
|
51
|
+
}
|
|
52
|
+
return [...grouped.values()]
|
|
53
|
+
.map((posts) => {
|
|
54
|
+
const start = posts.find((post) => {
|
|
55
|
+
const parentId = parentIdOf(post);
|
|
56
|
+
return !parentId || !ids.has(parentId);
|
|
57
|
+
}) ?? posts[0];
|
|
58
|
+
const ordered = [];
|
|
59
|
+
const used = new Set();
|
|
60
|
+
let current = start;
|
|
61
|
+
while (current && !used.has(current.id)) {
|
|
62
|
+
ordered.push(current);
|
|
63
|
+
used.add(current.id);
|
|
64
|
+
current = posts.find((post) => parentIdOf(post) === current?.id && !used.has(post.id));
|
|
65
|
+
}
|
|
66
|
+
for (const post of posts) {
|
|
67
|
+
if (!used.has(post.id))
|
|
68
|
+
ordered.push(post);
|
|
69
|
+
}
|
|
70
|
+
const startParentId = parentIdOf(start);
|
|
71
|
+
const ancestor = startParentId && startParentId !== rootId
|
|
72
|
+
? (start.replyTo ?? undefined)
|
|
73
|
+
: undefined;
|
|
74
|
+
const skippedAncestor = !!(ancestor &&
|
|
75
|
+
ancestor.inReplyToId &&
|
|
76
|
+
ancestor.inReplyToId !== rootId);
|
|
77
|
+
return { skippedAncestor, ancestor, posts: ordered };
|
|
78
|
+
})
|
|
79
|
+
.sort((a, b) => {
|
|
80
|
+
const aKey = a.ancestor?.createdAt ?? a.posts[0]?.createdAt ?? '';
|
|
81
|
+
const bKey = b.ancestor?.createdAt ?? b.posts[0]?.createdAt ?? '';
|
|
82
|
+
return aKey.localeCompare(bKey);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
17
85
|
export const getReactionCount = (post) => {
|
|
18
86
|
return countBy(post.reactions, (r) => r.reaction);
|
|
19
87
|
};
|
|
@@ -68,14 +136,16 @@ const latestRsvpPerProfile = (rsvps, recurrenceId) => {
|
|
|
68
136
|
}
|
|
69
137
|
return true;
|
|
70
138
|
}
|
|
71
|
-
return
|
|
139
|
+
return true;
|
|
72
140
|
});
|
|
73
141
|
const rsvpsByProfile = groupBy(scoped, (r) => r.profile.id);
|
|
74
142
|
return Object.values(rsvpsByProfile).map((profileRsvps) => {
|
|
75
143
|
const instanceRsvps = recurrenceId
|
|
76
144
|
? profileRsvps.filter((rsvp) => sameRecurrenceId(rsvp.recurrenceId, recurrenceId))
|
|
77
145
|
: [];
|
|
78
|
-
const seriesRsvps =
|
|
146
|
+
const seriesRsvps = recurrenceId
|
|
147
|
+
? profileRsvps.filter((rsvp) => !rsvp.recurrenceId)
|
|
148
|
+
: profileRsvps;
|
|
79
149
|
const pool = recurrenceId && instanceRsvps.length > 0 ? instanceRsvps : seriesRsvps;
|
|
80
150
|
const sorted = pool.sort(dateSorter());
|
|
81
151
|
return sorted[sorted.length - 1];
|
|
@@ -84,6 +154,187 @@ const latestRsvpPerProfile = (rsvps, recurrenceId) => {
|
|
|
84
154
|
export const calculateEffectiveRsvps = (post, recurrenceId) => latestRsvpPerProfile(post.rsvps || [], recurrenceId).filter((rsvp) => !!rsvp);
|
|
85
155
|
export const getEffectiveRsvp = (post, profileId, recurrenceId) => calculateEffectiveRsvps(post, recurrenceId).find((r) => r.profile.id === profileId);
|
|
86
156
|
export const countYesRsvps = (post, recurrenceId) => calculateEffectiveRsvps(post, recurrenceId).filter((r) => r.response === 'yes').length;
|
|
157
|
+
export const countSeriesYesRsvps = (post) => (post.rsvps ?? []).filter((r) => !r.recurrenceId && r.response === 'yes')
|
|
158
|
+
.length;
|
|
159
|
+
const attendingResponse = (response) => response === 'yes' || response === 'tentative';
|
|
160
|
+
/** Current roster: attending guests, plus organizer removals that can be restored. */
|
|
161
|
+
export const listedRsvps = (rsvps) => rsvps.filter((rsvp) => rsvp.response === 'yes' ||
|
|
162
|
+
rsvp.response === 'tentative' ||
|
|
163
|
+
rsvp.response === 'removed');
|
|
164
|
+
export const isRsvpCancelNotice = (data) => {
|
|
165
|
+
if (!data || typeof data !== 'object')
|
|
166
|
+
return false;
|
|
167
|
+
const notice = data;
|
|
168
|
+
return (typeof notice.series === 'boolean' &&
|
|
169
|
+
Array.isArray(notice.occurrenceIds) &&
|
|
170
|
+
notice.occurrenceIds.every((id) => typeof id === 'string'));
|
|
171
|
+
};
|
|
172
|
+
export const rsvpCancelNotice = (post, profileId, response, occurrenceIds) => {
|
|
173
|
+
if (response !== 'no')
|
|
174
|
+
return undefined;
|
|
175
|
+
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
176
|
+
if (!event)
|
|
177
|
+
return undefined;
|
|
178
|
+
if (occurrenceIds?.length) {
|
|
179
|
+
const canceled = occurrenceIds.filter((id) => attendingResponse(getEffectiveRsvp(post, profileId, id)?.response));
|
|
180
|
+
if (!canceled.length)
|
|
181
|
+
return undefined;
|
|
182
|
+
return { occurrenceIds: canceled, series: false };
|
|
183
|
+
}
|
|
184
|
+
if (attendingResponse(getEffectiveRsvp(post, profileId)?.response)) {
|
|
185
|
+
return { occurrenceIds: [], series: isRecurringEvent(event) };
|
|
186
|
+
}
|
|
187
|
+
if (!event.recurrence)
|
|
188
|
+
return undefined;
|
|
189
|
+
const canceled = instanceRsvpIdsForProfile(post, profileId).filter((id) => attendingResponse(getEffectiveRsvp(post, profileId, id)?.response));
|
|
190
|
+
if (!canceled.length)
|
|
191
|
+
return undefined;
|
|
192
|
+
return { occurrenceIds: canceled, series: false };
|
|
193
|
+
};
|
|
194
|
+
const instanceRsvpKey = (profileId, recurrenceId) => `${profileId}|${normalizeRecurrenceId(recurrenceId)}`;
|
|
195
|
+
/** Attending → no transitions, newest first. Later re-RSVPs do not erase them. */
|
|
196
|
+
export const listRsvpCancellations = (post) => {
|
|
197
|
+
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
198
|
+
const recurring = event ? isRecurringEvent(event) : false;
|
|
199
|
+
const seriesResponse = new Map();
|
|
200
|
+
const instanceResponse = new Map();
|
|
201
|
+
const records = [];
|
|
202
|
+
for (const rsvp of [...(post.rsvps ?? [])].sort(dateSorter())) {
|
|
203
|
+
const profileId = rsvp.profile.id;
|
|
204
|
+
if (rsvp.response === 'no') {
|
|
205
|
+
if (rsvp.recurrenceId) {
|
|
206
|
+
const key = instanceRsvpKey(profileId, rsvp.recurrenceId);
|
|
207
|
+
const previous = instanceResponse.has(key)
|
|
208
|
+
? instanceResponse.get(key)
|
|
209
|
+
: seriesResponse.get(profileId);
|
|
210
|
+
if (attendingResponse(previous)) {
|
|
211
|
+
records.push({
|
|
212
|
+
profile: rsvp.profile,
|
|
213
|
+
recurrenceId: rsvp.recurrenceId,
|
|
214
|
+
canceledAt: rsvp.createdAt,
|
|
215
|
+
series: false,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else if (attendingResponse(seriesResponse.get(profileId))) {
|
|
220
|
+
records.push({
|
|
221
|
+
profile: rsvp.profile,
|
|
222
|
+
canceledAt: rsvp.createdAt,
|
|
223
|
+
series: recurring,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (rsvp.recurrenceId) {
|
|
228
|
+
instanceResponse.set(instanceRsvpKey(profileId, rsvp.recurrenceId), rsvp.response);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
seriesResponse.set(profileId, rsvp.response);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return records.reverse();
|
|
235
|
+
};
|
|
236
|
+
export const rsvpCancelWhenLabels = (post, notice) => {
|
|
237
|
+
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
238
|
+
if (!event || notice.series)
|
|
239
|
+
return { series: notice.series, labels: [] };
|
|
240
|
+
const format = (start, end) => formatEventWhen(start, {
|
|
241
|
+
end,
|
|
242
|
+
timeZone: event.timeZone,
|
|
243
|
+
allDay: event.wholeDay,
|
|
244
|
+
});
|
|
245
|
+
if (!notice.occurrenceIds.length) {
|
|
246
|
+
return { series: false, labels: [format(event.start, event.end)] };
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
series: false,
|
|
250
|
+
labels: notice.occurrenceIds.map((id) => {
|
|
251
|
+
const times = effectiveEventTimes(event, id);
|
|
252
|
+
return format(times.start, times.end);
|
|
253
|
+
}),
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
export const instanceRsvpIdsForProfile = (post, profileId) => {
|
|
257
|
+
const ids = new Set();
|
|
258
|
+
for (const rsvp of post.rsvps ?? []) {
|
|
259
|
+
if (rsvp.profile.id !== profileId || !rsvp.recurrenceId)
|
|
260
|
+
continue;
|
|
261
|
+
ids.add(normalizeRecurrenceId(rsvp.recurrenceId));
|
|
262
|
+
}
|
|
263
|
+
return [...ids];
|
|
264
|
+
};
|
|
265
|
+
export const overlaySeriesRsvpEntries = (response, instanceIds) => [
|
|
266
|
+
{ response },
|
|
267
|
+
...instanceIds.map((recurrenceId) => ({ response, recurrenceId })),
|
|
268
|
+
];
|
|
269
|
+
export const seriesYesBlockedByCapacity = (post, profileId, now = new Date()) => {
|
|
270
|
+
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
271
|
+
const maxAttendees = event?.maxAttendees;
|
|
272
|
+
if (!event || !maxAttendees || !event.recurrence)
|
|
273
|
+
return false;
|
|
274
|
+
const occurrences = listRsvpOccurrences(event, now);
|
|
275
|
+
// When there are no upcoming occurrences (e.g. a live jam whose current
|
|
276
|
+
// occurrence started before `now`), fall back to the series-level count.
|
|
277
|
+
if (occurrences.length === 0) {
|
|
278
|
+
const current = getEffectiveRsvp(post, profileId);
|
|
279
|
+
if (current?.response !== 'yes' &&
|
|
280
|
+
countSeriesYesRsvps(post) >= maxAttendees) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
return occurrences.some((occurrence) => {
|
|
286
|
+
const current = getEffectiveRsvp(post, profileId, occurrence.recurrenceId);
|
|
287
|
+
if (current?.response === 'yes')
|
|
288
|
+
return false;
|
|
289
|
+
return countYesRsvps(post, occurrence.recurrenceId) >= maxAttendees;
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
export const occurrenceHasCapacity = (post, recurrenceId, profileId) => {
|
|
293
|
+
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
294
|
+
if (!event?.maxAttendees)
|
|
295
|
+
return true;
|
|
296
|
+
if (profileId) {
|
|
297
|
+
const current = getEffectiveRsvp(post, profileId, recurrenceId);
|
|
298
|
+
if (current?.response === 'yes')
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
return countYesRsvps(post, recurrenceId) < event.maxAttendees;
|
|
302
|
+
};
|
|
303
|
+
/** Series Register stays enabled while any upcoming date still has a seat. */
|
|
304
|
+
export const recurringEventHasOpenOccurrence = (post, profileId, now = new Date()) => {
|
|
305
|
+
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
306
|
+
if (!event)
|
|
307
|
+
return false;
|
|
308
|
+
if (!event.recurrence) {
|
|
309
|
+
return occurrenceHasCapacity(post, undefined, profileId);
|
|
310
|
+
}
|
|
311
|
+
return listRsvpOccurrences(event, now).some((occurrence) => occurrenceHasCapacity(post, occurrence.recurrenceId, profileId));
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Series-page RSVP for the Register/Cancel CTA: prefer the default/next date,
|
|
315
|
+
* then any attending instance so a partial RSVP still shows Cancel.
|
|
316
|
+
*/
|
|
317
|
+
export const displayRsvpForProfile = (post, profileId, options) => {
|
|
318
|
+
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
319
|
+
const scopedId = options?.lockToOccurrence
|
|
320
|
+
? options.recurrenceId
|
|
321
|
+
: event
|
|
322
|
+
? defaultRsvpRecurrenceId(event, options?.recurrenceId, options?.now)
|
|
323
|
+
: options?.recurrenceId;
|
|
324
|
+
const scoped = getEffectiveRsvp(post, profileId, scopedId);
|
|
325
|
+
if (options?.lockToOccurrence)
|
|
326
|
+
return scoped;
|
|
327
|
+
if (scoped && scoped.response !== 'no')
|
|
328
|
+
return scoped;
|
|
329
|
+
if (event?.recurrence) {
|
|
330
|
+
for (const occurrence of listRsvpOccurrences(event, options?.now)) {
|
|
331
|
+
const instance = getEffectiveRsvp(post, profileId, occurrence.recurrenceId);
|
|
332
|
+
if (instance && instance.response !== 'no')
|
|
333
|
+
return instance;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return scoped;
|
|
337
|
+
};
|
|
87
338
|
export const isCapacityEvent = (event) => !!event.maxAttendees;
|
|
88
339
|
export const parseEventMaxAttendeesInput = (raw) => {
|
|
89
340
|
const trimmed = raw.trim();
|
|
@@ -105,7 +356,7 @@ export const normalizeEventDataForSave = (event) => {
|
|
|
105
356
|
}
|
|
106
357
|
return { ...event, maxAttendees: Math.trunc(maxAttendees) };
|
|
107
358
|
};
|
|
108
|
-
/**
|
|
359
|
+
/** Null capacity means it was cleared; strip for validation/output. */
|
|
109
360
|
export const normalizeEventDataFromDb = (event) => {
|
|
110
361
|
if (event.maxAttendees != null) {
|
|
111
362
|
return event;
|
|
@@ -114,7 +365,7 @@ export const normalizeEventDataFromDb = (event) => {
|
|
|
114
365
|
};
|
|
115
366
|
export const normalizePostDataFromDb = (data) => data.type === 'event' ? normalizeEventDataFromDb(data) : data;
|
|
116
367
|
export const eventDataForDbUpdate = (previous, normalized) => {
|
|
117
|
-
if (
|
|
368
|
+
if (previous?.maxAttendees != null && !('maxAttendees' in normalized)) {
|
|
118
369
|
return { ...normalized, maxAttendees: null };
|
|
119
370
|
}
|
|
120
371
|
return normalized;
|
|
@@ -122,19 +373,18 @@ export const eventDataForDbUpdate = (previous, normalized) => {
|
|
|
122
373
|
export const canManageEventRsvps = (profile, post) => !!(profile &&
|
|
123
374
|
(post.profile.id === profile.id || canModerateJam(profile, post)));
|
|
124
375
|
export const getJamCapacityJoinBlock = (post, profile, recurrenceId) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (!(event === null || event === void 0 ? void 0 : event.maxAttendees) || !(profile === null || profile === void 0 ? void 0 : profile.id)) {
|
|
376
|
+
const event = post.data?.type === 'event' ? post.data : undefined;
|
|
377
|
+
if (!event?.maxAttendees || !profile?.id) {
|
|
128
378
|
return { blocked: false };
|
|
129
379
|
}
|
|
130
380
|
if (canModerateJam(profile, post)) {
|
|
131
381
|
return { blocked: false };
|
|
132
382
|
}
|
|
133
383
|
const myRsvp = getEffectiveRsvp(post, profile.id, recurrenceId);
|
|
134
|
-
if (
|
|
384
|
+
if (myRsvp?.response === 'yes') {
|
|
135
385
|
return { blocked: false };
|
|
136
386
|
}
|
|
137
|
-
if (
|
|
387
|
+
if (myRsvp?.response === 'removed') {
|
|
138
388
|
return { blocked: true, reason: 'removed' };
|
|
139
389
|
}
|
|
140
390
|
if (countYesRsvps(post, recurrenceId) >= event.maxAttendees) {
|
|
@@ -143,40 +393,31 @@ export const getJamCapacityJoinBlock = (post, profile, recurrenceId) => {
|
|
|
143
393
|
return { blocked: true, reason: 'rsvp-required' };
|
|
144
394
|
};
|
|
145
395
|
export const canDeletePost = (authData, post, config) => checkPostCapabilities(authData, ['core-posts-delete'], post, config).success;
|
|
146
|
-
export const canCreatePost = (authData, type, visibility, group) =>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
? canCreatePostTypeInAnyGroup(authData, type)
|
|
172
|
-
: checkRoleCapabilities((_a = authData.profile) === null || _a === void 0 ? void 0 : _a.roles, [
|
|
173
|
-
`core-posts-create-${type}-${visibility}`,
|
|
174
|
-
]).success &&
|
|
175
|
-
scopeMatches({
|
|
176
|
-
scopes: authData.scopes,
|
|
177
|
-
requiredScope: { scopeLevel: 'write', resource: { type: 'posts' } },
|
|
178
|
-
});
|
|
179
|
-
};
|
|
396
|
+
export const canCreatePost = (authData, type, visibility, group) => visibility === 'group'
|
|
397
|
+
? !!group &&
|
|
398
|
+
checkGroupCapabilities(authData, [`core-posts-create-${type}`], group)
|
|
399
|
+
.success
|
|
400
|
+
: checkRoleCapabilities(authData.profile?.roles, [
|
|
401
|
+
`core-posts-create-${type}-${visibility}`,
|
|
402
|
+
]).success &&
|
|
403
|
+
scopeMatches({
|
|
404
|
+
scopes: authData.scopes,
|
|
405
|
+
requiredScope: { scopeLevel: 'write', resource: { type: 'posts' } },
|
|
406
|
+
});
|
|
407
|
+
export const canCreatePostTypeInAnyGroup = (authData, type) => scopeMatches({
|
|
408
|
+
scopes: authData.scopes,
|
|
409
|
+
requiredScope: { scopeLevel: 'write', resource: { type: 'groups' } },
|
|
410
|
+
}) &&
|
|
411
|
+
!!authData.profile?.memberships?.some((m) => checkGroupCapabilities(authData, [`core-posts-create-${type}`], m.group).success);
|
|
412
|
+
export const canCreatePostTypeWithVisibility = (authData, type, visibility) => visibility === 'group'
|
|
413
|
+
? canCreatePostTypeInAnyGroup(authData, type)
|
|
414
|
+
: checkRoleCapabilities(authData.profile?.roles, [
|
|
415
|
+
`core-posts-create-${type}-${visibility}`,
|
|
416
|
+
]).success &&
|
|
417
|
+
scopeMatches({
|
|
418
|
+
scopes: authData.scopes,
|
|
419
|
+
requiredScope: { scopeLevel: 'write', resource: { type: 'posts' } },
|
|
420
|
+
});
|
|
180
421
|
export const canCreatePostType = (authData, type) => visibilityTypeValues.some((visibility) => canCreatePostTypeWithVisibility(authData, type, visibility));
|
|
181
422
|
/**
|
|
182
423
|
* Whether Reply / Repost / Like should look live. Non-members of a group
|
|
@@ -185,18 +426,53 @@ export const canCreatePostType = (authData, type) => visibilityTypeValues.some((
|
|
|
185
426
|
* and reposts need create-*, likes need core-posts-react.
|
|
186
427
|
*/
|
|
187
428
|
export const getPostActionAvailability = (authData, post, config) => {
|
|
188
|
-
var _a, _b, _c;
|
|
189
429
|
const isGroupPost = !!post.groupId || !!post.group;
|
|
190
|
-
const membershipExists = !!
|
|
430
|
+
const membershipExists = !!authData.profile?.memberships?.some((m) => m.group.id === post.group?.id || m.group.id === post.groupId);
|
|
191
431
|
if (isGroupPost && !membershipExists) {
|
|
192
432
|
return { canReply: false, canRepost: false, canReact: false };
|
|
193
433
|
}
|
|
194
434
|
const canReply = checkPostCapabilities(authData, ['core-posts-reply'], post, config)
|
|
195
435
|
.success &&
|
|
196
|
-
canCreatePost(authData, 'note', post.visibility,
|
|
436
|
+
canCreatePost(authData, 'note', post.visibility, post.group ?? undefined);
|
|
197
437
|
const canReact = checkPostCapabilities(authData, ['core-posts-react'], post, config).success;
|
|
198
438
|
const canRepost = post.group
|
|
199
439
|
? checkGroupCapabilities(authData, [`core-posts-create-${post.type}`], post.group).success
|
|
200
440
|
: canCreatePost(authData, post.type, post.visibility);
|
|
201
441
|
return { canReply, canRepost, canReact };
|
|
202
442
|
};
|
|
443
|
+
/** Sentinel handle for block-hidden reply tombstones (no name/handle leak). */
|
|
444
|
+
export const HIDDEN_AUTHOR_HANDLE = 'hidden';
|
|
445
|
+
export const toHiddenPost = (post) => ({
|
|
446
|
+
...post,
|
|
447
|
+
hidden: true,
|
|
448
|
+
data: {
|
|
449
|
+
...post.data,
|
|
450
|
+
...('content' in post.data ? { content: '' } : {}),
|
|
451
|
+
},
|
|
452
|
+
profile: {
|
|
453
|
+
...post.profile,
|
|
454
|
+
displayName: undefined,
|
|
455
|
+
handle: HIDDEN_AUTHOR_HANDLE,
|
|
456
|
+
avatar: null,
|
|
457
|
+
header: null,
|
|
458
|
+
bio: undefined,
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
export const isHiddenPost = (post) => !!post.hidden;
|
|
462
|
+
const participantIds = (post) => {
|
|
463
|
+
const ids = new Set((post.audience ?? []).map((member) => member.id).filter(Boolean));
|
|
464
|
+
const creatorId = post.creatorId ?? post.profile?.id;
|
|
465
|
+
if (creatorId)
|
|
466
|
+
ids.add(creatorId);
|
|
467
|
+
return ids;
|
|
468
|
+
};
|
|
469
|
+
export const isOneToOneWithBlocked = (post, viewer, blockedIds) => {
|
|
470
|
+
if (!viewer || post.visibility !== 'direct')
|
|
471
|
+
return false;
|
|
472
|
+
const blocked = blockedIds instanceof Set ? blockedIds : new Set(blockedIds ?? []);
|
|
473
|
+
if (!blocked.size)
|
|
474
|
+
return false;
|
|
475
|
+
const others = participantIds(post);
|
|
476
|
+
others.delete(viewer.id);
|
|
477
|
+
return others.size === 1 && blocked.has([...others][0]);
|
|
478
|
+
};
|
|
@@ -39,3 +39,14 @@ export declare const sortProfiles: (profiles: PublicProfile[]) => PublicProfile[
|
|
|
39
39
|
export declare const isStripeActive: (sub: StripeSubscriptionData | undefined | null) => boolean;
|
|
40
40
|
export declare const getStripeCustomerId: (profileSettings: ProfileSettings) => string | undefined;
|
|
41
41
|
export declare const isOwnerProfile: (profile: ProfileWithMeta) => boolean;
|
|
42
|
+
type BlockIdProfile = {
|
|
43
|
+
blockingIds?: string[] | null;
|
|
44
|
+
blockedByIds?: string[] | null;
|
|
45
|
+
};
|
|
46
|
+
export declare const blockedPairIds: (profile?: BlockIdProfile | null) => string[];
|
|
47
|
+
export declare const isBlockedPair: (profile: BlockIdProfile | undefined | null, otherId: string | undefined | null) => boolean;
|
|
48
|
+
export declare const viewerBlockedTarget: (profile: BlockIdProfile | undefined | null, otherId: string | undefined | null) => boolean;
|
|
49
|
+
export declare const targetBlockedViewer: (profile: BlockIdProfile | undefined | null, otherId: string | undefined | null) => boolean;
|
|
50
|
+
export declare const sharesControllingAccount: (a: Pick<ProfileWithMeta, "controllers">, b: Pick<ProfileWithMeta, "controllers">) => boolean;
|
|
51
|
+
export declare const toBlockedProfileStub: (profile: Pick<ProfileWithMeta, "id" | "type" | "createdAt" | "updatedAt" | "handle" | "displayName">) => PublicProfile;
|
|
52
|
+
export {};
|
|
@@ -9,7 +9,7 @@ export const clampProfileDisplayName = (displayName) => {
|
|
|
9
9
|
const clamped = displayName.slice(0, PROFILE_DISPLAY_NAME_MAX_LENGTH);
|
|
10
10
|
return clamped || undefined;
|
|
11
11
|
};
|
|
12
|
-
export const isDeletedProfile = (profile) => !!
|
|
12
|
+
export const isDeletedProfile = (profile) => !!profile?.deletedAt;
|
|
13
13
|
/**
|
|
14
14
|
* Strip PII from a soft-deleted profile for public API / UI surfaces.
|
|
15
15
|
* Keeps id + timestamps (including deletedAt) so clients can detect the state.
|
|
@@ -28,6 +28,8 @@ export const toPublicDeletedProfile = (profile) => ({
|
|
|
28
28
|
memberships: [],
|
|
29
29
|
fields: undefined,
|
|
30
30
|
profileStats: undefined,
|
|
31
|
+
pinnedPostId: undefined,
|
|
32
|
+
roles: [],
|
|
31
33
|
});
|
|
32
34
|
export const anonymizeProfileIfDeleted = (profile) => {
|
|
33
35
|
if (!profile)
|
|
@@ -58,12 +60,15 @@ export const toDeletedProfileWithMeta = (profile) => ({
|
|
|
58
60
|
controllers: [],
|
|
59
61
|
memberships: [],
|
|
60
62
|
profileStats: { followersCount: 0, followingCount: 0 },
|
|
63
|
+
blockingIds: [],
|
|
64
|
+
blockedByIds: [],
|
|
65
|
+
followedHashtags: [],
|
|
61
66
|
});
|
|
62
67
|
/** Tombstone a `ProfileWithMeta` only when it is soft-deleted. */
|
|
63
68
|
export const tombstoneProfileWithMetaIfDeleted = (profile) => profile && isDeletedProfile(profile)
|
|
64
69
|
? toDeletedProfileWithMeta(profile)
|
|
65
70
|
: profile;
|
|
66
|
-
export const profileName = (profile) =>
|
|
71
|
+
export const profileName = (profile) => profile?.displayName || profile?.handle;
|
|
67
72
|
export const matchesQuery = (profile, query, queryOptions = { handle: true, displayName: true }) => !!(profile &&
|
|
68
73
|
(query.startsWith('@')
|
|
69
74
|
? profile.handle && containsIgnoreCase(profile.handle, query.substring(1))
|
|
@@ -76,7 +81,7 @@ export const matchesQuery = (profile, query, queryOptions = { handle: true, disp
|
|
|
76
81
|
export const inviteLinkMatchesQuery = (inviteLink, query, queryOptions = { handle: true, displayName: true, slug: true, group: true }) => {
|
|
77
82
|
const profile = inviteLink.profile;
|
|
78
83
|
if (query.startsWith('@')) {
|
|
79
|
-
return !!(
|
|
84
|
+
return !!(profile?.handle && containsIgnoreCase(profile.handle, query.substring(1)));
|
|
80
85
|
}
|
|
81
86
|
const groupMatches = queryOptions.group &&
|
|
82
87
|
inviteLink.groups.some((group) => containsIgnoreCase(group.handle, query) ||
|
|
@@ -93,12 +98,31 @@ export const inviteLinkMatchesQuery = (inviteLink, query, queryOptions = { handl
|
|
|
93
98
|
inviteLink.slug &&
|
|
94
99
|
containsIgnoreCase(inviteLink.slug, query)))));
|
|
95
100
|
};
|
|
96
|
-
export const sortProfiles = (profiles) =>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
export const isStripeActive = (sub) => (sub === null || sub === void 0 ? void 0 : sub.status) === 'active' || (sub === null || sub === void 0 ? void 0 : sub.status) === 'trialing';
|
|
101
|
-
export const getStripeCustomerId = (profileSettings) => { var _a; return (_a = profileSettings === null || profileSettings === void 0 ? void 0 : profileSettings.stripeSettings) === null || _a === void 0 ? void 0 : _a.customerId; };
|
|
101
|
+
export const sortProfiles = (profiles) => profiles?.sort((a, b) => profileName(a).localeCompare(profileName(b))) ?? [];
|
|
102
|
+
export const isStripeActive = (sub) => sub?.status === 'active' || sub?.status === 'trialing';
|
|
103
|
+
export const getStripeCustomerId = (profileSettings) => profileSettings?.stripeSettings?.customerId;
|
|
102
104
|
export const isOwnerProfile = (profile) => {
|
|
103
|
-
return profile
|
|
105
|
+
return profile?.roles.some((role) => role.key === 'owner');
|
|
104
106
|
};
|
|
107
|
+
export const blockedPairIds = (profile) => [
|
|
108
|
+
...new Set([
|
|
109
|
+
...(profile?.blockingIds ?? []),
|
|
110
|
+
...(profile?.blockedByIds ?? []),
|
|
111
|
+
]),
|
|
112
|
+
];
|
|
113
|
+
export const isBlockedPair = (profile, otherId) => !!otherId && blockedPairIds(profile).includes(otherId);
|
|
114
|
+
export const viewerBlockedTarget = (profile, otherId) => !!otherId && (profile?.blockingIds ?? []).includes(otherId);
|
|
115
|
+
export const targetBlockedViewer = (profile, otherId) => !!otherId && (profile?.blockedByIds ?? []).includes(otherId);
|
|
116
|
+
export const sharesControllingAccount = (a, b) => {
|
|
117
|
+
const otherIds = new Set((b.controllers ?? []).map((account) => account.id));
|
|
118
|
+
return (a.controllers ?? []).some((account) => otherIds.has(account.id));
|
|
119
|
+
};
|
|
120
|
+
export const toBlockedProfileStub = (profile) => ({
|
|
121
|
+
id: profile.id,
|
|
122
|
+
type: profile.type,
|
|
123
|
+
createdAt: profile.createdAt,
|
|
124
|
+
updatedAt: profile.updatedAt,
|
|
125
|
+
handle: profile.handle,
|
|
126
|
+
displayName: profile.displayName,
|
|
127
|
+
blockedByMe: true,
|
|
128
|
+
});
|
package/dist/lib/pushHelpers.js
CHANGED
|
@@ -13,7 +13,6 @@ export const pushSubscriptionDeliveryKey = (subscription) => {
|
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
export const pushSubscriptionEndpoint = (subscription) => 'endpoint' in subscription ? subscription.endpoint : undefined;
|
|
16
|
-
export const pushSubscriptionIsMobile = (subscription) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
16
|
+
export const pushSubscriptionIsMobile = (subscription) => pushSubscriptionDeviceName(subscription)
|
|
17
|
+
?.toLowerCase()
|
|
18
|
+
.match(/phone|android|mobile|ios/) != null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const AP_LIKE_REACTION = "\uD83D\uDC4D";
|
|
2
|
+
export declare const AP_DISLIKE_REACTION = "\uD83D\uDC4E";
|
|
3
|
+
export declare const activityPubActivityForReaction: (reaction: string) => "Like" | "Dislike" | null;
|
|
4
|
+
export type ReactionLogEntry = {
|
|
5
|
+
type: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
data?: unknown;
|
|
8
|
+
profile: {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** Latest reaction/unreaction per (profile, emoji) wins. */
|
|
13
|
+
export declare const currentReactionsFromEntries: <T extends ReactionLogEntry>(entries: readonly T[]) => Array<{
|
|
14
|
+
reaction: string;
|
|
15
|
+
profile: T["profile"];
|
|
16
|
+
}>;
|
|
17
|
+
export declare const isReactionHistoryEntry: (type: string) => type is "reaction" | "unreaction";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const AP_LIKE_REACTION = '👍';
|
|
2
|
+
export const AP_DISLIKE_REACTION = '👎';
|
|
3
|
+
export const activityPubActivityForReaction = (reaction) => {
|
|
4
|
+
if (reaction === AP_LIKE_REACTION)
|
|
5
|
+
return 'Like';
|
|
6
|
+
if (reaction === AP_DISLIKE_REACTION)
|
|
7
|
+
return 'Dislike';
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
const reactionFromData = (data) => {
|
|
11
|
+
if (!data || typeof data !== 'object' || !('reaction' in data)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const reaction = data.reaction;
|
|
15
|
+
return typeof reaction === 'string' && reaction.length > 0
|
|
16
|
+
? reaction
|
|
17
|
+
: undefined;
|
|
18
|
+
};
|
|
19
|
+
/** Latest reaction/unreaction per (profile, emoji) wins. */
|
|
20
|
+
export const currentReactionsFromEntries = (entries) => {
|
|
21
|
+
const latest = new Map();
|
|
22
|
+
const sorted = [...entries].filter((entry) => entry.type === 'reaction' || entry.type === 'unreaction');
|
|
23
|
+
sorted.sort((a, b) => (a.createdAt < b.createdAt ? -1 : 1));
|
|
24
|
+
for (const entry of sorted) {
|
|
25
|
+
const reaction = reactionFromData(entry.data);
|
|
26
|
+
if (!reaction)
|
|
27
|
+
continue;
|
|
28
|
+
latest.set(`${entry.profile.id}\0${reaction}`, { entry, reaction });
|
|
29
|
+
}
|
|
30
|
+
return [...latest.values()]
|
|
31
|
+
.filter(({ entry }) => entry.type === 'reaction')
|
|
32
|
+
.map(({ entry, reaction }) => ({
|
|
33
|
+
reaction,
|
|
34
|
+
profile: entry.profile,
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
export const isReactionHistoryEntry = (type) => type === 'reaction' || type === 'unreaction';
|
|
@@ -8,8 +8,21 @@ export declare const scopeMatches: ({ scopes, requiredScope, }: {
|
|
|
8
8
|
requiredScope: Scope;
|
|
9
9
|
}) => boolean;
|
|
10
10
|
export declare const getPublicPostReadScope: (postId: string) => Scope;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Posts with `public` visibility — and posts in groups that grant the needed
|
|
13
|
+
* *-read caps to `none` — are readable without auth; grant read scope for
|
|
14
|
+
* that post id (same pattern as {@link withPublicGroupReadScopes}).
|
|
15
|
+
*/
|
|
16
|
+
export declare const withPublicPostReadScopes: (authData: AuthorizationData, post: Pick<PublicPost, "id" | "visibility"> & {
|
|
17
|
+
/** Only the group's `none` capabilities matter for the public check. */
|
|
18
|
+
group?: {
|
|
19
|
+
capabilities?: {
|
|
20
|
+
none?: {
|
|
21
|
+
add?: string[];
|
|
22
|
+
};
|
|
23
|
+
} | null;
|
|
24
|
+
} | null;
|
|
25
|
+
}, neededCapabilities: string[]) => AuthorizationData;
|
|
13
26
|
export declare const getPublicGroupReadScope: (groupId: string) => Scope;
|
|
14
27
|
/**
|
|
15
28
|
* Groups that grant the needed *-read caps to relationship `none` are readable
|
|
@@ -23,3 +36,19 @@ export declare const withPublicGroupReadScopes: (authData: AuthorizationData, gr
|
|
|
23
36
|
};
|
|
24
37
|
} | null;
|
|
25
38
|
}, neededCapabilities: string[]) => AuthorizationData;
|
|
39
|
+
export declare const getPublicProfileReadScope: (profileId: string) => Scope;
|
|
40
|
+
/**
|
|
41
|
+
* Profiles whose capabilities config grants the needed *-read caps to
|
|
42
|
+
* relationship `none` are readable without auth (same pattern as
|
|
43
|
+
* {@link withPublicGroupReadScopes}). Community-wide `publicContent` is
|
|
44
|
+
* still enforced by `ensureAccess` on the profile endpoints.
|
|
45
|
+
*/
|
|
46
|
+
export declare const withPublicProfileReadScopes: (authData: AuthorizationData, profile: {
|
|
47
|
+
id: string;
|
|
48
|
+
}, neededCapabilities: string[], config: {
|
|
49
|
+
profile?: {
|
|
50
|
+
none?: {
|
|
51
|
+
add?: string[];
|
|
52
|
+
};
|
|
53
|
+
} | null;
|
|
54
|
+
}) => AuthorizationData;
|