@openpeepshq/core 0.1.32 → 0.1.33
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/accessTokens/helpers.d.ts +2 -2
- package/dist/accessTokens/tokens.js +14 -7
- package/dist/accounts/mutations.d.ts +2 -2
- package/dist/analytics/cache.js +12 -7
- package/dist/analytics/pdfReport.d.ts +1 -0
- package/dist/analytics/pdfReport.js +5 -4
- package/dist/analytics/privacy.d.ts +18 -0
- package/dist/analytics/privacy.js +10 -0
- package/dist/analytics/read.js +24 -11
- package/dist/analytics/report.d.ts +1 -1
- package/dist/analytics/report.js +9 -2
- package/dist/backups/index.js +6 -3
- package/dist/backups/metadata.d.ts +7 -0
- package/dist/config/defaults/community.js +0 -6
- package/dist/config/defaults/db.d.ts +0 -2
- package/dist/config/defaults/db.js +0 -2
- package/dist/config/index.d.ts +10 -9
- package/dist/db/helpers.d.ts +6 -28
- package/dist/db/helpers.js +19 -149
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +4 -0
- package/dist/db/init.js +3 -2
- package/dist/db/migration/detect.d.ts +0 -3
- package/dist/db/migration/detect.js +0 -54
- package/dist/db/migration/importCollections.d.ts +1 -1
- package/dist/db/migration/importCollections.js +22 -6
- package/dist/db/migration/shared.d.ts +0 -4
- package/dist/db/migration/shared.js +0 -7
- package/dist/db/migration/transform.d.ts +2 -0
- package/dist/db/migration/transform.js +23 -0
- package/dist/db/pg/client.js +4 -0
- package/dist/db/pg/filters/edges.d.ts +1 -1
- package/dist/db/pg/filters/edges.js +1 -1
- package/dist/db/pg/filters/posts.d.ts +1 -0
- package/dist/db/pg/filters/posts.js +11 -1
- package/dist/db/pg/map/filters.js +5 -0
- package/dist/db/pg/map/relations.d.ts +1 -1
- package/dist/db/pg/map/relations.js +89 -41
- package/dist/db/pg/migrate.d.ts +23 -0
- package/dist/db/pg/migrate.js +87 -1
- package/dist/db/pg/schema/documents.d.ts +143 -0
- package/dist/db/pg/schema/documents.js +22 -1
- package/dist/db/pg/schema/edges.d.ts +1 -0
- package/dist/db/pg/schema/edges.js +2 -1
- package/dist/db/pg/schema/index.d.ts +143 -0
- package/dist/db/pg/sql/0007_shallow_oracle.sql +3 -0
- package/dist/db/pg/sql/0008_group_owner_roles.sql +31 -0
- package/dist/db/pg/sql/0009_event_occurrences.sql +26 -0
- package/dist/db/pg/sql/meta/0007_snapshot.json +4179 -0
- package/dist/db/pg/sql/meta/0009_snapshot.json +4299 -0
- package/dist/db/pg/sql/meta/_journal.json +21 -0
- package/dist/db/replaceOrigin.js +6 -0
- package/dist/db/types.d.ts +0 -4
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.js +54 -33
- package/dist/groups/finders.d.ts +2 -2
- package/dist/groups/helpers.d.ts +6 -6
- package/dist/groups/mapping.d.ts +4 -4
- package/dist/groups/mapping.js +2 -2
- package/dist/groups/mutations.js +1 -1
- package/dist/inviteLinks/helpers.d.ts +4 -4
- package/dist/jams/cache.d.ts +1 -1
- package/dist/jams/cache.js +2 -1
- package/dist/jams/finders.d.ts +2 -1
- package/dist/jams/finders.js +18 -7
- package/dist/jams/helpers.d.ts +4 -0
- package/dist/jams/index.d.ts +4 -3
- package/dist/jams/index.js +20 -13
- package/dist/jams/livekit.d.ts +46 -8
- package/dist/jams/livekit.js +103 -21
- package/dist/jams/mapping.d.ts +14 -4
- package/dist/jams/mutations.d.ts +2 -0
- package/dist/jams/rtmp.d.ts +5 -0
- package/dist/jams/rtmp.js +8 -0
- package/dist/jams/token.d.ts +3 -3
- package/dist/jams/token.js +15 -12
- package/dist/jams/waitingRoom.d.ts +6 -6
- package/dist/jams/waitingRoom.js +24 -23
- package/dist/migration/index.d.ts +4 -0
- package/dist/migration/index.js +4 -0
- package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +3 -1
- package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +3 -1
- package/dist/notifications/helpers.js +6 -2
- package/dist/notifications/push.js +11 -4
- package/dist/plugins/helpers.d.ts +1 -0
- package/dist/plugins/helpers.js +1 -8
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +41 -4
- package/dist/plugins/install.d.ts +20 -0
- package/dist/plugins/install.js +223 -0
- package/dist/plugins/state.d.ts +4 -0
- package/dist/plugins/state.js +29 -0
- package/dist/posts/eventAgenda.d.ts +165 -0
- package/dist/posts/eventAgenda.js +120 -0
- package/dist/posts/eventOccurrenceJobs.d.ts +4 -0
- package/dist/posts/eventOccurrenceJobs.js +23 -0
- package/dist/posts/eventOccurrences.d.ts +4 -0
- package/dist/posts/eventOccurrences.js +40 -0
- package/dist/posts/finders.d.ts +32 -8
- package/dist/posts/finders.js +27 -45
- package/dist/posts/helpers/filters.js +1 -1
- package/dist/posts/helpers/index.d.ts +102 -16
- package/dist/posts/helpers/index.js +33 -20
- package/dist/posts/index.d.ts +3 -0
- package/dist/posts/index.js +3 -0
- package/dist/posts/mapping.d.ts +275 -0
- package/dist/posts/mapping.js +37 -3
- package/dist/posts/mutations.d.ts +1 -1
- package/dist/posts/mutations.js +29 -18
- package/dist/posts/rsvpConfirmationEmail.js +2 -1
- package/dist/posts/unseenCounts.d.ts +2 -0
- package/dist/posts/unseenCounts.js +25 -8
- package/dist/profiles/cache.d.ts +3 -1
- package/dist/profiles/cache.js +9 -1
- package/dist/profiles/helpers.d.ts +5 -5
- package/dist/profiles/index.d.ts +1 -1
- package/dist/profiles/index.js +1 -1
- package/dist/profiles/mapping.d.ts +5 -5
- package/dist/profiles/mutations.js +12 -14
- package/dist/pushSubscriptions/helpers.d.ts +2 -2
- package/dist/pushSubscriptions/mutations.js +13 -1
- package/dist/reports/helpers.d.ts +6 -6
- package/dist/roles/defaults.js +1 -0
- package/dist/server/index.d.ts +7 -7
- package/dist/server/index.js +15 -8
- package/dist/stats/finders.d.ts +1692 -142
- package/dist/stats/mapping.d.ts +21 -0
- package/package.json +4 -9
- package/dist/db/arango.d.ts +0 -2
- package/dist/db/arango.js +0 -110
- package/dist/db/migration/autoMigrate.d.ts +0 -2
- package/dist/db/migration/autoMigrate.js +0 -111
- package/dist/db/migration/cli.d.ts +0 -1
- package/dist/db/migration/cli.js +0 -56
- package/dist/db/migration/exportArango.d.ts +0 -4
- package/dist/db/migration/exportArango.js +0 -80
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { hashtagRegex, normalizeHashtagTag,
|
|
1
|
+
import { hashtagRegex, normalizeHashtagTag, } from '@openpeepshq/common/types';
|
|
2
2
|
import { findProfileByHandle } from '../../profiles/finders.js';
|
|
3
3
|
import { getPublicProfile } from '../../profiles/cache.js';
|
|
4
4
|
import { composeFilters, connectionFinder, connector, disconnector, filterAndTransform, } from '../../db/helpers.js';
|
|
5
5
|
import { allpeepDb, collectionInfos } from '../../db/index.js';
|
|
6
6
|
import { capabilitiesConfig } from '../../config/index.js';
|
|
7
7
|
import { canReadPost } from './filters.js';
|
|
8
|
-
import {
|
|
8
|
+
import { matchMentionHandles, normalizePostDataFromDb, tombstoneProfileWithMetaIfDeleted, } from '@openpeepshq/common/lib';
|
|
9
|
+
import { EMBEDDED_REPOSTS_LIMIT } from '../mapping.js';
|
|
9
10
|
export const isDirect = (post) => post.visibility === 'direct';
|
|
10
11
|
export const isPrivate = (post) => post.visibility === 'private';
|
|
11
12
|
export const isUnlisted = (post) => post.visibility === 'unlisted';
|
|
@@ -24,22 +25,7 @@ export const extractHashtags = (data) => {
|
|
|
24
25
|
return getTags(data === null || data === void 0 ? void 0 : data.content);
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
|
-
export const extractMentionHandles = (text) =>
|
|
28
|
-
if (!text) {
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
const handles = new Set();
|
|
32
|
-
for (const word of text.split(/\s+/)) {
|
|
33
|
-
if (!word.startsWith('@')) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const handle = word.slice(1);
|
|
37
|
-
if (handleRegex.test(handle)) {
|
|
38
|
-
handles.add(handle);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return [...handles];
|
|
42
|
-
};
|
|
28
|
+
export const extractMentionHandles = (text) => matchMentionHandles(text);
|
|
43
29
|
export const resolveMentionsForPost = async (data) => {
|
|
44
30
|
const byProfileId = new Map();
|
|
45
31
|
for (const handle of extractMentionHandles(data.content)) {
|
|
@@ -66,12 +52,36 @@ export const reactionDisconnector = disconnector(collectionInfos.profilesCollect
|
|
|
66
52
|
export const bookmarkConnector = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.bookmarksCollection);
|
|
67
53
|
export const bookmarkDisconnector = disconnector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.bookmarksCollection);
|
|
68
54
|
export const postSeenConnector = connector(collectionInfos.profilesCollection, collectionInfos.postsCollection, collectionInfos.postSeenCollection);
|
|
69
|
-
const loadPublicProfile = async (profileId, ignoreSoftDelete = false) =>
|
|
55
|
+
const loadPublicProfile = async (profileId, ignoreSoftDelete = false) => tombstoneProfileWithMetaIfDeleted(await getPublicProfile(profileId, ignoreSoftDelete));
|
|
70
56
|
const addProfileForEntry = async (rawEntry) => (Object.assign(Object.assign({}, rawEntry), {
|
|
71
57
|
// ignoreSoftDelete: authorship must survive account removal
|
|
72
58
|
profile: (await loadPublicProfile(rawEntry.profile.id, true)) }));
|
|
73
59
|
const addProfileForReaction = async (rawReaction) => (Object.assign(Object.assign({}, rawReaction), { profile: (await loadPublicProfile(rawReaction.profile.id, true)) }));
|
|
74
60
|
const addProfileForMention = async (rawMention) => (Object.assign(Object.assign({}, rawMention), { profile: (await loadPublicProfile(rawMention.profile.id, true)) }));
|
|
61
|
+
const leanRepostsFromWrappers = async (wrappers) => {
|
|
62
|
+
if (!(wrappers === null || wrappers === void 0 ? void 0 : wrappers.length))
|
|
63
|
+
return [];
|
|
64
|
+
const withProfiles = await Promise.all(wrappers.map(async (wrapper) => {
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
const createEntry = (_a = wrapper.entries) === null || _a === void 0 ? void 0 : _a.find((entry) => entry.type === 'create');
|
|
67
|
+
const profileId = (_c = (_b = createEntry === null || createEntry === void 0 ? void 0 : createEntry.profile) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : wrapper.creatorId;
|
|
68
|
+
if (!profileId)
|
|
69
|
+
return null;
|
|
70
|
+
const profile = (createEntry === null || createEntry === void 0 ? void 0 : createEntry.profile)
|
|
71
|
+
? await loadPublicProfile(createEntry.profile.id, true)
|
|
72
|
+
: await loadPublicProfile(profileId, true);
|
|
73
|
+
if (!profile)
|
|
74
|
+
return null;
|
|
75
|
+
return {
|
|
76
|
+
profile,
|
|
77
|
+
createdAt: wrapper.createdAt,
|
|
78
|
+
};
|
|
79
|
+
}));
|
|
80
|
+
return withProfiles
|
|
81
|
+
.filter((r) => !!r)
|
|
82
|
+
.sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))
|
|
83
|
+
.slice(0, EMBEDDED_REPOSTS_LIMIT);
|
|
84
|
+
};
|
|
75
85
|
export const transformPost = async (post, currentProfile) => {
|
|
76
86
|
var _a;
|
|
77
87
|
const entries = post.entries
|
|
@@ -80,6 +90,7 @@ export const transformPost = async (post, currentProfile) => {
|
|
|
80
90
|
const reactions = post.reactions
|
|
81
91
|
? await Promise.all(post.reactions.map(addProfileForReaction))
|
|
82
92
|
: [];
|
|
93
|
+
const reposts = await leanRepostsFromWrappers(post.reposts);
|
|
83
94
|
const audience = post.audience
|
|
84
95
|
? (await Promise.all(post.audience.map((p) => loadPublicProfile(p.id)))).filter((profile) => !!profile)
|
|
85
96
|
: [];
|
|
@@ -99,10 +110,12 @@ export const transformPost = async (post, currentProfile) => {
|
|
|
99
110
|
.map((entry) => ({
|
|
100
111
|
profile: entry.profile,
|
|
101
112
|
response: entry.data.response,
|
|
113
|
+
recurrenceId: entry.data.recurrenceId,
|
|
102
114
|
createdAt: entry.createdAt,
|
|
103
115
|
})), audience,
|
|
104
116
|
mentions, profile: profile, entries,
|
|
105
|
-
reactions
|
|
117
|
+
reactions,
|
|
118
|
+
reposts });
|
|
106
119
|
};
|
|
107
120
|
export const toFilteredPostsList = async (queryResult, options) => {
|
|
108
121
|
const { authData, limit = 100, offset = 0, filters = [] } = options;
|
package/dist/posts/index.d.ts
CHANGED
|
@@ -5,3 +5,6 @@ export { CONTEXT_NODE_CAP, collectReplyClosureIds, loadReplyContextPosts, } from
|
|
|
5
5
|
export { listConversationPreviews, getConversationThread, findLatestThreadPostId, } from './conversationQueries';
|
|
6
6
|
export * from './helpers';
|
|
7
7
|
export { registerRsvpConfirmationEmail } from './rsvpConfirmationEmail';
|
|
8
|
+
export { rebuildEventOccurrences, clearEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences';
|
|
9
|
+
export { listEventAgenda } from './eventAgenda';
|
|
10
|
+
export { eventOccurrenceQueue, eventOccurrenceWorker, ensureEventOccurrenceSchedule, } from './eventOccurrenceJobs';
|
package/dist/posts/index.js
CHANGED
|
@@ -5,3 +5,6 @@ export { CONTEXT_NODE_CAP, collectReplyClosureIds, loadReplyContextPosts, } from
|
|
|
5
5
|
export { listConversationPreviews, getConversationThread, findLatestThreadPostId, } from './conversationQueries.js';
|
|
6
6
|
export * from './helpers/index.js';
|
|
7
7
|
export { registerRsvpConfirmationEmail } from './rsvpConfirmationEmail.js';
|
|
8
|
+
export { rebuildEventOccurrences, clearEventOccurrences, rebuildRecurringEventOccurrences, } from './eventOccurrences.js';
|
|
9
|
+
export { listEventAgenda } from './eventAgenda.js';
|
|
10
|
+
export { eventOccurrenceQueue, eventOccurrenceWorker, ensureEventOccurrenceSchedule, } from './eventOccurrenceJobs.js';
|
package/dist/posts/mapping.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { Mapping, Relation, RelationWithMapping } from '../db/pg/map';
|
|
|
2
2
|
import { EntryData, Profile, DbPost, DbBasePost } from '@openpeepshq/common/types';
|
|
3
3
|
export declare const entriesRelation: Relation<Profile, EntryData>;
|
|
4
4
|
export declare const groupRelation: Relation;
|
|
5
|
+
/** Cap for embedded who-reposted lists on feed/detail posts. */
|
|
6
|
+
export declare const EMBEDDED_REPOSTS_LIMIT = 50;
|
|
5
7
|
export declare const repostRelation: RelationWithMapping<DbBasePost>;
|
|
6
8
|
export declare const repostRelationForProfile: (profile?: {
|
|
7
9
|
id: string;
|
|
@@ -151,6 +153,27 @@ export declare const postsWithReplyCountMapping: Mapping<{
|
|
|
151
153
|
} | undefined;
|
|
152
154
|
} | undefined;
|
|
153
155
|
url?: string | undefined;
|
|
156
|
+
recurrence?: {
|
|
157
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
158
|
+
interval?: number | undefined;
|
|
159
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
160
|
+
until?: string | undefined;
|
|
161
|
+
count?: number | undefined;
|
|
162
|
+
} | undefined;
|
|
163
|
+
exceptions?: {
|
|
164
|
+
recurrenceId: string;
|
|
165
|
+
cancelled?: boolean | undefined;
|
|
166
|
+
start?: string | undefined;
|
|
167
|
+
end?: string | undefined;
|
|
168
|
+
physicalLocation?: {
|
|
169
|
+
text: string;
|
|
170
|
+
coordinates?: {
|
|
171
|
+
lat: number;
|
|
172
|
+
lng: number;
|
|
173
|
+
alt?: number | undefined;
|
|
174
|
+
} | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
}[] | undefined;
|
|
154
177
|
} | {
|
|
155
178
|
type: "article";
|
|
156
179
|
content?: string | undefined;
|
|
@@ -332,6 +355,27 @@ export declare const postsWithReplyCountMapping: Mapping<{
|
|
|
332
355
|
} | undefined;
|
|
333
356
|
} | undefined;
|
|
334
357
|
url?: string | undefined;
|
|
358
|
+
recurrence?: {
|
|
359
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
360
|
+
interval?: number | undefined;
|
|
361
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
362
|
+
until?: string | undefined;
|
|
363
|
+
count?: number | undefined;
|
|
364
|
+
} | undefined;
|
|
365
|
+
exceptions?: {
|
|
366
|
+
recurrenceId: string;
|
|
367
|
+
cancelled?: boolean | undefined;
|
|
368
|
+
start?: string | undefined;
|
|
369
|
+
end?: string | undefined;
|
|
370
|
+
physicalLocation?: {
|
|
371
|
+
text: string;
|
|
372
|
+
coordinates?: {
|
|
373
|
+
lat: number;
|
|
374
|
+
lng: number;
|
|
375
|
+
alt?: number | undefined;
|
|
376
|
+
} | undefined;
|
|
377
|
+
} | undefined;
|
|
378
|
+
}[] | undefined;
|
|
335
379
|
} | {
|
|
336
380
|
type: "article";
|
|
337
381
|
content?: string | undefined;
|
|
@@ -517,6 +561,27 @@ export declare const postsWithReplyCountMapping: Mapping<{
|
|
|
517
561
|
} | undefined;
|
|
518
562
|
} | undefined;
|
|
519
563
|
url?: string | undefined;
|
|
564
|
+
recurrence?: {
|
|
565
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
566
|
+
interval?: number | undefined;
|
|
567
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
568
|
+
until?: string | undefined;
|
|
569
|
+
count?: number | undefined;
|
|
570
|
+
} | undefined;
|
|
571
|
+
exceptions?: {
|
|
572
|
+
recurrenceId: string;
|
|
573
|
+
cancelled?: boolean | undefined;
|
|
574
|
+
start?: string | undefined;
|
|
575
|
+
end?: string | undefined;
|
|
576
|
+
physicalLocation?: {
|
|
577
|
+
text: string;
|
|
578
|
+
coordinates?: {
|
|
579
|
+
lat: number;
|
|
580
|
+
lng: number;
|
|
581
|
+
alt?: number | undefined;
|
|
582
|
+
} | undefined;
|
|
583
|
+
} | undefined;
|
|
584
|
+
}[] | undefined;
|
|
520
585
|
} | {
|
|
521
586
|
type: "article";
|
|
522
587
|
content?: string | undefined;
|
|
@@ -699,6 +764,27 @@ export declare const postsWithReplyToCountMapping: Mapping<{
|
|
|
699
764
|
} | undefined;
|
|
700
765
|
} | undefined;
|
|
701
766
|
url?: string | undefined;
|
|
767
|
+
recurrence?: {
|
|
768
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
769
|
+
interval?: number | undefined;
|
|
770
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
771
|
+
until?: string | undefined;
|
|
772
|
+
count?: number | undefined;
|
|
773
|
+
} | undefined;
|
|
774
|
+
exceptions?: {
|
|
775
|
+
recurrenceId: string;
|
|
776
|
+
cancelled?: boolean | undefined;
|
|
777
|
+
start?: string | undefined;
|
|
778
|
+
end?: string | undefined;
|
|
779
|
+
physicalLocation?: {
|
|
780
|
+
text: string;
|
|
781
|
+
coordinates?: {
|
|
782
|
+
lat: number;
|
|
783
|
+
lng: number;
|
|
784
|
+
alt?: number | undefined;
|
|
785
|
+
} | undefined;
|
|
786
|
+
} | undefined;
|
|
787
|
+
}[] | undefined;
|
|
702
788
|
} | {
|
|
703
789
|
type: "article";
|
|
704
790
|
content?: string | undefined;
|
|
@@ -880,6 +966,27 @@ export declare const postsWithReplyToCountMapping: Mapping<{
|
|
|
880
966
|
} | undefined;
|
|
881
967
|
} | undefined;
|
|
882
968
|
url?: string | undefined;
|
|
969
|
+
recurrence?: {
|
|
970
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
971
|
+
interval?: number | undefined;
|
|
972
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
973
|
+
until?: string | undefined;
|
|
974
|
+
count?: number | undefined;
|
|
975
|
+
} | undefined;
|
|
976
|
+
exceptions?: {
|
|
977
|
+
recurrenceId: string;
|
|
978
|
+
cancelled?: boolean | undefined;
|
|
979
|
+
start?: string | undefined;
|
|
980
|
+
end?: string | undefined;
|
|
981
|
+
physicalLocation?: {
|
|
982
|
+
text: string;
|
|
983
|
+
coordinates?: {
|
|
984
|
+
lat: number;
|
|
985
|
+
lng: number;
|
|
986
|
+
alt?: number | undefined;
|
|
987
|
+
} | undefined;
|
|
988
|
+
} | undefined;
|
|
989
|
+
}[] | undefined;
|
|
883
990
|
} | {
|
|
884
991
|
type: "article";
|
|
885
992
|
content?: string | undefined;
|
|
@@ -1065,6 +1172,27 @@ export declare const postsWithReplyToCountMapping: Mapping<{
|
|
|
1065
1172
|
} | undefined;
|
|
1066
1173
|
} | undefined;
|
|
1067
1174
|
url?: string | undefined;
|
|
1175
|
+
recurrence?: {
|
|
1176
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
1177
|
+
interval?: number | undefined;
|
|
1178
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
1179
|
+
until?: string | undefined;
|
|
1180
|
+
count?: number | undefined;
|
|
1181
|
+
} | undefined;
|
|
1182
|
+
exceptions?: {
|
|
1183
|
+
recurrenceId: string;
|
|
1184
|
+
cancelled?: boolean | undefined;
|
|
1185
|
+
start?: string | undefined;
|
|
1186
|
+
end?: string | undefined;
|
|
1187
|
+
physicalLocation?: {
|
|
1188
|
+
text: string;
|
|
1189
|
+
coordinates?: {
|
|
1190
|
+
lat: number;
|
|
1191
|
+
lng: number;
|
|
1192
|
+
alt?: number | undefined;
|
|
1193
|
+
} | undefined;
|
|
1194
|
+
} | undefined;
|
|
1195
|
+
}[] | undefined;
|
|
1068
1196
|
} | {
|
|
1069
1197
|
type: "article";
|
|
1070
1198
|
content?: string | undefined;
|
|
@@ -1247,6 +1375,27 @@ export declare const postsMapping: Mapping<{
|
|
|
1247
1375
|
} | undefined;
|
|
1248
1376
|
} | undefined;
|
|
1249
1377
|
url?: string | undefined;
|
|
1378
|
+
recurrence?: {
|
|
1379
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
1380
|
+
interval?: number | undefined;
|
|
1381
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
1382
|
+
until?: string | undefined;
|
|
1383
|
+
count?: number | undefined;
|
|
1384
|
+
} | undefined;
|
|
1385
|
+
exceptions?: {
|
|
1386
|
+
recurrenceId: string;
|
|
1387
|
+
cancelled?: boolean | undefined;
|
|
1388
|
+
start?: string | undefined;
|
|
1389
|
+
end?: string | undefined;
|
|
1390
|
+
physicalLocation?: {
|
|
1391
|
+
text: string;
|
|
1392
|
+
coordinates?: {
|
|
1393
|
+
lat: number;
|
|
1394
|
+
lng: number;
|
|
1395
|
+
alt?: number | undefined;
|
|
1396
|
+
} | undefined;
|
|
1397
|
+
} | undefined;
|
|
1398
|
+
}[] | undefined;
|
|
1250
1399
|
} | {
|
|
1251
1400
|
type: "article";
|
|
1252
1401
|
content?: string | undefined;
|
|
@@ -1426,6 +1575,27 @@ export declare const postsAuthMapping: Mapping<{
|
|
|
1426
1575
|
} | undefined;
|
|
1427
1576
|
} | undefined;
|
|
1428
1577
|
url?: string | undefined;
|
|
1578
|
+
recurrence?: {
|
|
1579
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
1580
|
+
interval?: number | undefined;
|
|
1581
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
1582
|
+
until?: string | undefined;
|
|
1583
|
+
count?: number | undefined;
|
|
1584
|
+
} | undefined;
|
|
1585
|
+
exceptions?: {
|
|
1586
|
+
recurrenceId: string;
|
|
1587
|
+
cancelled?: boolean | undefined;
|
|
1588
|
+
start?: string | undefined;
|
|
1589
|
+
end?: string | undefined;
|
|
1590
|
+
physicalLocation?: {
|
|
1591
|
+
text: string;
|
|
1592
|
+
coordinates?: {
|
|
1593
|
+
lat: number;
|
|
1594
|
+
lng: number;
|
|
1595
|
+
alt?: number | undefined;
|
|
1596
|
+
} | undefined;
|
|
1597
|
+
} | undefined;
|
|
1598
|
+
}[] | undefined;
|
|
1429
1599
|
} | {
|
|
1430
1600
|
type: "article";
|
|
1431
1601
|
content?: string | undefined;
|
|
@@ -1606,6 +1776,27 @@ export declare const postsMappingForProfile: (profile?: {
|
|
|
1606
1776
|
} | undefined;
|
|
1607
1777
|
} | undefined;
|
|
1608
1778
|
url?: string | undefined;
|
|
1779
|
+
recurrence?: {
|
|
1780
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
1781
|
+
interval?: number | undefined;
|
|
1782
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
1783
|
+
until?: string | undefined;
|
|
1784
|
+
count?: number | undefined;
|
|
1785
|
+
} | undefined;
|
|
1786
|
+
exceptions?: {
|
|
1787
|
+
recurrenceId: string;
|
|
1788
|
+
cancelled?: boolean | undefined;
|
|
1789
|
+
start?: string | undefined;
|
|
1790
|
+
end?: string | undefined;
|
|
1791
|
+
physicalLocation?: {
|
|
1792
|
+
text: string;
|
|
1793
|
+
coordinates?: {
|
|
1794
|
+
lat: number;
|
|
1795
|
+
lng: number;
|
|
1796
|
+
alt?: number | undefined;
|
|
1797
|
+
} | undefined;
|
|
1798
|
+
} | undefined;
|
|
1799
|
+
}[] | undefined;
|
|
1609
1800
|
} | {
|
|
1610
1801
|
type: "article";
|
|
1611
1802
|
content?: string | undefined;
|
|
@@ -1786,6 +1977,27 @@ export declare const postContextMappingForProfile: (profile?: {
|
|
|
1786
1977
|
} | undefined;
|
|
1787
1978
|
} | undefined;
|
|
1788
1979
|
url?: string | undefined;
|
|
1980
|
+
recurrence?: {
|
|
1981
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
1982
|
+
interval?: number | undefined;
|
|
1983
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
1984
|
+
until?: string | undefined;
|
|
1985
|
+
count?: number | undefined;
|
|
1986
|
+
} | undefined;
|
|
1987
|
+
exceptions?: {
|
|
1988
|
+
recurrenceId: string;
|
|
1989
|
+
cancelled?: boolean | undefined;
|
|
1990
|
+
start?: string | undefined;
|
|
1991
|
+
end?: string | undefined;
|
|
1992
|
+
physicalLocation?: {
|
|
1993
|
+
text: string;
|
|
1994
|
+
coordinates?: {
|
|
1995
|
+
lat: number;
|
|
1996
|
+
lng: number;
|
|
1997
|
+
alt?: number | undefined;
|
|
1998
|
+
} | undefined;
|
|
1999
|
+
} | undefined;
|
|
2000
|
+
}[] | undefined;
|
|
1789
2001
|
} | {
|
|
1790
2002
|
type: "article";
|
|
1791
2003
|
content?: string | undefined;
|
|
@@ -1965,6 +2177,27 @@ export declare const conversationLeavesMapping: Mapping<{
|
|
|
1965
2177
|
} | undefined;
|
|
1966
2178
|
} | undefined;
|
|
1967
2179
|
url?: string | undefined;
|
|
2180
|
+
recurrence?: {
|
|
2181
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
2182
|
+
interval?: number | undefined;
|
|
2183
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
2184
|
+
until?: string | undefined;
|
|
2185
|
+
count?: number | undefined;
|
|
2186
|
+
} | undefined;
|
|
2187
|
+
exceptions?: {
|
|
2188
|
+
recurrenceId: string;
|
|
2189
|
+
cancelled?: boolean | undefined;
|
|
2190
|
+
start?: string | undefined;
|
|
2191
|
+
end?: string | undefined;
|
|
2192
|
+
physicalLocation?: {
|
|
2193
|
+
text: string;
|
|
2194
|
+
coordinates?: {
|
|
2195
|
+
lat: number;
|
|
2196
|
+
lng: number;
|
|
2197
|
+
alt?: number | undefined;
|
|
2198
|
+
} | undefined;
|
|
2199
|
+
} | undefined;
|
|
2200
|
+
}[] | undefined;
|
|
1968
2201
|
} | {
|
|
1969
2202
|
type: "article";
|
|
1970
2203
|
content?: string | undefined;
|
|
@@ -2145,6 +2378,27 @@ export declare const conversationLeavesMappingForProfile: (profile?: {
|
|
|
2145
2378
|
} | undefined;
|
|
2146
2379
|
} | undefined;
|
|
2147
2380
|
url?: string | undefined;
|
|
2381
|
+
recurrence?: {
|
|
2382
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
2383
|
+
interval?: number | undefined;
|
|
2384
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
2385
|
+
until?: string | undefined;
|
|
2386
|
+
count?: number | undefined;
|
|
2387
|
+
} | undefined;
|
|
2388
|
+
exceptions?: {
|
|
2389
|
+
recurrenceId: string;
|
|
2390
|
+
cancelled?: boolean | undefined;
|
|
2391
|
+
start?: string | undefined;
|
|
2392
|
+
end?: string | undefined;
|
|
2393
|
+
physicalLocation?: {
|
|
2394
|
+
text: string;
|
|
2395
|
+
coordinates?: {
|
|
2396
|
+
lat: number;
|
|
2397
|
+
lng: number;
|
|
2398
|
+
alt?: number | undefined;
|
|
2399
|
+
} | undefined;
|
|
2400
|
+
} | undefined;
|
|
2401
|
+
}[] | undefined;
|
|
2148
2402
|
} | {
|
|
2149
2403
|
type: "article";
|
|
2150
2404
|
content?: string | undefined;
|
|
@@ -2323,6 +2577,27 @@ export declare const postIdsMapping: Mapping<{
|
|
|
2323
2577
|
} | undefined;
|
|
2324
2578
|
} | undefined;
|
|
2325
2579
|
url?: string | undefined;
|
|
2580
|
+
recurrence?: {
|
|
2581
|
+
freq: "DAILY" | "WEEKLY" | "MONTHLY";
|
|
2582
|
+
interval?: number | undefined;
|
|
2583
|
+
byDay?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[] | undefined;
|
|
2584
|
+
until?: string | undefined;
|
|
2585
|
+
count?: number | undefined;
|
|
2586
|
+
} | undefined;
|
|
2587
|
+
exceptions?: {
|
|
2588
|
+
recurrenceId: string;
|
|
2589
|
+
cancelled?: boolean | undefined;
|
|
2590
|
+
start?: string | undefined;
|
|
2591
|
+
end?: string | undefined;
|
|
2592
|
+
physicalLocation?: {
|
|
2593
|
+
text: string;
|
|
2594
|
+
coordinates?: {
|
|
2595
|
+
lat: number;
|
|
2596
|
+
lng: number;
|
|
2597
|
+
alt?: number | undefined;
|
|
2598
|
+
} | undefined;
|
|
2599
|
+
} | undefined;
|
|
2600
|
+
}[] | undefined;
|
|
2326
2601
|
} | {
|
|
2327
2602
|
type: "article";
|
|
2328
2603
|
content?: string | undefined;
|
package/dist/posts/mapping.js
CHANGED
|
@@ -59,6 +59,27 @@ const reactionsRelation = {
|
|
|
59
59
|
softDelete: true,
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
|
+
/** Cap for embedded who-reposted lists on feed/detail posts. */
|
|
63
|
+
export const EMBEDDED_REPOSTS_LIMIT = 50;
|
|
64
|
+
/**
|
|
65
|
+
* Lean inbound wrappers for the embedded `reposts` preview. Only loads create
|
|
66
|
+
* entries (for the reposter profile) — not the full post graph used by
|
|
67
|
+
* `repostsOfPostRelation`. Cap + newest-first sort keep hot posts bounded.
|
|
68
|
+
*/
|
|
69
|
+
const leanRepostsRelation = {
|
|
70
|
+
alias: 'reposts',
|
|
71
|
+
edgeCollection: 'repost',
|
|
72
|
+
direction: 'INBOUND',
|
|
73
|
+
skipEdge: true,
|
|
74
|
+
cardinality: 'many',
|
|
75
|
+
mapping: {
|
|
76
|
+
collection: 'posts',
|
|
77
|
+
softDelete: true,
|
|
78
|
+
limit: EMBEDDED_REPOSTS_LIMIT,
|
|
79
|
+
sort: [['createdAt', 'DESC']],
|
|
80
|
+
postFilterRelations: [entriesRelation],
|
|
81
|
+
},
|
|
82
|
+
};
|
|
62
83
|
const audienceRelation = {
|
|
63
84
|
alias: 'audience',
|
|
64
85
|
edgeCollection: 'audience',
|
|
@@ -95,6 +116,7 @@ const basePostFilterRelations = [
|
|
|
95
116
|
replyCountRelation,
|
|
96
117
|
repostCountRelation,
|
|
97
118
|
reactionsRelation,
|
|
119
|
+
leanRepostsRelation,
|
|
98
120
|
tagsRelation,
|
|
99
121
|
mentionsRelation,
|
|
100
122
|
];
|
|
@@ -116,7 +138,12 @@ const basePostMapDataForProfile = (profile) => (Object.assign(Object.assign({},
|
|
|
116
138
|
...(basePostMapData.postFilterDerivedProperties || []),
|
|
117
139
|
seenBatchByCurrentProfileDerivedProperty(profile),
|
|
118
140
|
] }));
|
|
119
|
-
|
|
141
|
+
// Keep soft-deleted parents so replies can render a tombstone / deleted post.
|
|
142
|
+
const replyPostMapData = {
|
|
143
|
+
collection: 'posts',
|
|
144
|
+
softDelete: false,
|
|
145
|
+
postFilterRelations: [entriesRelation],
|
|
146
|
+
};
|
|
120
147
|
const replyToRelation = {
|
|
121
148
|
alias: 'replyTo',
|
|
122
149
|
edgeCollection: 'replyTo',
|
|
@@ -189,11 +216,16 @@ const contextPostFilterRelations = [
|
|
|
189
216
|
replyCountRelation,
|
|
190
217
|
repostCountRelation,
|
|
191
218
|
reactionsRelation,
|
|
219
|
+
leanRepostsRelation,
|
|
192
220
|
tagsRelation,
|
|
193
221
|
mentionsRelation,
|
|
194
222
|
replyToRelation,
|
|
195
223
|
];
|
|
196
|
-
export const postContextMappingForProfile = (profile) => map(
|
|
224
|
+
export const postContextMappingForProfile = (profile) => map({
|
|
225
|
+
collection: 'posts',
|
|
226
|
+
softDelete: false,
|
|
227
|
+
postFilterRelations: contextPostFilterRelations,
|
|
228
|
+
postFilterDerivedProperties: [
|
|
197
229
|
{
|
|
198
230
|
alias: 'inReplyToId',
|
|
199
231
|
resolve: postDerived.inReplyToId,
|
|
@@ -203,7 +235,9 @@ export const postContextMappingForProfile = (profile) => map(Object.assign(Objec
|
|
|
203
235
|
resolve: postDerived.groupId,
|
|
204
236
|
},
|
|
205
237
|
seenBatchByCurrentProfileDerivedProperty(profile),
|
|
206
|
-
],
|
|
238
|
+
],
|
|
239
|
+
limit: 100,
|
|
240
|
+
});
|
|
207
241
|
export const contextRelation = (depth, direction, contextMapping = postsMapping) => ({
|
|
208
242
|
alias: 'context',
|
|
209
243
|
edgeCollection: collectionInfos.repliesCollection.name,
|
|
@@ -18,4 +18,4 @@ export declare const markGroupPostsSeen: (authData: AuthorizationData, groupId:
|
|
|
18
18
|
export declare const deletePost: (post: PostWithMeta, profile: Profile) => Promise<import("@openpeepshq/common").DbPost | undefined>;
|
|
19
19
|
export declare const vote: (profile: Profile, post: PostWithMeta, data: Answer) => Promise<void>;
|
|
20
20
|
export declare const rsvpRespond: (profile: Profile, post: PostWithMeta, data: RSVP) => Promise<void>;
|
|
21
|
-
export declare const rsvpManageByOrganizer: (actingProfile: Profile, targetProfile: Profile, post: PostWithMeta, response: Extract<RsvpResponse, "removed" | "yes"
|
|
21
|
+
export declare const rsvpManageByOrganizer: (actingProfile: Profile, targetProfile: Profile, post: PostWithMeta, response: Extract<RsvpResponse, "removed" | "yes">, recurrenceId?: string) => Promise<void>;
|