@openpeepshq/core 0.9.0 → 0.11.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/calendarFeedTokens/index.d.ts +9 -0
- package/dist/calendarFeedTokens/index.js +55 -0
- package/dist/db/pg/filters/profiles.d.ts +1 -0
- package/dist/db/pg/filters/profiles.js +7 -1
- package/dist/db/pg/schema/calendarFeedTokens.d.ts +128 -0
- package/dist/db/pg/schema/calendarFeedTokens.js +15 -0
- package/dist/db/pg/schema/index.d.ts +129 -0
- package/dist/db/pg/schema/index.js +3 -0
- package/dist/db/pg/sql/0018_add_calendar_feed_tokens.sql +12 -0
- package/dist/db/pg/sql/meta/0018_snapshot.json +4663 -0
- package/dist/db/pg/sql/meta/_journal.json +7 -0
- package/dist/profiles/finders.d.ts +3 -1
- package/dist/profiles/finders.js +11 -2
- package/dist/profiles/mutations.js +5 -0
- package/dist/sentry/index.d.ts +39 -0
- package/dist/sentry/index.js +38 -0
- package/dist/seo/index.d.ts +4 -3
- package/dist/seo/index.js +7 -4
- package/package.json +5 -5
|
@@ -127,6 +127,13 @@
|
|
|
127
127
|
"when": 1794031928690,
|
|
128
128
|
"tag": "0017_unique_has_role_edges",
|
|
129
129
|
"breakpoints": true
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"idx": 18,
|
|
133
|
+
"version": "7",
|
|
134
|
+
"when": 1795038881063,
|
|
135
|
+
"tag": "0018_add_calendar_feed_tokens",
|
|
136
|
+
"breakpoints": true
|
|
130
137
|
}
|
|
131
138
|
]
|
|
132
139
|
}
|
|
@@ -3,7 +3,9 @@ export declare const findProfile: (profileId: string) => Promise<ProfileWithMeta
|
|
|
3
3
|
export declare const findProfileByHandle: (handle: string) => Promise<ProfileWithMeta | undefined>;
|
|
4
4
|
export { findProfileByHandleAndDomain, findProfileByUri, } from '../federation/profiles';
|
|
5
5
|
export declare const existsProfileByHandle: (handle: string) => Promise<boolean>;
|
|
6
|
-
export declare const listProfiles: (viewer?: ProfileWithMeta
|
|
6
|
+
export declare const listProfiles: (viewer?: ProfileWithMeta, options?: {
|
|
7
|
+
directoryView?: boolean;
|
|
8
|
+
}) => Promise<ProfileWithMeta[]>;
|
|
7
9
|
export declare const listProfilesByRole: (role: Role) => Promise<ProfileWithMeta[]>;
|
|
8
10
|
export declare const listProfilesByAccount: (account: Account) => Promise<ProfileWithMeta[]>;
|
|
9
11
|
export declare const listProfilesWithCapabilities: (capabilities: string[]) => Promise<ProfileWithMeta[]>;
|
package/dist/profiles/finders.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { accountProfileRelation, baseProfilesMapping, membersRelation, profileRoleRelation, } from './mapping.js';
|
|
2
2
|
import { allpeepDb } from '../db/index.js';
|
|
3
3
|
import { profileFilters } from '../db/pg/filters/index.js';
|
|
4
|
-
import { blockedPairIds, getUniqueBy } from '@openpeepshq/common/lib';
|
|
4
|
+
import { blockedPairIds, checkRoleCapabilities, getUniqueBy, } from '@openpeepshq/common/lib';
|
|
5
5
|
import { rolesMapping } from '../roles/mapping.js';
|
|
6
6
|
import { findRolesByCapabilities } from '../roles/finders.js';
|
|
7
7
|
import { expandProfiles, followFinder } from './helpers.js';
|
|
@@ -13,10 +13,19 @@ export const findProfile = (profileId) => getProfile(profileId);
|
|
|
13
13
|
export const findProfileByHandle = (handle) => getProfileByHandle(handle);
|
|
14
14
|
export { findProfileByHandleAndDomain, findProfileByUri, } from '../federation/profiles.js';
|
|
15
15
|
export const existsProfileByHandle = (handle) => getProfileByHandle(handle, true).then(Boolean);
|
|
16
|
-
|
|
16
|
+
// Mirrors canSeeGroupFilter: member-directory viewers without
|
|
17
|
+
// core-profiles-read — including anonymous public-community visitors — only
|
|
18
|
+
// see profiles that have not opted out of the directory. It ands the same
|
|
19
|
+
// `profileFilters.discoverable()` SQL predicate defined in
|
|
20
|
+
// db/pg/filters/profiles.ts, so readers can jump straight to the predicate.
|
|
21
|
+
const directoryFilter = (viewer) => checkRoleCapabilities(viewer?.roles ?? [], ['core-profiles-read']).success
|
|
22
|
+
? undefined
|
|
23
|
+
: profileFilters.discoverable();
|
|
24
|
+
export const listProfiles = (viewer, options = {}) => allpeepDb()
|
|
17
25
|
.then(({ db }) => baseProfilesMapping
|
|
18
26
|
.filter(profileFilters.notGuest())
|
|
19
27
|
.filter(profileFilters.notIdIn(blockedPairIds(viewer)))
|
|
28
|
+
.filter(options.directoryView ? directoryFilter(viewer) : undefined)
|
|
20
29
|
.all(db))
|
|
21
30
|
.then(expandProfiles);
|
|
22
31
|
export const listProfilesByRole = (role) => allpeepDb()
|
|
@@ -7,6 +7,7 @@ import { capabilitiesConfig } from '../config/index.js';
|
|
|
7
7
|
import { deleteAccessTokensForProfile } from '../accessTokens/helpers.js';
|
|
8
8
|
import { profilesCache, getProfile, getPublicProfile, getLocalProfileByHandle, clearProfileCache, } from './cache.js';
|
|
9
9
|
import { logger } from '../log/index.js';
|
|
10
|
+
import { revokeAllCalendarFeedTokens } from '../calendarFeedTokens/index.js';
|
|
10
11
|
import { accountsCache } from '../accounts/cache.js';
|
|
11
12
|
import { assertProfileCapacity } from './capacity.js';
|
|
12
13
|
import { deleteBlock, dropFollowsBetween, insertBlock, listBlockingIds, } from './blocks.js';
|
|
@@ -64,6 +65,10 @@ export const deleteProfile = async (profileId) => {
|
|
|
64
65
|
}
|
|
65
66
|
await profilesCache.del(profileId);
|
|
66
67
|
await deleteAccessTokensForProfile(db, profileId);
|
|
68
|
+
// ICS feed tokens are keyed by profileId without an FK, so profile
|
|
69
|
+
// deletion cannot cascade them — revoke explicitly, mirroring the
|
|
70
|
+
// access-token cleanup above.
|
|
71
|
+
await revokeAllCalendarFeedTokens(profileId);
|
|
67
72
|
return profilesMapping.delete(db, profileId);
|
|
68
73
|
};
|
|
69
74
|
export const follow = async (follower, followed, followData) => {
|
package/dist/sentry/index.d.ts
CHANGED
|
@@ -24,6 +24,45 @@ export declare const getSentryService: () => SentryService | undefined;
|
|
|
24
24
|
* — never fall back to `NODE_ENV` (Docker images always set that to production).
|
|
25
25
|
*/
|
|
26
26
|
export declare const resolveSentryEnvironment: (explicit?: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Integration names of `@sentry/node@10.x`'s vendored DB instrumentations
|
|
29
|
+
* (the SDK vendors its own copies; 9.x's standalone
|
|
30
|
+
* `@opentelemetry/instrumentation-*` packages left the tree). They emit the
|
|
31
|
+
* `db.user` span attribute unconditionally — GHSA-qqmp-wf37-98f9's behavior,
|
|
32
|
+
* invisible to `pnpm audit` because the copies live inside the audited-clean
|
|
33
|
+
* package. The only one that can ever match a module in this repo is
|
|
34
|
+
* Postgres (drizzle/pg); the rest are inert here, but they are dropped
|
|
35
|
+
* together so this list stays the complete set of vendored `db.user`
|
|
36
|
+
* emitters.
|
|
37
|
+
*
|
|
38
|
+
* Trade-off (documented decision): the filter matches on the integration
|
|
39
|
+
* `name`, and the SDK's `filterDuplicates` resolves duplicate integrations by
|
|
40
|
+
* name too. A future *user-supplied* integration that happens to be named
|
|
41
|
+
* exactly `Postgres`/`Mysql`/`Mysql2`/`Tedious`/`Knex` would therefore also
|
|
42
|
+
* be dropped from the final set. That is accepted: the five names are the
|
|
43
|
+
* SDK's own vendored names, so a user integration carrying one would collide
|
|
44
|
+
* with the vendored copy anyway, and dropping both is the safe outcome.
|
|
45
|
+
*
|
|
46
|
+
* Layout provenance: this list is pinned by the canary in
|
|
47
|
+
* `sentry.test.ts`, which resolves the vendored-instrumentation path from the
|
|
48
|
+
* installed `@sentry/node` package — that resolved path, not any directory
|
|
49
|
+
* names quoted in comments, is the source of truth for the layout.
|
|
50
|
+
*/
|
|
51
|
+
export declare const VENDORED_DB_INTEGRATION_NAMES: readonly ["Postgres", "Mysql", "Mysql2", "Tedious", "Knex"];
|
|
52
|
+
/**
|
|
53
|
+
* The callable shape `initSentry` passes to `Sentry.init`'s `integrations`
|
|
54
|
+
* option: a function that maps the SDK's own auto-detected default list to a
|
|
55
|
+
* filtered subset. The function form is load-bearing — a callable *replaces*
|
|
56
|
+
* the default set entirely, whereas the array form *keeps* the defaults and
|
|
57
|
+
* overlays by name (which would re-admit the five DB integrations).
|
|
58
|
+
*/
|
|
59
|
+
export type SentryDefaultIntegrations = (integrations: ReturnType<typeof Sentry.getAutoPerformanceIntegrations>) => ReturnType<typeof Sentry.getAutoPerformanceIntegrations>;
|
|
60
|
+
/**
|
|
61
|
+
* Removes the vendored DB integrations (see
|
|
62
|
+
* `VENDORED_DB_INTEGRATION_NAMES`) from the SDK default set so no `db.user`
|
|
63
|
+
* attribute is emitted. Wired into `Sentry.init` below as the callable form.
|
|
64
|
+
*/
|
|
65
|
+
export declare const withoutVendoredDbIntegrations: SentryDefaultIntegrations;
|
|
27
66
|
/** Re-apply community tags on the current isolation scope (per-request). */
|
|
28
67
|
export declare const applyCommunitySentryTags: () => void;
|
|
29
68
|
/**
|
package/dist/sentry/index.js
CHANGED
|
@@ -40,6 +40,43 @@ export const resolveSentryEnvironment = (explicit) => {
|
|
|
40
40
|
return fromEnvironment;
|
|
41
41
|
return 'local';
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Integration names of `@sentry/node@10.x`'s vendored DB instrumentations
|
|
45
|
+
* (the SDK vendors its own copies; 9.x's standalone
|
|
46
|
+
* `@opentelemetry/instrumentation-*` packages left the tree). They emit the
|
|
47
|
+
* `db.user` span attribute unconditionally — GHSA-qqmp-wf37-98f9's behavior,
|
|
48
|
+
* invisible to `pnpm audit` because the copies live inside the audited-clean
|
|
49
|
+
* package. The only one that can ever match a module in this repo is
|
|
50
|
+
* Postgres (drizzle/pg); the rest are inert here, but they are dropped
|
|
51
|
+
* together so this list stays the complete set of vendored `db.user`
|
|
52
|
+
* emitters.
|
|
53
|
+
*
|
|
54
|
+
* Trade-off (documented decision): the filter matches on the integration
|
|
55
|
+
* `name`, and the SDK's `filterDuplicates` resolves duplicate integrations by
|
|
56
|
+
* name too. A future *user-supplied* integration that happens to be named
|
|
57
|
+
* exactly `Postgres`/`Mysql`/`Mysql2`/`Tedious`/`Knex` would therefore also
|
|
58
|
+
* be dropped from the final set. That is accepted: the five names are the
|
|
59
|
+
* SDK's own vendored names, so a user integration carrying one would collide
|
|
60
|
+
* with the vendored copy anyway, and dropping both is the safe outcome.
|
|
61
|
+
*
|
|
62
|
+
* Layout provenance: this list is pinned by the canary in
|
|
63
|
+
* `sentry.test.ts`, which resolves the vendored-instrumentation path from the
|
|
64
|
+
* installed `@sentry/node` package — that resolved path, not any directory
|
|
65
|
+
* names quoted in comments, is the source of truth for the layout.
|
|
66
|
+
*/
|
|
67
|
+
export const VENDORED_DB_INTEGRATION_NAMES = [
|
|
68
|
+
'Postgres',
|
|
69
|
+
'Mysql',
|
|
70
|
+
'Mysql2',
|
|
71
|
+
'Tedious',
|
|
72
|
+
'Knex',
|
|
73
|
+
];
|
|
74
|
+
/**
|
|
75
|
+
* Removes the vendored DB integrations (see
|
|
76
|
+
* `VENDORED_DB_INTEGRATION_NAMES`) from the SDK default set so no `db.user`
|
|
77
|
+
* attribute is emitted. Wired into `Sentry.init` below as the callable form.
|
|
78
|
+
*/
|
|
79
|
+
export const withoutVendoredDbIntegrations = (integrations) => integrations.filter((i) => !VENDORED_DB_INTEGRATION_NAMES.some((n) => i.name === n));
|
|
43
80
|
/** Re-apply community tags on the current isolation scope (per-request). */
|
|
44
81
|
export const applyCommunitySentryTags = () => {
|
|
45
82
|
if (communityHostname) {
|
|
@@ -92,6 +129,7 @@ export const initSentry = (options = {}) => {
|
|
|
92
129
|
tracesSampleRate: Number.isFinite(tracesSampleRate)
|
|
93
130
|
? tracesSampleRate
|
|
94
131
|
: 0.1,
|
|
132
|
+
integrations: withoutVendoredDbIntegrations,
|
|
95
133
|
});
|
|
96
134
|
if (communityHostname) {
|
|
97
135
|
Sentry.setTag(COMMUNITY_HOSTNAME_TAG, communityHostname);
|
package/dist/seo/index.d.ts
CHANGED
|
@@ -28,9 +28,10 @@ export { seoRoute, type SeoRoute, type SeoRouteKind } from './route';
|
|
|
28
28
|
* their own, so they are covered by the post paths.
|
|
29
29
|
*
|
|
30
30
|
* Profiles are opt-in: a crawled profile page is cached by search engines long
|
|
31
|
-
* after the member leaves.
|
|
32
|
-
*
|
|
33
|
-
* anonymous visitor can already browse
|
|
31
|
+
* after the member leaves. The sitemap uses the same directory view
|
|
32
|
+
* (`directoryView`) as the anonymous `/members` list, so enabling this exposes
|
|
33
|
+
* exactly the profiles an anonymous visitor can already browse — never ones
|
|
34
|
+
* that opted out of the directory.
|
|
34
35
|
*/
|
|
35
36
|
export declare const crawlableEntries: ({ indexProfiles, }: {
|
|
36
37
|
indexProfiles: boolean;
|
package/dist/seo/index.js
CHANGED
|
@@ -38,15 +38,18 @@ const excerpt = (value, fallback) => {
|
|
|
38
38
|
* their own, so they are covered by the post paths.
|
|
39
39
|
*
|
|
40
40
|
* Profiles are opt-in: a crawled profile page is cached by search engines long
|
|
41
|
-
* after the member leaves.
|
|
42
|
-
*
|
|
43
|
-
* anonymous visitor can already browse
|
|
41
|
+
* after the member leaves. The sitemap uses the same directory view
|
|
42
|
+
* (`directoryView`) as the anonymous `/members` list, so enabling this exposes
|
|
43
|
+
* exactly the profiles an anonymous visitor can already browse — never ones
|
|
44
|
+
* that opted out of the directory.
|
|
44
45
|
*/
|
|
45
46
|
export const crawlableEntries = async ({ indexProfiles, }) => {
|
|
46
47
|
const [posts, groups, profiles] = await Promise.all([
|
|
47
48
|
listPosts(ANONYMOUS, { limit: PER_KIND_LIMIT }),
|
|
48
49
|
listGroups(ANONYMOUS),
|
|
49
|
-
indexProfiles
|
|
50
|
+
indexProfiles
|
|
51
|
+
? listProfiles(undefined, { directoryView: true })
|
|
52
|
+
: Promise.resolve([]),
|
|
50
53
|
]);
|
|
51
54
|
const entities = [
|
|
52
55
|
...posts.map((post) => ({
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@asteasolutions/zod-to-openapi": "^8.5.0",
|
|
8
8
|
"@keyv/redis": "^5.1.4",
|
|
9
|
-
"@sentry/node": "^
|
|
9
|
+
"@sentry/node": "^10.78.0",
|
|
10
10
|
"apns2": "^12.2.0",
|
|
11
11
|
"archiver": "^7.0.1",
|
|
12
12
|
"bcrypt": "^5.1.1",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"type-fest": "^4.31.0",
|
|
38
38
|
"uuidv7": "^1.0.2",
|
|
39
39
|
"web-push": "^3.6.7",
|
|
40
|
-
"@openpeepshq/common": "0.
|
|
40
|
+
"@openpeepshq/common": "0.12.0",
|
|
41
|
+
"@openpeepshq/i18n": "^0.13.0",
|
|
41
42
|
"@openpeepshq/fetch-client": "^0.2.1",
|
|
42
|
-
"@openpeepshq/geocoder": "^0.1.2"
|
|
43
|
-
"@openpeepshq/i18n": "^0.12.0"
|
|
43
|
+
"@openpeepshq/geocoder": "^0.1.2"
|
|
44
44
|
},
|
|
45
45
|
"main": "dist/index.js",
|
|
46
46
|
"types": "dist/index.d.ts",
|