@openpeepshq/core 0.1.33 → 0.1.35
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/finders.js +5 -6
- package/dist/accessTokens/mutations.js +1 -1
- package/dist/accessTokens/tokens.js +8 -11
- package/dist/accounts/helpers.js +6 -2
- package/dist/accounts/mutations.js +36 -33
- package/dist/analytics/cache.js +3 -3
- package/dist/analytics/clicks.js +14 -22
- package/dist/analytics/compile.js +17 -12
- package/dist/analytics/dateRange.js +3 -5
- package/dist/analytics/jobs.js +3 -4
- package/dist/analytics/pdfReport.js +45 -61
- package/dist/analytics/privacy.js +1 -1
- package/dist/analytics/read.js +164 -140
- package/dist/analytics/report.d.ts +22 -1
- package/dist/analytics/report.js +2 -3
- package/dist/analytics/settings.js +3 -4
- package/dist/backups/index.js +82 -25
- package/dist/backups/metadata.d.ts +2 -3
- package/dist/backups/metadata.js +6 -2
- package/dist/config/db.js +2 -4
- package/dist/config/defaults/capabilities.js +13 -2
- package/dist/config/defaults/community.js +8 -3
- package/dist/config/defaults/core.d.ts +1 -1
- package/dist/config/defaults/core.js +16 -8
- package/dist/config/index.d.ts +22 -0
- package/dist/config/index.js +15 -11
- package/dist/db/explorer/query.js +9 -8
- package/dist/db/explorer/sql.js +8 -8
- package/dist/db/helpers.d.ts +1 -0
- package/dist/db/helpers.js +25 -7
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +1 -0
- package/dist/db/init.js +2 -3
- package/dist/db/migration/importCollections.d.ts +14 -9
- package/dist/db/migration/importCollections.js +121 -174
- package/dist/db/migration/shared.d.ts +2 -33
- package/dist/db/migration/shared.js +17 -87
- package/dist/db/pg/client.js +4 -7
- package/dist/db/pg/collections.d.ts +2 -2
- package/dist/db/pg/collections.js +2 -2
- package/dist/db/pg/filters/index.js +1 -1
- package/dist/db/pg/filters/posts.d.ts +12 -0
- package/dist/db/pg/filters/posts.js +30 -4
- package/dist/db/pg/filters/profiles.d.ts +1 -0
- package/dist/db/pg/filters/profiles.js +2 -1
- package/dist/db/pg/helpers.js +2 -14
- package/dist/db/pg/map/filters.js +40 -10
- package/dist/db/pg/map/helpers.js +5 -1
- package/dist/db/pg/map/index.js +46 -51
- package/dist/db/pg/map/mutations.js +65 -25
- package/dist/db/pg/map/registry.d.ts +5 -0
- package/dist/db/pg/map/registry.js +133 -56
- package/dist/db/pg/map/relations.js +76 -68
- package/dist/db/pg/map/search.js +15 -37
- package/dist/db/pg/mappers.js +13 -7
- package/dist/db/pg/migrate.d.ts +1 -2
- package/dist/db/pg/migrate.js +8 -9
- package/dist/db/pg/queries/activity.js +5 -5
- package/dist/db/pg/queries/derived.js +8 -12
- package/dist/db/pg/queries/sorts.d.ts +1 -0
- package/dist/db/pg/queries/sorts.js +4 -0
- package/dist/db/pg/schema/documents.d.ts +279 -41
- package/dist/db/pg/schema/documents.js +136 -22
- package/dist/db/pg/schema/edges.d.ts +116 -7
- package/dist/db/pg/schema/edges.js +9 -2
- package/dist/db/pg/schema/index.d.ts +362 -15
- package/dist/db/pg/schema/index.js +5 -1
- package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
- package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
- package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
- package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
- package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
- package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
- package/dist/db/pg/sql/0016_posts_search_vector_title_tags_path.sql +54 -0
- package/dist/db/pg/sql/meta/{0009_snapshot.json → 0015_snapshot.json} +291 -36
- package/dist/db/pg/sql/meta/_journal.json +49 -0
- package/dist/db/replaceOrigin.js +1 -1
- package/dist/email/queueStats.js +8 -11
- package/dist/email/render.js +14 -3
- package/dist/email/send.js +19 -17
- package/dist/email/smtpTest.js +10 -6
- package/dist/errors/index.js +1 -1
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +1 -0
- package/dist/events/once.js +2 -4
- package/dist/federation/activities.d.ts +17 -0
- package/dist/federation/activities.js +25 -0
- package/dist/federation/identity.d.ts +16 -0
- package/dist/federation/identity.js +52 -0
- package/dist/federation/index.d.ts +4 -0
- package/dist/federation/index.js +3 -0
- package/dist/federation/profiles.d.ts +3 -0
- package/dist/federation/profiles.js +14 -0
- package/dist/groups/finders.d.ts +2 -1
- package/dist/groups/helpers.d.ts +18 -0
- package/dist/groups/helpers.js +1 -2
- package/dist/groups/mapping.d.ts +4 -2
- package/dist/groups/mutations.js +1 -1
- package/dist/hashtags/finders.d.ts +6 -3
- package/dist/hashtags/finders.js +2 -0
- package/dist/hashtags/helpers.d.ts +8 -0
- package/dist/hashtags/helpers.js +4 -0
- package/dist/hashtags/index.d.ts +2 -0
- package/dist/hashtags/index.js +2 -0
- package/dist/hashtags/mutations.d.ts +3 -0
- package/dist/hashtags/mutations.js +13 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +3 -1
- package/dist/i18n/pluginLocales.d.ts +6 -0
- package/dist/i18n/pluginLocales.js +15 -0
- package/dist/inviteLinks/mutations.js +2 -3
- package/dist/jams/export.d.ts +19 -0
- package/dist/jams/export.js +58 -0
- package/dist/jams/finders.js +4 -1
- package/dist/jams/health.d.ts +10 -0
- package/dist/jams/health.js +50 -0
- package/dist/jams/helpers.d.ts +2 -2
- package/dist/jams/helpers.js +6 -2
- package/dist/jams/index.d.ts +2 -0
- package/dist/jams/index.js +25 -18
- package/dist/jams/jobs.js +2 -3
- package/dist/jams/livekit.d.ts +49 -4
- package/dist/jams/livekit.js +62 -45
- package/dist/jams/mapping.d.ts +3 -3
- package/dist/jams/mutations.d.ts +1 -1
- package/dist/jams/recording.d.ts +10 -0
- package/dist/jams/recording.js +33 -1
- package/dist/jams/token.d.ts +13 -1
- package/dist/jams/token.js +25 -18
- package/dist/jams/waitingRoom.js +1 -1
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.js +9 -3
- package/dist/jobs/jobDetail.js +6 -12
- package/dist/jobs/jobLog.js +2 -3
- package/dist/lib/streams.js +4 -39
- package/dist/lib/zodDeepPartial.d.ts +1 -1
- package/dist/lib/zodDeepPartial.js +1 -1
- package/dist/log/index.js +13 -29
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.js +73 -12
- package/dist/media/jobs.js +1 -2
- package/dist/media/openpeeps/index.js +11 -46
- package/dist/media/processing.js +25 -11
- package/dist/media/streaming.js +5 -5
- package/dist/media/streamingCleanupJobs.js +1 -2
- package/dist/media/streamingJobs.js +3 -4
- package/dist/media/streamingPrewarm.js +7 -11
- package/dist/mediaAttachments/index.js +6 -2
- package/dist/notifications/defaultNotifications/announcement/index.js +15 -18
- package/dist/notifications/defaultNotifications/directMessage/index.js +9 -8
- package/dist/notifications/defaultNotifications/follow/index.js +15 -18
- package/dist/notifications/defaultNotifications/groupAdded/index.js +14 -17
- package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +15 -18
- package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +15 -18
- package/dist/notifications/defaultNotifications/index.js +4 -0
- package/dist/notifications/defaultNotifications/jamModerator/index.js +3 -5
- package/dist/notifications/defaultNotifications/jamSpeaker/index.js +14 -18
- package/dist/notifications/defaultNotifications/jamStarted/index.js +18 -22
- package/dist/notifications/defaultNotifications/mention/index.js +20 -24
- package/dist/notifications/defaultNotifications/newGroupPost/index.js +11 -6
- package/dist/notifications/defaultNotifications/newProfile/index.js +14 -17
- package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
- package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
- package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
- package/dist/notifications/defaultNotifications/pollEnded/recipients.js +17 -0
- package/dist/notifications/defaultNotifications/pollVote/index.js +14 -17
- package/dist/notifications/defaultNotifications/reaction/index.js +18 -21
- package/dist/notifications/defaultNotifications/reply/index.js +21 -22
- package/dist/notifications/defaultNotifications/repost/index.js +16 -20
- package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
- package/dist/notifications/defaultNotifications/rsvp/index.js +31 -18
- package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +82 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
- package/dist/notifications/fcmCredential.js +1 -1
- package/dist/notifications/finders.js +1 -1
- package/dist/notifications/helpers.js +13 -10
- package/dist/notifications/jobs.js +10 -5
- package/dist/notifications/mutations.js +8 -1
- package/dist/notifications/push.js +11 -16
- package/dist/performance/index.js +3 -3
- package/dist/plugins/helpers.js +3 -6
- package/dist/plugins/index.js +39 -4
- package/dist/plugins/install.d.ts +28 -9
- package/dist/plugins/install.js +302 -56
- package/dist/plugins/pluginAuth.d.ts +1 -1
- package/dist/plugins/pluginAuth.js +13 -10
- package/dist/plugins/state.js +2 -3
- package/dist/posts/activity.d.ts +9 -0
- package/dist/posts/activity.js +34 -0
- package/dist/posts/contextClosure.d.ts +1 -9
- package/dist/posts/contextClosure.js +14 -44
- package/dist/posts/conversationQueries.d.ts +7 -0
- package/dist/posts/conversationQueries.js +76 -4
- package/dist/posts/eventAgenda.d.ts +1 -0
- package/dist/posts/eventAgenda.js +17 -8
- package/dist/posts/eventOccurrenceJobs.js +7 -2
- package/dist/posts/eventOccurrences.d.ts +6 -0
- package/dist/posts/eventOccurrences.js +22 -1
- package/dist/posts/finders.d.ts +56 -9
- package/dist/posts/finders.js +84 -23
- package/dist/posts/helpers/filters.js +13 -9
- package/dist/posts/helpers/index.d.ts +179 -14
- package/dist/posts/helpers/index.js +70 -34
- package/dist/posts/index.d.ts +5 -2
- package/dist/posts/index.js +5 -2
- package/dist/posts/mapping.d.ts +765 -30
- package/dist/posts/mapping.js +74 -31
- package/dist/posts/mutations.d.ts +516 -3
- package/dist/posts/mutations.js +179 -41
- package/dist/posts/pollEnd.d.ts +3 -0
- package/dist/posts/pollEnd.js +4 -0
- package/dist/posts/pollEndJobs.d.ts +8 -0
- package/dist/posts/pollEndJobs.js +49 -0
- package/dist/posts/replyClosure.d.ts +10 -0
- package/dist/posts/replyClosure.js +43 -0
- package/dist/posts/rsvpConfirmationEmail.js +23 -15
- package/dist/posts/threadPreview.d.ts +8 -0
- package/dist/posts/threadPreview.js +44 -0
- package/dist/posts/unseenCounts.js +4 -1
- package/dist/processingStats/queries.js +6 -7
- package/dist/profileSettings/cache.js +21 -5
- package/dist/profileSettings/mapping.d.ts +2 -0
- package/dist/profiles/activityQueries.d.ts +5 -0
- package/dist/profiles/activityQueries.js +85 -0
- package/dist/profiles/activitySummary.d.ts +3 -0
- package/dist/profiles/activitySummary.js +82 -0
- package/dist/profiles/blocks.d.ts +12 -0
- package/dist/profiles/blocks.js +73 -0
- package/dist/profiles/cache.d.ts +1 -0
- package/dist/profiles/cache.js +30 -10
- package/dist/profiles/export.js +30 -39
- package/dist/profiles/finders.d.ts +2 -1
- package/dist/profiles/finders.js +15 -8
- package/dist/profiles/helpers.d.ts +2 -0
- package/dist/profiles/index.d.ts +2 -0
- package/dist/profiles/index.js +2 -0
- package/dist/profiles/mapping.d.ts +10 -5
- package/dist/profiles/mapping.js +13 -1
- package/dist/profiles/mutations.d.ts +8 -4
- package/dist/profiles/mutations.js +31 -4
- package/dist/redis/connection.d.ts +2 -0
- package/dist/redis/connection.js +25 -6
- package/dist/reports/helpers.js +7 -3
- package/dist/roles/index.d.ts +1 -1
- package/dist/roles/index.js +1 -1
- package/dist/roles/mapping.d.ts +1 -0
- package/dist/roles/mutations.js +85 -3
- package/dist/search/finders.js +15 -3
- package/dist/search/helpers.js +1 -1
- package/dist/search/mapping.d.ts +1 -1
- package/dist/search/mapping.js +6 -2
- package/dist/sentry/index.js +9 -11
- package/dist/seo/index.d.ts +50 -0
- package/dist/seo/index.js +145 -0
- package/dist/seo/route.d.ts +18 -0
- package/dist/seo/route.js +19 -0
- package/dist/server/index.d.ts +19 -0
- package/dist/server/index.js +31 -14
- package/dist/server/stablePublicServerInfo.d.ts +17 -0
- package/dist/server/stablePublicServerInfo.js +37 -0
- package/dist/server/status.d.ts +25 -0
- package/dist/server/status.js +97 -0
- package/dist/session/index.js +2 -2
- package/dist/stats/finders.d.ts +1 -17681
- package/dist/stats/finders.js +22 -9
- package/dist/stats/helpers.js +4 -1
- package/dist/stats/mapping.d.ts +39 -2
- package/dist/stats/mapping.js +8 -4
- package/dist/stripe/cache.js +5 -6
- package/dist/stripe/connection.js +3 -4
- package/dist/stripe/helpers.js +15 -20
- package/package.json +5 -7
- package/dist/db/migration/detect.d.ts +0 -3
- package/dist/db/migration/detect.js +0 -33
- package/dist/db/migration/importPostgres.d.ts +0 -3
- package/dist/db/migration/importPostgres.js +0 -18
- package/dist/db/migration/transform.d.ts +0 -20
- package/dist/db/migration/transform.js +0 -232
- package/dist/db/migration/validate.d.ts +0 -18
- package/dist/db/migration/validate.js +0 -69
- package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
- package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
- package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
- package/dist/db/pg/sql/meta/0006_snapshot.json +0 -4200
- package/dist/db/pg/sql/meta/0007_snapshot.json +0 -4179
- package/dist/mastodon/index.d.ts +0 -4
- package/dist/mastodon/index.js +0 -51
- package/dist/mastodon/types.d.ts +0 -7579
- package/dist/mastodon/types.js +0 -523
- package/dist/mastodon/typescript.d.ts +0 -1578
- package/dist/mastodon/typescript.js +0 -1
- package/dist/migration/index.d.ts +0 -4
- package/dist/migration/index.js +0 -4
- package/dist/roles/defaults.d.ts +0 -2
- package/dist/roles/defaults.js +0 -95
|
@@ -35,10 +35,11 @@ export declare const baseProfilesMapping: import("../db/pg/map").Mapping<{
|
|
|
35
35
|
guestData?: {
|
|
36
36
|
email?: string | undefined;
|
|
37
37
|
resource?: {
|
|
38
|
-
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "
|
|
38
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "*" | "jams" | "webhooks" | "analytics" | "render";
|
|
39
39
|
id?: string | undefined;
|
|
40
40
|
} | undefined;
|
|
41
41
|
} | undefined;
|
|
42
|
+
pinnedPostId?: string | undefined;
|
|
42
43
|
}, Profile, Profile>;
|
|
43
44
|
/** Lean mapping for public search results (memberships only). */
|
|
44
45
|
export declare const publicProfilesSearchMapping: import("../db/pg/map").Mapping<{
|
|
@@ -73,10 +74,11 @@ export declare const publicProfilesSearchMapping: import("../db/pg/map").Mapping
|
|
|
73
74
|
guestData?: {
|
|
74
75
|
email?: string | undefined;
|
|
75
76
|
resource?: {
|
|
76
|
-
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "
|
|
77
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "*" | "jams" | "webhooks" | "analytics" | "render";
|
|
77
78
|
id?: string | undefined;
|
|
78
79
|
} | undefined;
|
|
79
80
|
} | undefined;
|
|
81
|
+
pinnedPostId?: string | undefined;
|
|
80
82
|
}, ProfileWithMeta, ProfileWithMeta>;
|
|
81
83
|
/**
|
|
82
84
|
* Lean public profile for feed/API hydrate — memberships + SQL follower
|
|
@@ -114,10 +116,11 @@ export declare const publicProfilesMapping: import("../db/pg/map").Mapping<{
|
|
|
114
116
|
guestData?: {
|
|
115
117
|
email?: string | undefined;
|
|
116
118
|
resource?: {
|
|
117
|
-
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "
|
|
119
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "*" | "jams" | "webhooks" | "analytics" | "render";
|
|
118
120
|
id?: string | undefined;
|
|
119
121
|
} | undefined;
|
|
120
122
|
} | undefined;
|
|
123
|
+
pinnedPostId?: string | undefined;
|
|
121
124
|
}, ProfileWithMeta, ProfileWithMeta>;
|
|
122
125
|
export declare const profilesMapping: import("../db/pg/map").Mapping<{
|
|
123
126
|
handle: string;
|
|
@@ -151,10 +154,11 @@ export declare const profilesMapping: import("../db/pg/map").Mapping<{
|
|
|
151
154
|
guestData?: {
|
|
152
155
|
email?: string | undefined;
|
|
153
156
|
resource?: {
|
|
154
|
-
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "
|
|
157
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "*" | "jams" | "webhooks" | "analytics" | "render";
|
|
155
158
|
id?: string | undefined;
|
|
156
159
|
} | undefined;
|
|
157
160
|
} | undefined;
|
|
161
|
+
pinnedPostId?: string | undefined;
|
|
158
162
|
}, ProfileWithMeta, ProfileWithMeta>;
|
|
159
163
|
export declare const membersExportMapping: import("../db/pg/map").Mapping<{
|
|
160
164
|
handle: string;
|
|
@@ -188,10 +192,11 @@ export declare const membersExportMapping: import("../db/pg/map").Mapping<{
|
|
|
188
192
|
guestData?: {
|
|
189
193
|
email?: string | undefined;
|
|
190
194
|
resource?: {
|
|
191
|
-
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "
|
|
195
|
+
type: "profiles" | "groups" | "posts" | "notifications" | "reports" | "db" | "self" | "*" | "jams" | "webhooks" | "analytics" | "render";
|
|
192
196
|
id?: string | undefined;
|
|
193
197
|
} | undefined;
|
|
194
198
|
} | undefined;
|
|
199
|
+
pinnedPostId?: string | undefined;
|
|
195
200
|
}, Profile, Profile>;
|
|
196
201
|
export declare const membersRelation: RelationWithMapping<ProfileWithMeta, GroupMember>;
|
|
197
202
|
export declare const profileRoleRelation: RelationWithMapping<Profile>;
|
package/dist/profiles/mapping.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { map } from '../db/pg/map/index.js';
|
|
2
2
|
import { groupsMapping } from '../groups/mapping.js';
|
|
3
3
|
import { profileDerived } from '../db/pg/queries/index.js';
|
|
4
|
+
import { edgeFilters } from '../db/pg/filters/index.js';
|
|
4
5
|
const membersExportStatsRelations = [
|
|
5
6
|
{
|
|
6
7
|
alias: 'reactionsCount',
|
|
7
|
-
edgeCollection: '
|
|
8
|
+
edgeCollection: 'entries',
|
|
8
9
|
direction: 'OUTBOUND',
|
|
9
10
|
count: true,
|
|
10
11
|
cardinality: 'one',
|
|
12
|
+
edgeFilter: edgeFilters.entryType('reaction'),
|
|
11
13
|
},
|
|
12
14
|
];
|
|
13
15
|
export const profileAccountRelation = {
|
|
@@ -65,6 +67,16 @@ export const profileRelations = [
|
|
|
65
67
|
relations: baseProfileRelations,
|
|
66
68
|
},
|
|
67
69
|
},
|
|
70
|
+
{
|
|
71
|
+
alias: 'followedHashtags',
|
|
72
|
+
edgeCollection: 'profileHashtags',
|
|
73
|
+
direction: 'OUTBOUND',
|
|
74
|
+
skipEdge: true,
|
|
75
|
+
cardinality: 'many',
|
|
76
|
+
mapping: {
|
|
77
|
+
collection: 'hashtags',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
68
80
|
];
|
|
69
81
|
export const baseProfilesMapping = map({
|
|
70
82
|
collection: 'profiles',
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { Account, FollowData, GuestPassRequest, Profile, ProfileData, Role } from '@openpeepshq/common/types';
|
|
2
|
-
export declare const createProfile: (data: ProfileData, controllingAccount?: Account) => Promise<
|
|
3
|
-
export declare const createGuestProfile: (guestPassRequest: GuestPassRequest) => Promise<
|
|
4
|
-
export declare const updateProfile: (profileId: string, data: Partial<ProfileData>) => Promise<
|
|
1
|
+
import { Account, FollowData, GuestPassRequest, Profile, ProfileData, ProfileWithMeta, Role } from '@openpeepshq/common/types';
|
|
2
|
+
export declare const createProfile: (data: ProfileData, controllingAccount?: Account) => Promise<ProfileWithMeta>;
|
|
3
|
+
export declare const createGuestProfile: (guestPassRequest: GuestPassRequest) => Promise<ProfileWithMeta>;
|
|
4
|
+
export declare const updateProfile: (profileId: string, data: Partial<ProfileData>) => Promise<ProfileWithMeta>;
|
|
5
|
+
export declare const pinPostOnProfile: (profile: Pick<Profile, "id" | "handle">, pinnedPostId: string) => Promise<ProfileWithMeta>;
|
|
5
6
|
export declare const deleteProfile: (profileId: string) => Promise<void>;
|
|
6
7
|
export declare const follow: (follower: Profile, followed: Profile, followData: FollowData) => Promise<void>;
|
|
7
8
|
export declare const unfollow: (follower: Profile, followed: Profile) => Promise<void>;
|
|
9
|
+
export declare const blockProfile: (blocker: Profile, blocked: Profile) => Promise<void>;
|
|
10
|
+
export declare const unblockProfile: (blocker: Profile, blocked: Profile) => Promise<void>;
|
|
11
|
+
export declare const listBlockedProfiles: (profile: Profile) => Promise<ProfileWithMeta[]>;
|
|
8
12
|
export declare const assignRole: (profile: Profile, role: Role) => Promise<boolean>;
|
|
9
13
|
export declare const unassignRole: (profile: Profile, role: Role) => Promise<boolean>;
|
|
@@ -4,13 +4,19 @@ import { followConnector, followDisconnector, giveControl, roleAssigner, roleUna
|
|
|
4
4
|
import { hub } from '../events/index.js';
|
|
5
5
|
import { randomString } from '@openpeepshq/common/lib';
|
|
6
6
|
import { deleteAccessTokensForProfile } from '../accessTokens/helpers.js';
|
|
7
|
-
import { profilesCache, getProfile, clearProfileCache } from './cache.js';
|
|
7
|
+
import { profilesCache, getProfile, getPublicProfile, clearProfileCache, } from './cache.js';
|
|
8
8
|
import { accountsCache } from '../accounts/cache.js';
|
|
9
9
|
import { assertProfileCapacity } from './capacity.js';
|
|
10
|
+
import { deleteBlock, dropFollowsBetween, insertBlock, listBlockingIds, } from './blocks.js';
|
|
11
|
+
import { localActorScalars } from '../federation/identity.js';
|
|
12
|
+
import { uuidv7 } from 'uuidv7';
|
|
10
13
|
export const createProfile = async (data, controllingAccount) => {
|
|
11
14
|
await assertProfileCapacity();
|
|
12
15
|
const db = await allpeepDb().then((db) => db.db);
|
|
13
|
-
const
|
|
16
|
+
const id = uuidv7();
|
|
17
|
+
const domain = data.activityPub?.domain;
|
|
18
|
+
const actor = data.type === 'local' && domain ? localActorScalars(id, domain) : {};
|
|
19
|
+
const profile = await profilesMapping.create(db, { ...data, id, ...actor });
|
|
14
20
|
if (controllingAccount) {
|
|
15
21
|
await giveControl(db, controllingAccount, profile);
|
|
16
22
|
await accountsCache.del(controllingAccount.id);
|
|
@@ -37,12 +43,16 @@ export const updateProfile = async (profileId, data) => {
|
|
|
37
43
|
}
|
|
38
44
|
return profilesMapping.update(db, profileId, data);
|
|
39
45
|
};
|
|
46
|
+
export const pinPostOnProfile = async (profile, pinnedPostId) => {
|
|
47
|
+
const updated = await updateProfile(profile.id, { pinnedPostId });
|
|
48
|
+
await clearProfileCache(profile);
|
|
49
|
+
return updated;
|
|
50
|
+
};
|
|
40
51
|
export const deleteProfile = async (profileId) => {
|
|
41
|
-
var _a, _b;
|
|
42
52
|
const db = await allpeepDb().then((db) => db.db);
|
|
43
53
|
const profileToDelete = await getProfile(profileId);
|
|
44
54
|
if (profileToDelete) {
|
|
45
|
-
await Promise.all(
|
|
55
|
+
await Promise.all(profileToDelete.controllers?.map((account) => accountsCache.del(account.id)) ?? []);
|
|
46
56
|
if (profileToDelete.following && profileToDelete.following.length > 0) {
|
|
47
57
|
await Promise.all(profileToDelete.following.map((followed) => profilesCache.del(followed.id)));
|
|
48
58
|
}
|
|
@@ -65,6 +75,23 @@ export const unfollow = async (follower, followed) => {
|
|
|
65
75
|
await followDisconnector(db, follower, followed);
|
|
66
76
|
await Promise.all([clearProfileCache(follower), clearProfileCache(followed)]);
|
|
67
77
|
};
|
|
78
|
+
export const blockProfile = async (blocker, blocked) => {
|
|
79
|
+
const { db } = await allpeepDb();
|
|
80
|
+
await insertBlock(db, blocker.id, blocked.id);
|
|
81
|
+
await dropFollowsBetween(db, blocker.id, blocked.id);
|
|
82
|
+
await Promise.all([clearProfileCache(blocker), clearProfileCache(blocked)]);
|
|
83
|
+
};
|
|
84
|
+
export const unblockProfile = async (blocker, blocked) => {
|
|
85
|
+
const { db } = await allpeepDb();
|
|
86
|
+
await deleteBlock(db, blocker.id, blocked.id);
|
|
87
|
+
await Promise.all([clearProfileCache(blocker), clearProfileCache(blocked)]);
|
|
88
|
+
};
|
|
89
|
+
export const listBlockedProfiles = async (profile) => {
|
|
90
|
+
const { db } = await allpeepDb();
|
|
91
|
+
const ids = await listBlockingIds(db, profile.id);
|
|
92
|
+
const profiles = await Promise.all(ids.map((id) => getPublicProfile(id)));
|
|
93
|
+
return profiles.filter((item) => !!item);
|
|
94
|
+
};
|
|
68
95
|
export const assignRole = (profile, role) => allpeepDb()
|
|
69
96
|
.then(({ db }) => roleAssigner(db, profile, role))
|
|
70
97
|
.then(() => profilesCache.del(profile.id));
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { RedisClientType } from 'redis';
|
|
2
2
|
export declare const getConnection: () => Promise<RedisClientType>;
|
|
3
3
|
export declare const disconnect: (conn: RedisClientType) => Promise<void>;
|
|
4
|
+
/** CLI exit: hub.on / getSharedConnection leave node-redis sockets open. */
|
|
5
|
+
export declare const closeRedisConnections: () => Promise<void>;
|
|
4
6
|
export declare const getSharedConnection: () => Promise<RedisClientType>;
|
package/dist/redis/connection.js
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
import { createClient } from 'redis';
|
|
2
2
|
import { defaultConfig } from '../config/defaults/core.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const clients = new Set();
|
|
4
|
+
export const getConnection = () => {
|
|
5
|
+
const client = createClient({
|
|
6
|
+
url: `redis://${defaultConfig.redis.host}:6379`,
|
|
7
|
+
});
|
|
8
|
+
client.on('error', console.log);
|
|
9
|
+
clients.add(client);
|
|
10
|
+
return client.connect();
|
|
11
|
+
};
|
|
8
12
|
export const disconnect = async (conn) => {
|
|
9
|
-
|
|
13
|
+
if (conn.isOpen) {
|
|
14
|
+
await conn.disconnect().catch(console.error);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
/** CLI exit: hub.on / getSharedConnection leave node-redis sockets open. */
|
|
18
|
+
export const closeRedisConnections = async () => {
|
|
19
|
+
connection = undefined;
|
|
20
|
+
await Promise.all([...clients].map(async (conn) => {
|
|
21
|
+
try {
|
|
22
|
+
await conn.disconnect();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// already closed
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
clients.clear();
|
|
10
29
|
};
|
|
11
30
|
let connection;
|
|
12
31
|
export const getSharedConnection = async () => {
|
package/dist/reports/helpers.js
CHANGED
|
@@ -3,9 +3,13 @@ import { collectionInfos } from '../db/index.js';
|
|
|
3
3
|
import { tombstoneProfileWithMetaIfDeleted } from '@openpeepshq/common/lib';
|
|
4
4
|
import { transformPost } from '../posts/index.js';
|
|
5
5
|
export const transformReport = async (report) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const rawPosts = (report.reportedPosts ?? []);
|
|
7
|
+
return {
|
|
8
|
+
...report,
|
|
9
|
+
reporterProfile: tombstoneProfileWithMetaIfDeleted(report.reporterProfile),
|
|
10
|
+
reportedProfile: tombstoneProfileWithMetaIfDeleted(report.reportedProfile),
|
|
11
|
+
reportedPosts: await Promise.all(rawPosts.map((post) => transformPost(post))),
|
|
12
|
+
};
|
|
9
13
|
};
|
|
10
14
|
export const transformReports = async (reports) => Promise.all(reports.map(transformReport));
|
|
11
15
|
export const createdReportConnector = connector(collectionInfos.profilesCollection, collectionInfos.reportsCollection, collectionInfos.createdReportCollection);
|
package/dist/roles/index.d.ts
CHANGED
package/dist/roles/index.js
CHANGED
package/dist/roles/mapping.d.ts
CHANGED
package/dist/roles/mutations.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { currentRoleDefaults, defaultRoles, findRoleDefaultsVersion, } from '@openpeepshq/common/types';
|
|
2
|
+
import { capabilitySetsEqual } from '@openpeepshq/common/lib';
|
|
3
|
+
import { findRole, findRoleByKey } from './finders.js';
|
|
3
4
|
import { allpeepDb } from '../db/index.js';
|
|
4
5
|
import { conflict } from '../errors/index.js';
|
|
5
6
|
import { rolesMapping } from './mapping.js';
|
|
@@ -14,8 +15,72 @@ export const createRole = (roleData) => allpeepDb().then(async ({ db }) => {
|
|
|
14
15
|
}
|
|
15
16
|
return rolesMapping.create(db, roleData);
|
|
16
17
|
});
|
|
18
|
+
const capabilitiesMatchFactory = (capabilities, factoryRole) => capabilitySetsEqual(capabilities?.add, factoryRole.capabilities?.add) &&
|
|
19
|
+
capabilitySetsEqual(capabilities?.remove, factoryRole.capabilities?.remove);
|
|
20
|
+
/**
|
|
21
|
+
* Effective default flag for a write: an explicit `true` wins, and
|
|
22
|
+
* capabilities that exactly match the system defaults re-adopt the role as a
|
|
23
|
+
* default role even when the stored flag says otherwise — so future system
|
|
24
|
+
* default updates flow into it. Such an adoption also re-anchors the role to
|
|
25
|
+
* the current defaults version when the write does not set one explicitly.
|
|
26
|
+
*/
|
|
27
|
+
const withDefaultAdoption = (existingRole, roleData) => {
|
|
28
|
+
const factoryRole = defaultRoles.find((role) => role.key === (roleData.key ?? existingRole?.key));
|
|
29
|
+
if (!factoryRole)
|
|
30
|
+
return roleData;
|
|
31
|
+
const matchesFactory = capabilitiesMatchFactory(roleData.capabilities ?? existingRole?.capabilities, factoryRole);
|
|
32
|
+
const isDefault = roleData.default === true || matchesFactory;
|
|
33
|
+
return {
|
|
34
|
+
...roleData,
|
|
35
|
+
default: isDefault,
|
|
36
|
+
...(matchesFactory && roleData.baseVersion === undefined
|
|
37
|
+
? { baseVersion: currentRoleDefaults.version }
|
|
38
|
+
: {}),
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Applies the base→current delta of the system defaults to a capability
|
|
43
|
+
* list: capabilities the defaults gained are added, capabilities the
|
|
44
|
+
* defaults dropped are removed, everything else is kept.
|
|
45
|
+
*/
|
|
46
|
+
const applyCapabilityDelta = (capabilities, base, current) => {
|
|
47
|
+
const delta = (list, from, to) => {
|
|
48
|
+
const removed = (from ?? []).filter((c) => !(to ?? []).includes(c));
|
|
49
|
+
const added = (to ?? []).filter((c) => !(from ?? []).includes(c));
|
|
50
|
+
return [
|
|
51
|
+
...(list ?? []).filter((c) => !removed.includes(c)),
|
|
52
|
+
...added.filter((c) => !(list ?? []).includes(c)),
|
|
53
|
+
];
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
add: delta(capabilities?.add, base?.add, current?.add),
|
|
57
|
+
remove: delta(capabilities?.remove, base?.remove, current?.remove),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Rebase patch for a customized built-in role anchored at an older defaults
|
|
62
|
+
* version, or null when nothing changed. The set delta is transitive, so a
|
|
63
|
+
* stale anchor still rebases correctly when intermediate versions left this
|
|
64
|
+
* role untouched — the anchor only moves when capabilities actually change.
|
|
65
|
+
*/
|
|
66
|
+
const rebaseRoleToCurrentDefaults = (existingRole, factoryRole) => {
|
|
67
|
+
const baseVersion = existingRole.baseVersion;
|
|
68
|
+
if (!baseVersion || baseVersion === currentRoleDefaults.version) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const baseRole = findRoleDefaultsVersion(baseVersion)?.roles.find((role) => role.key === factoryRole.key);
|
|
72
|
+
if (!baseRole)
|
|
73
|
+
return null;
|
|
74
|
+
const capabilities = applyCapabilityDelta(existingRole.capabilities, baseRole.capabilities, factoryRole.capabilities);
|
|
75
|
+
const unchanged = capabilitySetsEqual(existingRole.capabilities?.add, capabilities.add) &&
|
|
76
|
+
capabilitySetsEqual(existingRole.capabilities?.remove, capabilities.remove);
|
|
77
|
+
if (unchanged)
|
|
78
|
+
return null;
|
|
79
|
+
return { capabilities, baseVersion: currentRoleDefaults.version };
|
|
80
|
+
};
|
|
17
81
|
export const updateRole = (id, roleData) => allpeepDb().then(async ({ db }) => {
|
|
18
|
-
const
|
|
82
|
+
const existingRole = await findRole(id);
|
|
83
|
+
const role = await rolesMapping.update(db, id, withDefaultAdoption(existingRole, roleData));
|
|
19
84
|
await profilesCache.clear();
|
|
20
85
|
return role;
|
|
21
86
|
});
|
|
@@ -25,8 +90,25 @@ export const setDefaultRoles = async () => {
|
|
|
25
90
|
if (!existingRole) {
|
|
26
91
|
await createRole(role);
|
|
27
92
|
}
|
|
93
|
+
else if (capabilitiesMatchFactory(existingRole.capabilities, role)) {
|
|
94
|
+
if (!existingRole.default) {
|
|
95
|
+
// Re-adopt roles that are exactly at the system defaults: only the
|
|
96
|
+
// flag and baseVersion are written, so the name and description are
|
|
97
|
+
// preserved.
|
|
98
|
+
await updateRole(existingRole.id, { default: true });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
28
101
|
else if (existingRole.default) {
|
|
102
|
+
// Default-flagged roles are system-managed: keep them in sync with the
|
|
103
|
+
// current factory so newly introduced capabilities reach them.
|
|
29
104
|
await updateRole(existingRole.id, role);
|
|
30
105
|
}
|
|
106
|
+
else {
|
|
107
|
+
// Customized built-in roles keep their edits; only merge in what the
|
|
108
|
+
// system defaults gained since their baseVersion.
|
|
109
|
+
const rebased = rebaseRoleToCurrentDefaults(existingRole, role);
|
|
110
|
+
if (rebased)
|
|
111
|
+
await updateRole(existingRole.id, rebased);
|
|
112
|
+
}
|
|
31
113
|
}
|
|
32
114
|
};
|
package/dist/search/finders.js
CHANGED
|
@@ -36,15 +36,27 @@ export const searchPosts = async (query, authData, limitOffset = { offset: 0, li
|
|
|
36
36
|
const profile = requireProfile(authData);
|
|
37
37
|
const { db } = await allpeepDb();
|
|
38
38
|
const mapping = postSearchMapping(profile, query);
|
|
39
|
-
return filterAndTransform(mapping, db,
|
|
39
|
+
return filterAndTransform(mapping, db, {
|
|
40
|
+
transform: transformPostWithScore(profile),
|
|
41
|
+
filter: await canReadPostFilter(authData),
|
|
42
|
+
...limitOffset,
|
|
43
|
+
});
|
|
40
44
|
});
|
|
41
45
|
export const searchEvents = async (query, authData, limitOffset = { offset: 0, limit: 15 }) => {
|
|
42
46
|
const profile = requireProfile(authData);
|
|
43
|
-
return filterAndTransform(eventSearchMapping(profile, query), (await allpeepDb()).db,
|
|
47
|
+
return filterAndTransform(eventSearchMapping(profile, query), (await allpeepDb()).db, {
|
|
48
|
+
transform: transformPostWithScore(profile),
|
|
49
|
+
filter: await canReadPostFilter(authData),
|
|
50
|
+
...limitOffset,
|
|
51
|
+
});
|
|
44
52
|
};
|
|
45
53
|
export const searchJams = async (query, authData, limitOffset = { offset: 0, limit: 15 }) => {
|
|
46
54
|
const profile = requireProfile(authData);
|
|
47
|
-
return filterAndTransform(jamSearchMapping(profile, query), (await allpeepDb()).db,
|
|
55
|
+
return filterAndTransform(jamSearchMapping(profile, query), (await allpeepDb()).db, {
|
|
56
|
+
transform: transformPostWithScore(profile),
|
|
57
|
+
filter: await canReadPostFilter(authData),
|
|
58
|
+
...limitOffset,
|
|
59
|
+
});
|
|
48
60
|
};
|
|
49
61
|
export const searchResultCounts = async (query, authData) => {
|
|
50
62
|
const profile = requireProfile(authData);
|
package/dist/search/helpers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const queryParamsToLimit = (query) =>
|
|
1
|
+
export const queryParamsToLimit = (query) => query?.offset ? [query.offset, query?.limit ?? 15] : (query?.limit ?? 15);
|
package/dist/search/mapping.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const groupSearchMapping: (profile: ProfileWithMeta, query: strin
|
|
|
22
22
|
};
|
|
23
23
|
score: number;
|
|
24
24
|
}>;
|
|
25
|
-
export declare const profileSearchMapping: (
|
|
25
|
+
export declare const profileSearchMapping: (profile: ProfileWithMeta, query: string) => import("../db/pg/map").PgQueryResult<{
|
|
26
26
|
data: ProfileWithMeta;
|
|
27
27
|
score: number;
|
|
28
28
|
}>;
|
package/dist/search/mapping.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { blockedPairIds } from '@openpeepshq/common/lib';
|
|
1
2
|
import { groupsMapping } from '../groups/index.js';
|
|
2
3
|
import { canSeeGroupFilter } from '../groups/helpers.js';
|
|
3
4
|
import { publicProfilesSearchMapping } from '../profiles/mapping.js';
|
|
4
5
|
import { baseListPosts } from '../posts/finders.js';
|
|
5
|
-
import { postFilters } from '../db/pg/filters/index.js';
|
|
6
|
+
import { postFilters, profileFilters } from '../db/pg/filters/index.js';
|
|
6
7
|
export const groupSearchMapping = (profile, query) => groupsMapping.filter(canSeeGroupFilter(profile)).fulltextSearch({
|
|
7
8
|
view: 'groupSearch',
|
|
8
9
|
analyzer: 'text_en',
|
|
9
10
|
fields: ['handle', 'displayName', 'description', 'rules'],
|
|
10
11
|
query,
|
|
11
12
|
});
|
|
12
|
-
export const profileSearchMapping = (
|
|
13
|
+
export const profileSearchMapping = (profile, query) => publicProfilesSearchMapping
|
|
14
|
+
.filter(profileFilters.notGuest())
|
|
15
|
+
.filter(profileFilters.notIdIn(blockedPairIds(profile)))
|
|
16
|
+
.fulltextSearch({
|
|
13
17
|
view: 'profileSearch',
|
|
14
18
|
analyzer: 'text_en',
|
|
15
19
|
fields: ['handle', 'displayName', 'bio', 'location.text', 'fields.value'],
|
package/dist/sentry/index.js
CHANGED
|
@@ -10,7 +10,6 @@ export const SERVICE_TAG = 'service';
|
|
|
10
10
|
* Strip scheme/port from `server.host` / `SERVER_HOST` for Sentry tags.
|
|
11
11
|
*/
|
|
12
12
|
export const normalizeServerHostname = (host) => {
|
|
13
|
-
var _a;
|
|
14
13
|
const trimmed = host.trim();
|
|
15
14
|
if (!trimmed)
|
|
16
15
|
return 'unknown';
|
|
@@ -18,8 +17,8 @@ export const normalizeServerHostname = (host) => {
|
|
|
18
17
|
const serverUrl = trimmed.includes('://') ? trimmed : `http://${trimmed}`;
|
|
19
18
|
return new URL(serverUrl).hostname || 'unknown';
|
|
20
19
|
}
|
|
21
|
-
catch
|
|
22
|
-
return
|
|
20
|
+
catch {
|
|
21
|
+
return trimmed.split('/')[0]?.split(':')[0] || 'unknown';
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
24
|
export const getCommunityHostname = () => communityHostname;
|
|
@@ -30,14 +29,13 @@ export const getSentryService = () => serviceName;
|
|
|
30
29
|
* — never fall back to `NODE_ENV` (Docker images always set that to production).
|
|
31
30
|
*/
|
|
32
31
|
export const resolveSentryEnvironment = (explicit) => {
|
|
33
|
-
|
|
34
|
-
const fromExplicit = explicit === null || explicit === void 0 ? void 0 : explicit.trim();
|
|
32
|
+
const fromExplicit = explicit?.trim();
|
|
35
33
|
if (fromExplicit)
|
|
36
34
|
return fromExplicit;
|
|
37
|
-
const fromSentryEnv =
|
|
35
|
+
const fromSentryEnv = process.env.SENTRY_ENVIRONMENT?.trim();
|
|
38
36
|
if (fromSentryEnv)
|
|
39
37
|
return fromSentryEnv;
|
|
40
|
-
const fromEnvironment =
|
|
38
|
+
const fromEnvironment = process.env.ENVIRONMENT?.trim();
|
|
41
39
|
if (fromEnvironment)
|
|
42
40
|
return fromEnvironment;
|
|
43
41
|
return 'local';
|
|
@@ -56,7 +54,6 @@ export const applyCommunitySentryTags = () => {
|
|
|
56
54
|
* Always records hostname/service for local diagnostics even when Sentry is off.
|
|
57
55
|
*/
|
|
58
56
|
export const initSentry = (options = {}) => {
|
|
59
|
-
var _a, _b, _c, _d;
|
|
60
57
|
if (options.hostname !== undefined) {
|
|
61
58
|
communityHostname = normalizeServerHostname(options.hostname);
|
|
62
59
|
}
|
|
@@ -76,8 +73,8 @@ export const initSentry = (options = {}) => {
|
|
|
76
73
|
}
|
|
77
74
|
return;
|
|
78
75
|
}
|
|
79
|
-
const dsn =
|
|
80
|
-
const enabled =
|
|
76
|
+
const dsn = options.dsn ?? process.env.SENTRY_DSN;
|
|
77
|
+
const enabled = options.enabled ?? (Boolean(dsn) && process.env.SENTRY_ENABLED !== '0');
|
|
81
78
|
if (!enabled || !dsn) {
|
|
82
79
|
log.info({
|
|
83
80
|
communityHostname,
|
|
@@ -86,7 +83,8 @@ export const initSentry = (options = {}) => {
|
|
|
86
83
|
initialized = true;
|
|
87
84
|
return;
|
|
88
85
|
}
|
|
89
|
-
const tracesSampleRate =
|
|
86
|
+
const tracesSampleRate = options.tracesSampleRate ??
|
|
87
|
+
Number(process.env.SENTRY_TRACES_SAMPLE_RATE ?? '0.1');
|
|
90
88
|
const environment = resolveSentryEnvironment(options.environment);
|
|
91
89
|
Sentry.init({
|
|
92
90
|
dsn,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** A sitemap row: app-relative path plus modification time, when known. */
|
|
2
|
+
export type CrawlableEntry = {
|
|
3
|
+
path: string;
|
|
4
|
+
updatedAt?: string | null;
|
|
5
|
+
};
|
|
6
|
+
/** What a content page should be titled and summarised as, for crawlers. */
|
|
7
|
+
export type CrawlableMeta = {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
/** Post routes only: the extra facts DiscussionForumPosting needs. */
|
|
11
|
+
kind?: 'post';
|
|
12
|
+
datePublished?: string;
|
|
13
|
+
dateModified?: string;
|
|
14
|
+
authorName?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Metadata plus whether the route could render at all, so the server can answer
|
|
18
|
+
* 404 for a content path that will never show anything to a crawler instead of
|
|
19
|
+
* a 200 community shell.
|
|
20
|
+
*/
|
|
21
|
+
export type SpaMeta = {
|
|
22
|
+
meta: CrawlableMeta | null;
|
|
23
|
+
notFound: boolean;
|
|
24
|
+
};
|
|
25
|
+
export { seoRoute, type SeoRoute, type SeoRouteKind } from './route';
|
|
26
|
+
/** Publicly readable pages, newest first. Events are posts and have no route of
|
|
27
|
+
* their own, so they are covered by the post paths.
|
|
28
|
+
*
|
|
29
|
+
* Profiles are opt-in: a crawled profile page is cached by search engines long
|
|
30
|
+
* after the member leaves. `listProfiles` applies no privacy filter — it is the
|
|
31
|
+
* same list `/members` shows — so enabling this exposes exactly the profiles an
|
|
32
|
+
* anonymous visitor can already browse.
|
|
33
|
+
*/
|
|
34
|
+
export declare const crawlableEntries: ({ indexProfiles, }: {
|
|
35
|
+
indexProfiles: boolean;
|
|
36
|
+
}) => Promise<CrawlableEntry[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Metadata for a content route, plus whether it can render at all, so a shared
|
|
39
|
+
* post is not described to every crawler as the community homepage and an
|
|
40
|
+
* unknown id is not served as a 200. Negatives are cached as well: a bot
|
|
41
|
+
* probing unknown ids should not turn each request into a query. Profile
|
|
42
|
+
* metadata additionally requires the `indexProfiles` flag.
|
|
43
|
+
*/
|
|
44
|
+
export declare const spaMetaForPath: (pathname: string, { indexProfiles }: {
|
|
45
|
+
indexProfiles: boolean;
|
|
46
|
+
}) => Promise<SpaMeta>;
|
|
47
|
+
/** Convenience wrapper for callers that only need the metadata itself. */
|
|
48
|
+
export declare const metaForPath: (pathname: string, options: {
|
|
49
|
+
indexProfiles: boolean;
|
|
50
|
+
}) => Promise<CrawlableMeta | null>;
|