@atproto/bsky 0.0.152 → 0.0.154
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/CHANGELOG.md +16 -0
- package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.js +2 -1
- package/dist/api/app/bsky/unspecced/getPostThreadHiddenV2.js.map +1 -1
- package/dist/api/com/atproto/repo/getRecord.d.ts.map +1 -1
- package/dist/api/com/atproto/repo/getRecord.js +1 -1
- package/dist/api/com/atproto/repo/getRecord.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -0
- package/dist/config.js.map +1 -1
- package/dist/data-plane/server/db/migrations/20250528T221913281Z-add-record-tags.d.ts +4 -0
- package/dist/data-plane/server/db/migrations/20250528T221913281Z-add-record-tags.d.ts.map +1 -0
- package/dist/data-plane/server/db/migrations/20250528T221913281Z-add-record-tags.js +11 -0
- package/dist/data-plane/server/db/migrations/20250528T221913281Z-add-record-tags.js.map +1 -0
- package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
- package/dist/data-plane/server/db/migrations/index.d.ts.map +1 -1
- package/dist/data-plane/server/db/migrations/index.js +2 -1
- package/dist/data-plane/server/db/migrations/index.js.map +1 -1
- package/dist/data-plane/server/db/tables/record.d.ts +1 -0
- package/dist/data-plane/server/db/tables/record.d.ts.map +1 -1
- package/dist/data-plane/server/db/tables/record.js.map +1 -1
- package/dist/data-plane/server/routes/records.d.ts.map +1 -1
- package/dist/data-plane/server/routes/records.js +1 -0
- package/dist/data-plane/server/routes/records.js.map +1 -1
- package/dist/hydration/feed.d.ts +1 -0
- package/dist/hydration/feed.d.ts.map +1 -1
- package/dist/hydration/feed.js +2 -0
- package/dist/hydration/feed.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +112 -122
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +66 -66
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts +33 -0
- package/dist/lexicon/types/app/bsky/unspecced/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/defs.js +36 -0
- package/dist/lexicon/types/app/bsky/unspecced/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.d.ts +5 -13
- package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.js +0 -9
- package/dist/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.js.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.d.ts +2 -29
- package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.js +0 -36
- package/dist/lexicon/types/app/bsky/unspecced/getPostThreadV2.js.map +1 -1
- package/dist/proto/bsky_pb.d.ts +4 -0
- package/dist/proto/bsky_pb.d.ts.map +1 -1
- package/dist/proto/bsky_pb.js +16 -0
- package/dist/proto/bsky_pb.js.map +1 -1
- package/dist/proto/bsync_connect.d.ts +19 -1
- package/dist/proto/bsync_connect.d.ts.map +1 -1
- package/dist/proto/bsync_connect.js +18 -0
- package/dist/proto/bsync_connect.js.map +1 -1
- package/dist/proto/bsync_pb.d.ts +150 -0
- package/dist/proto/bsync_pb.d.ts.map +1 -1
- package/dist/proto/bsync_pb.js +401 -1
- package/dist/proto/bsync_pb.js.map +1 -1
- package/dist/views/index.d.ts +6 -1
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +68 -27
- package/dist/views/index.js.map +1 -1
- package/dist/views/threads-v2.d.ts +9 -5
- package/dist/views/threads-v2.d.ts.map +1 -1
- package/dist/views/threads-v2.js +50 -25
- package/dist/views/threads-v2.js.map +1 -1
- package/package.json +7 -7
- package/proto/bsky.proto +1 -0
- package/src/api/app/bsky/unspecced/getPostThreadHiddenV2.ts +2 -1
- package/src/api/com/atproto/repo/getRecord.ts +4 -1
- package/src/config.ts +15 -0
- package/src/data-plane/server/db/migrations/20250528T221913281Z-add-record-tags.ts +9 -0
- package/src/data-plane/server/db/migrations/index.ts +1 -0
- package/src/data-plane/server/db/tables/record.ts +1 -0
- package/src/data-plane/server/routes/records.ts +1 -0
- package/src/hydration/feed.ts +3 -0
- package/src/index.ts +2 -0
- package/src/lexicon/lexicons.ts +72 -71
- package/src/lexicon/types/app/bsky/unspecced/defs.ts +73 -0
- package/src/lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2.ts +5 -22
- package/src/lexicon/types/app/bsky/unspecced/getPostThreadV2.ts +5 -72
- package/src/proto/bsky_pb.ts +12 -0
- package/src/proto/bsync_connect.ts +22 -0
- package/src/proto/bsync_pb.ts +355 -0
- package/src/views/index.ts +102 -58
- package/src/views/threads-v2.ts +88 -60
- package/tests/seed/thread-v2.ts +131 -32
- package/tests/views/__snapshots__/thread-v2.test.ts.snap +69 -23
- package/tests/views/thread-v2.test.ts +173 -69
- package/tsconfig.build.tsbuildinfo +1 -1
package/dist/views/threads-v2.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.sortTrimFlattenThreadTree = sortTrimFlattenThreadTree;
|
|
4
4
|
const api_1 = require("@atproto/api");
|
|
5
5
|
const post_1 = require("../lexicon/types/app/bsky/feed/post");
|
|
6
|
-
const getPostThreadHiddenV2_1 = require("../lexicon/types/app/bsky/unspecced/getPostThreadHiddenV2");
|
|
7
6
|
const isNodeWithReplies = (node) => 'replies' in node && node.replies !== undefined;
|
|
8
7
|
const isPostNode = (node) => node.type === 'post' || node.type === 'hiddenPost';
|
|
9
8
|
/** This function mutates the tree parameter. */
|
|
@@ -18,7 +17,6 @@ function sortTrimThreadTree(n, opts) {
|
|
|
18
17
|
return n;
|
|
19
18
|
}
|
|
20
19
|
const node = n;
|
|
21
|
-
const { branchingFactor, fetchedAt, opDid, prioritizeFollowedUsers, sort, viewer, } = opts;
|
|
22
20
|
if (node.replies) {
|
|
23
21
|
node.replies.sort((an, bn) => {
|
|
24
22
|
if (!isPostNode(an)) {
|
|
@@ -39,26 +37,23 @@ function sortTrimThreadTree(n, opts) {
|
|
|
39
37
|
});
|
|
40
38
|
// Trimming: after sorting, apply branching factor to all levels of replies except the anchor direct replies.
|
|
41
39
|
if (node.item.depth !== 0) {
|
|
42
|
-
node.replies = node.replies.slice(0, branchingFactor);
|
|
40
|
+
node.replies = node.replies.slice(0, opts.branchingFactor);
|
|
43
41
|
}
|
|
44
|
-
node.replies.forEach((reply) => sortTrimThreadTree(reply,
|
|
45
|
-
branchingFactor,
|
|
46
|
-
fetchedAt,
|
|
47
|
-
opDid,
|
|
48
|
-
prioritizeFollowedUsers,
|
|
49
|
-
sort,
|
|
50
|
-
viewer,
|
|
51
|
-
}));
|
|
42
|
+
node.replies.forEach((reply) => sortTrimThreadTree(reply, opts));
|
|
52
43
|
}
|
|
53
44
|
return node;
|
|
54
45
|
}
|
|
55
46
|
function applyBumping(aNode, bNode, opts) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
if (!isPostNode(aNode)) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (!isPostNode(bNode)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const { opDid, prioritizeFollowedUsers, viewer, threadTagsBumpDown, threadTagsHide, } = opts;
|
|
59
54
|
const maybeBump = (bump, predicateFn) => {
|
|
60
|
-
const aPredicate = predicateFn(
|
|
61
|
-
const bPredicate = predicateFn(
|
|
55
|
+
const aPredicate = predicateFn(aNode);
|
|
56
|
+
const bPredicate = predicateFn(bNode);
|
|
62
57
|
if (aPredicate && bPredicate) {
|
|
63
58
|
return applySorting(aNode, bNode, opts);
|
|
64
59
|
}
|
|
@@ -74,21 +69,51 @@ function applyBumping(aNode, bNode, opts) {
|
|
|
74
69
|
// Bumps-up applied first make the item appear higher in the list than later bumps-up.
|
|
75
70
|
// Bumps-down applied first make the item appear lower in the list than later bumps-down.
|
|
76
71
|
const bumps = [
|
|
72
|
+
/*
|
|
73
|
+
General bumps.
|
|
74
|
+
*/
|
|
77
75
|
// OP replies.
|
|
78
|
-
['up', (i) => i.post.author.did === opDid],
|
|
76
|
+
['up', (i) => i.item.value.post.author.did === opDid],
|
|
79
77
|
// Viewer replies.
|
|
80
|
-
['up', (i) => i.post.author.did === viewer],
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
['up', (i) => i.item.value.post.author.did === viewer],
|
|
79
|
+
/*
|
|
80
|
+
Bumps within visible replies.
|
|
81
|
+
*/
|
|
82
|
+
// Followers posts.
|
|
83
|
+
[
|
|
84
|
+
'up',
|
|
85
|
+
(i) => i.type === 'post' &&
|
|
86
|
+
prioritizeFollowedUsers &&
|
|
87
|
+
!!i.item.value.post.author.viewer?.following,
|
|
88
|
+
],
|
|
89
|
+
// Bump-down tags.
|
|
90
|
+
[
|
|
91
|
+
'down',
|
|
92
|
+
(i) => i.type === 'post' && threadTagsBumpDown.some((t) => i.tags.has(t)),
|
|
93
|
+
],
|
|
85
94
|
// Pushpin-only.
|
|
86
95
|
[
|
|
87
96
|
'down',
|
|
88
|
-
(i) =>
|
|
97
|
+
(i) => i.type === 'post' &&
|
|
98
|
+
isPostRecord(i.item.value.post.record) &&
|
|
99
|
+
i.item.value.post.record.text.trim() === '📌',
|
|
89
100
|
],
|
|
90
|
-
|
|
91
|
-
|
|
101
|
+
/*
|
|
102
|
+
Bumps within hidden replies.
|
|
103
|
+
This determines the order of hidden replies:
|
|
104
|
+
1. hidden by threadgate.
|
|
105
|
+
2. hidden by tags.
|
|
106
|
+
3. muted by viewer.
|
|
107
|
+
*/
|
|
108
|
+
// Muted account by the viewer.
|
|
109
|
+
['down', (i) => i.type === 'hiddenPost' && i.item.value.mutedByViewer],
|
|
110
|
+
// Hidden by tags.
|
|
111
|
+
[
|
|
112
|
+
'down',
|
|
113
|
+
(i) => i.type === 'hiddenPost' && threadTagsHide.some((t) => i.tags.has(t)),
|
|
114
|
+
],
|
|
115
|
+
// Hidden by threadgate.
|
|
116
|
+
['down', (i) => i.type === 'hiddenPost' && i.item.value.hiddenByThreadgate],
|
|
92
117
|
];
|
|
93
118
|
for (const [bump, predicateFn] of bumps) {
|
|
94
119
|
const bumpResult = maybeBump(bump, predicateFn);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threads-v2.js","sourceRoot":"","sources":["../../src/views/threads-v2.ts"],"names":[],"mappings":";;AA6GA,
|
|
1
|
+
{"version":3,"file":"threads-v2.js","sourceRoot":"","sources":["../../src/views/threads-v2.ts"],"names":[],"mappings":";;AA6GA,8DAOC;AApHD,sCAA0C;AAE1C,8DAA0F;AA0F1F,MAAM,iBAAiB,GAAG,CAAC,IAAgB,EAAiC,EAAE,CAC5E,SAAS,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,CAAA;AAEjD,MAAM,UAAU,GAAG,CAAC,IAAgB,EAAqC,EAAE,CACzE,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,CAAA;AAYpD,gDAAgD;AAChD,SAAgB,yBAAyB,CACvC,UAAsB,EACtB,OAA+B;IAE/B,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAEhE,OAAO,WAAW,CAAC,gBAAgB,CAAC,CAAA;AACtC,CAAC;AAYD,MAAM,YAAY,GAAG,IAAA,iBAAW,EAAC,qBAAkB,CAAC,CAAA;AAEpD,gDAAgD;AAChD,SAAS,kBAAkB,CACzB,CAAa,EACb,IAA4B;IAE5B,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,CAA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AAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACjC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,4BAA4B;YAC5B,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;gBACzB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;gBAC3B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,kEAAkE;IAClE,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAC/D,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;YACzB,4BAA4B;YAC5B,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;gBACzB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;gBAC3B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/bsky",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.154",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Reference implementation of app.bsky App View (Bluesky API)",
|
|
6
6
|
"keywords": [
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"undici": "^6.19.8",
|
|
50
50
|
"@atproto-labs/fetch-node": "0.1.9",
|
|
51
51
|
"@atproto-labs/xrpc-utils": "0.0.14",
|
|
52
|
-
"@atproto/api": "^0.15.10",
|
|
53
52
|
"@atproto/common": "^0.4.11",
|
|
53
|
+
"@atproto/api": "^0.15.12",
|
|
54
54
|
"@atproto/crypto": "^0.4.4",
|
|
55
55
|
"@atproto/did": "^0.1.5",
|
|
56
|
-
"@atproto/identity": "^0.4.8",
|
|
57
56
|
"@atproto/lexicon": "^0.4.11",
|
|
57
|
+
"@atproto/identity": "^0.4.8",
|
|
58
58
|
"@atproto/repo": "^0.8.1",
|
|
59
59
|
"@atproto/sync": "^0.1.23",
|
|
60
60
|
"@atproto/syntax": "^0.4.0",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"jest": "^28.1.2",
|
|
74
74
|
"ts-node": "^10.8.2",
|
|
75
75
|
"typescript": "^5.6.3",
|
|
76
|
-
"@atproto/api": "^0.15.
|
|
77
|
-
"@atproto/
|
|
78
|
-
"@atproto/
|
|
79
|
-
"@atproto/
|
|
76
|
+
"@atproto/api": "^0.15.12",
|
|
77
|
+
"@atproto/pds": "^0.4.142",
|
|
78
|
+
"@atproto/xrpc": "^0.7.0",
|
|
79
|
+
"@atproto/lex-cli": "^0.8.2"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"codegen": "lex gen-server --yes ./src/lexicon ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/* ../../lexicons/chat/bsky/*/*",
|
package/proto/bsky.proto
CHANGED
|
@@ -93,10 +93,11 @@ const hydration = async (
|
|
|
93
93
|
const presentation = (
|
|
94
94
|
inputs: PresentationFnInput<Context, Params, Skeleton>,
|
|
95
95
|
) => {
|
|
96
|
-
const { ctx, skeleton, hydration } = inputs
|
|
96
|
+
const { ctx, params, skeleton, hydration } = inputs
|
|
97
97
|
const thread = ctx.views.threadHiddenV2(skeleton, hydration, {
|
|
98
98
|
below: BELOW,
|
|
99
99
|
branchingFactor: BRANCHING_FACTOR,
|
|
100
|
+
prioritizeFollowedUsers: params.prioritizeFollowedUsers,
|
|
100
101
|
})
|
|
101
102
|
return { thread }
|
|
102
103
|
}
|
|
@@ -25,7 +25,10 @@ export default function (server: Server, ctx: AppContext) {
|
|
|
25
25
|
const result = await ctx.hydrator.getRecord(uri, includeTakedowns)
|
|
26
26
|
|
|
27
27
|
if (!result || (cid && result.cid !== cid)) {
|
|
28
|
-
throw new InvalidRequestError(
|
|
28
|
+
throw new InvalidRequestError(
|
|
29
|
+
`Could not locate record: ${uri}`,
|
|
30
|
+
'RecordNotFound',
|
|
31
|
+
)
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
return {
|
package/src/config.ts
CHANGED
|
@@ -57,6 +57,8 @@ export interface ServerConfigValues {
|
|
|
57
57
|
bigThreadDepth?: number
|
|
58
58
|
maxThreadDepth?: number
|
|
59
59
|
maxThreadParents: number
|
|
60
|
+
threadTagsHide: Set<string>
|
|
61
|
+
threadTagsBumpDown: Set<string>
|
|
60
62
|
// notifications
|
|
61
63
|
notificationsDelayMs?: number
|
|
62
64
|
// client config
|
|
@@ -195,6 +197,10 @@ export class ServerConfig {
|
|
|
195
197
|
const maxThreadParents = process.env.BSKY_MAX_THREAD_PARENTS
|
|
196
198
|
? parseInt(process.env.BSKY_MAX_THREAD_PARENTS || '', 10)
|
|
197
199
|
: 50
|
|
200
|
+
const threadTagsHide = new Set(envList(process.env.BSKY_THREAD_TAGS_HIDE))
|
|
201
|
+
const threadTagsBumpDown = new Set(
|
|
202
|
+
envList(process.env.BSKY_THREAD_TAGS_BUMP_DOWN),
|
|
203
|
+
)
|
|
198
204
|
|
|
199
205
|
const notificationsDelayMs = process.env.BSKY_NOTIFICATIONS_DELAY_MS
|
|
200
206
|
? parseInt(process.env.BSKY_NOTIFICATIONS_DELAY_MS || '', 10)
|
|
@@ -263,6 +269,8 @@ export class ServerConfig {
|
|
|
263
269
|
bigThreadDepth,
|
|
264
270
|
maxThreadDepth,
|
|
265
271
|
maxThreadParents,
|
|
272
|
+
threadTagsHide,
|
|
273
|
+
threadTagsBumpDown,
|
|
266
274
|
notificationsDelayMs,
|
|
267
275
|
disableSsrfProtection,
|
|
268
276
|
proxyAllowHTTP2,
|
|
@@ -467,6 +475,13 @@ export class ServerConfig {
|
|
|
467
475
|
return this.cfg.maxThreadParents
|
|
468
476
|
}
|
|
469
477
|
|
|
478
|
+
get threadTagsHide() {
|
|
479
|
+
return this.cfg.threadTagsHide
|
|
480
|
+
}
|
|
481
|
+
get threadTagsBumpDown() {
|
|
482
|
+
return this.cfg.threadTagsBumpDown
|
|
483
|
+
}
|
|
484
|
+
|
|
470
485
|
get notificationsDelayMs() {
|
|
471
486
|
return this.cfg.notificationsDelayMs ?? 0
|
|
472
487
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Kysely } from 'kysely'
|
|
2
|
+
|
|
3
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
4
|
+
await db.schema.alterTable('record').addColumn('tags', 'jsonb').execute()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
8
|
+
await db.schema.alterTable('record').dropColumn('tags').execute()
|
|
9
|
+
}
|
|
@@ -49,3 +49,4 @@ export * as _20250116T222618297Z from './20250116T222618297Z-post-embed-video'
|
|
|
49
49
|
export * as _20250207T174822012Z from './20250207T174822012Z-add-label-exp'
|
|
50
50
|
export * as _20250404T163421487Z from './20250404T163421487Z-verifications'
|
|
51
51
|
export * as _20250526T023712742Z from './20250526T023712742Z-like-repost-via'
|
|
52
|
+
export * as _20250528T221913281Z from './20250528T221913281Z-add-record-tags'
|
package/src/hydration/feed.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type Post = RecordInfo<PostRecord> & {
|
|
|
25
25
|
violatesEmbeddingRules: boolean
|
|
26
26
|
hasThreadGate: boolean
|
|
27
27
|
hasPostGate: boolean
|
|
28
|
+
tags: Set<string>
|
|
28
29
|
}
|
|
29
30
|
export type Posts = HydrationMap<Post>
|
|
30
31
|
|
|
@@ -113,6 +114,7 @@ export class FeedHydrator {
|
|
|
113
114
|
const violatesEmbeddingRules = res.meta[i].violatesEmbeddingRules
|
|
114
115
|
const hasThreadGate = res.meta[i].hasThreadGate
|
|
115
116
|
const hasPostGate = res.meta[i].hasPostGate
|
|
117
|
+
const tags = new Set<string>(res.records[i].tags ?? [])
|
|
116
118
|
return acc.set(
|
|
117
119
|
uri,
|
|
118
120
|
record
|
|
@@ -122,6 +124,7 @@ export class FeedHydrator {
|
|
|
122
124
|
violatesEmbeddingRules,
|
|
123
125
|
hasThreadGate,
|
|
124
126
|
hasPostGate,
|
|
127
|
+
tags,
|
|
125
128
|
}
|
|
126
129
|
: null,
|
|
127
130
|
)
|
package/src/index.ts
CHANGED
|
@@ -125,6 +125,8 @@ export class BskyAppView {
|
|
|
125
125
|
imgUriBuilder: imgUriBuilder,
|
|
126
126
|
videoUriBuilder: videoUriBuilder,
|
|
127
127
|
indexedAtEpoch: config.indexedAtEpoch,
|
|
128
|
+
threadTagsBumpDown: [...config.threadTagsBumpDown],
|
|
129
|
+
threadTagsHide: [...config.threadTagsHide],
|
|
128
130
|
})
|
|
129
131
|
|
|
130
132
|
const bsyncClient = createBsyncClient({
|
package/src/lexicon/lexicons.ts
CHANGED
|
@@ -10201,6 +10201,66 @@ export const schemaDict = {
|
|
|
10201
10201
|
},
|
|
10202
10202
|
},
|
|
10203
10203
|
},
|
|
10204
|
+
threadItemPost: {
|
|
10205
|
+
type: 'object',
|
|
10206
|
+
required: [
|
|
10207
|
+
'post',
|
|
10208
|
+
'moreParents',
|
|
10209
|
+
'moreReplies',
|
|
10210
|
+
'opThread',
|
|
10211
|
+
'hiddenByThreadgate',
|
|
10212
|
+
'mutedByViewer',
|
|
10213
|
+
],
|
|
10214
|
+
properties: {
|
|
10215
|
+
post: {
|
|
10216
|
+
type: 'ref',
|
|
10217
|
+
ref: 'lex:app.bsky.feed.defs#postView',
|
|
10218
|
+
},
|
|
10219
|
+
moreParents: {
|
|
10220
|
+
type: 'boolean',
|
|
10221
|
+
description:
|
|
10222
|
+
'This post has more parents that were not present in the response. This is just a boolean, without the number of parents.',
|
|
10223
|
+
},
|
|
10224
|
+
moreReplies: {
|
|
10225
|
+
type: 'integer',
|
|
10226
|
+
description:
|
|
10227
|
+
'This post has more replies that were not present in the response. This is a numeric value, which is best-effort and might not be accurate.',
|
|
10228
|
+
},
|
|
10229
|
+
opThread: {
|
|
10230
|
+
type: 'boolean',
|
|
10231
|
+
description:
|
|
10232
|
+
'This post is part of a contiguous thread by the OP from the thread root. Many different OP threads can happen in the same thread.',
|
|
10233
|
+
},
|
|
10234
|
+
hiddenByThreadgate: {
|
|
10235
|
+
type: 'boolean',
|
|
10236
|
+
description:
|
|
10237
|
+
'The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread.',
|
|
10238
|
+
},
|
|
10239
|
+
mutedByViewer: {
|
|
10240
|
+
type: 'boolean',
|
|
10241
|
+
description:
|
|
10242
|
+
'This is by an account muted by the viewer requesting it.',
|
|
10243
|
+
},
|
|
10244
|
+
},
|
|
10245
|
+
},
|
|
10246
|
+
threadItemNoUnauthenticated: {
|
|
10247
|
+
type: 'object',
|
|
10248
|
+
properties: {},
|
|
10249
|
+
},
|
|
10250
|
+
threadItemNotFound: {
|
|
10251
|
+
type: 'object',
|
|
10252
|
+
properties: {},
|
|
10253
|
+
},
|
|
10254
|
+
threadItemBlocked: {
|
|
10255
|
+
type: 'object',
|
|
10256
|
+
required: ['author'],
|
|
10257
|
+
properties: {
|
|
10258
|
+
author: {
|
|
10259
|
+
type: 'ref',
|
|
10260
|
+
ref: 'lex:app.bsky.feed.defs#blockedAuthor',
|
|
10261
|
+
},
|
|
10262
|
+
},
|
|
10263
|
+
},
|
|
10204
10264
|
},
|
|
10205
10265
|
},
|
|
10206
10266
|
AppBskyUnspeccedGetConfig: {
|
|
@@ -10312,6 +10372,12 @@ export const schemaDict = {
|
|
|
10312
10372
|
description:
|
|
10313
10373
|
'Reference (AT-URI) to post record. This is the anchor post.',
|
|
10314
10374
|
},
|
|
10375
|
+
prioritizeFollowedUsers: {
|
|
10376
|
+
type: 'boolean',
|
|
10377
|
+
description:
|
|
10378
|
+
'Whether to prioritize posts from followed users. It only has effect when the user is authenticated.',
|
|
10379
|
+
default: false,
|
|
10380
|
+
},
|
|
10315
10381
|
},
|
|
10316
10382
|
},
|
|
10317
10383
|
output: {
|
|
@@ -10323,7 +10389,7 @@ export const schemaDict = {
|
|
|
10323
10389
|
thread: {
|
|
10324
10390
|
type: 'array',
|
|
10325
10391
|
description:
|
|
10326
|
-
'A flat list of thread
|
|
10392
|
+
'A flat list of hidden thread items. The depth of each item is indicated by the depth property inside the item.',
|
|
10327
10393
|
items: {
|
|
10328
10394
|
type: 'ref',
|
|
10329
10395
|
ref: 'lex:app.bsky.unspecced.getPostThreadHiddenV2#threadHiddenItem',
|
|
@@ -10348,29 +10414,7 @@ export const schemaDict = {
|
|
|
10348
10414
|
},
|
|
10349
10415
|
value: {
|
|
10350
10416
|
type: 'union',
|
|
10351
|
-
refs: [
|
|
10352
|
-
'lex:app.bsky.unspecced.getPostThreadHiddenV2#threadHiddenItemPost',
|
|
10353
|
-
],
|
|
10354
|
-
},
|
|
10355
|
-
},
|
|
10356
|
-
},
|
|
10357
|
-
threadHiddenItemPost: {
|
|
10358
|
-
type: 'object',
|
|
10359
|
-
required: ['post', 'hiddenByThreadgate', 'mutedByViewer'],
|
|
10360
|
-
properties: {
|
|
10361
|
-
post: {
|
|
10362
|
-
type: 'ref',
|
|
10363
|
-
ref: 'lex:app.bsky.feed.defs#postView',
|
|
10364
|
-
},
|
|
10365
|
-
hiddenByThreadgate: {
|
|
10366
|
-
type: 'boolean',
|
|
10367
|
-
description:
|
|
10368
|
-
'The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread.',
|
|
10369
|
-
},
|
|
10370
|
-
mutedByViewer: {
|
|
10371
|
-
type: 'boolean',
|
|
10372
|
-
description:
|
|
10373
|
-
'This is by an account muted by the viewer requesting it.',
|
|
10417
|
+
refs: ['lex:app.bsky.unspecced.defs#threadItemPost'],
|
|
10374
10418
|
},
|
|
10375
10419
|
},
|
|
10376
10420
|
},
|
|
@@ -10473,57 +10517,14 @@ export const schemaDict = {
|
|
|
10473
10517
|
value: {
|
|
10474
10518
|
type: 'union',
|
|
10475
10519
|
refs: [
|
|
10476
|
-
'lex:app.bsky.unspecced.
|
|
10477
|
-
'lex:app.bsky.unspecced.
|
|
10478
|
-
'lex:app.bsky.unspecced.
|
|
10479
|
-
'lex:app.bsky.unspecced.
|
|
10520
|
+
'lex:app.bsky.unspecced.defs#threadItemPost',
|
|
10521
|
+
'lex:app.bsky.unspecced.defs#threadItemNoUnauthenticated',
|
|
10522
|
+
'lex:app.bsky.unspecced.defs#threadItemNotFound',
|
|
10523
|
+
'lex:app.bsky.unspecced.defs#threadItemBlocked',
|
|
10480
10524
|
],
|
|
10481
10525
|
},
|
|
10482
10526
|
},
|
|
10483
10527
|
},
|
|
10484
|
-
threadItemPost: {
|
|
10485
|
-
type: 'object',
|
|
10486
|
-
required: ['post', 'moreParents', 'moreReplies', 'opThread'],
|
|
10487
|
-
properties: {
|
|
10488
|
-
post: {
|
|
10489
|
-
type: 'ref',
|
|
10490
|
-
ref: 'lex:app.bsky.feed.defs#postView',
|
|
10491
|
-
},
|
|
10492
|
-
moreParents: {
|
|
10493
|
-
type: 'boolean',
|
|
10494
|
-
description:
|
|
10495
|
-
'This post has more parents that were not present in the response. This is just a boolean, without the number of parents.',
|
|
10496
|
-
},
|
|
10497
|
-
moreReplies: {
|
|
10498
|
-
type: 'integer',
|
|
10499
|
-
description:
|
|
10500
|
-
'This post has more replies that were not present in the response. This is a numeric value, which is best-effort and might not be accurate.',
|
|
10501
|
-
},
|
|
10502
|
-
opThread: {
|
|
10503
|
-
type: 'boolean',
|
|
10504
|
-
description:
|
|
10505
|
-
'This post is part of a contiguous thread by the OP from the thread root. Many different OP threads can happen in the same thread.',
|
|
10506
|
-
},
|
|
10507
|
-
},
|
|
10508
|
-
},
|
|
10509
|
-
threadItemNoUnauthenticated: {
|
|
10510
|
-
type: 'object',
|
|
10511
|
-
properties: {},
|
|
10512
|
-
},
|
|
10513
|
-
threadItemNotFound: {
|
|
10514
|
-
type: 'object',
|
|
10515
|
-
properties: {},
|
|
10516
|
-
},
|
|
10517
|
-
threadItemBlocked: {
|
|
10518
|
-
type: 'object',
|
|
10519
|
-
required: ['author'],
|
|
10520
|
-
properties: {
|
|
10521
|
-
author: {
|
|
10522
|
-
type: 'ref',
|
|
10523
|
-
ref: 'lex:app.bsky.feed.defs#blockedAuthor',
|
|
10524
|
-
},
|
|
10525
|
-
},
|
|
10526
|
-
},
|
|
10527
10528
|
},
|
|
10528
10529
|
},
|
|
10529
10530
|
AppBskyUnspeccedGetSuggestedFeeds: {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type OmitKey,
|
|
11
11
|
} from '../../../../util'
|
|
12
12
|
import type * as AppBskyActorDefs from '../actor/defs.js'
|
|
13
|
+
import type * as AppBskyFeedDefs from '../feed/defs.js'
|
|
13
14
|
|
|
14
15
|
const is$typed = _is$typed,
|
|
15
16
|
validate = _validate
|
|
@@ -125,3 +126,75 @@ export function isTrendView<V>(v: V) {
|
|
|
125
126
|
export function validateTrendView<V>(v: V) {
|
|
126
127
|
return validate<TrendView & V>(v, id, hashTrendView)
|
|
127
128
|
}
|
|
129
|
+
|
|
130
|
+
export interface ThreadItemPost {
|
|
131
|
+
$type?: 'app.bsky.unspecced.defs#threadItemPost'
|
|
132
|
+
post: AppBskyFeedDefs.PostView
|
|
133
|
+
/** This post has more parents that were not present in the response. This is just a boolean, without the number of parents. */
|
|
134
|
+
moreParents: boolean
|
|
135
|
+
/** This post has more replies that were not present in the response. This is a numeric value, which is best-effort and might not be accurate. */
|
|
136
|
+
moreReplies: number
|
|
137
|
+
/** This post is part of a contiguous thread by the OP from the thread root. Many different OP threads can happen in the same thread. */
|
|
138
|
+
opThread: boolean
|
|
139
|
+
/** The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread. */
|
|
140
|
+
hiddenByThreadgate: boolean
|
|
141
|
+
/** This is by an account muted by the viewer requesting it. */
|
|
142
|
+
mutedByViewer: boolean
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const hashThreadItemPost = 'threadItemPost'
|
|
146
|
+
|
|
147
|
+
export function isThreadItemPost<V>(v: V) {
|
|
148
|
+
return is$typed(v, id, hashThreadItemPost)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function validateThreadItemPost<V>(v: V) {
|
|
152
|
+
return validate<ThreadItemPost & V>(v, id, hashThreadItemPost)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ThreadItemNoUnauthenticated {
|
|
156
|
+
$type?: 'app.bsky.unspecced.defs#threadItemNoUnauthenticated'
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const hashThreadItemNoUnauthenticated = 'threadItemNoUnauthenticated'
|
|
160
|
+
|
|
161
|
+
export function isThreadItemNoUnauthenticated<V>(v: V) {
|
|
162
|
+
return is$typed(v, id, hashThreadItemNoUnauthenticated)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function validateThreadItemNoUnauthenticated<V>(v: V) {
|
|
166
|
+
return validate<ThreadItemNoUnauthenticated & V>(
|
|
167
|
+
v,
|
|
168
|
+
id,
|
|
169
|
+
hashThreadItemNoUnauthenticated,
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface ThreadItemNotFound {
|
|
174
|
+
$type?: 'app.bsky.unspecced.defs#threadItemNotFound'
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const hashThreadItemNotFound = 'threadItemNotFound'
|
|
178
|
+
|
|
179
|
+
export function isThreadItemNotFound<V>(v: V) {
|
|
180
|
+
return is$typed(v, id, hashThreadItemNotFound)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function validateThreadItemNotFound<V>(v: V) {
|
|
184
|
+
return validate<ThreadItemNotFound & V>(v, id, hashThreadItemNotFound)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface ThreadItemBlocked {
|
|
188
|
+
$type?: 'app.bsky.unspecced.defs#threadItemBlocked'
|
|
189
|
+
author: AppBskyFeedDefs.BlockedAuthor
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const hashThreadItemBlocked = 'threadItemBlocked'
|
|
193
|
+
|
|
194
|
+
export function isThreadItemBlocked<V>(v: V) {
|
|
195
|
+
return is$typed(v, id, hashThreadItemBlocked)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function validateThreadItemBlocked<V>(v: V) {
|
|
199
|
+
return validate<ThreadItemBlocked & V>(v, id, hashThreadItemBlocked)
|
|
200
|
+
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type OmitKey,
|
|
12
12
|
} from '../../../../util'
|
|
13
13
|
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
|
14
|
-
import type * as
|
|
14
|
+
import type * as AppBskyUnspeccedDefs from './defs.js'
|
|
15
15
|
|
|
16
16
|
const is$typed = _is$typed,
|
|
17
17
|
validate = _validate
|
|
@@ -20,12 +20,14 @@ const id = 'app.bsky.unspecced.getPostThreadHiddenV2'
|
|
|
20
20
|
export interface QueryParams {
|
|
21
21
|
/** Reference (AT-URI) to post record. This is the anchor post. */
|
|
22
22
|
anchor: string
|
|
23
|
+
/** Whether to prioritize posts from followed users. It only has effect when the user is authenticated. */
|
|
24
|
+
prioritizeFollowedUsers: boolean
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export type InputSchema = undefined
|
|
26
28
|
|
|
27
29
|
export interface OutputSchema {
|
|
28
|
-
/** A flat list of thread
|
|
30
|
+
/** A flat list of hidden thread items. The depth of each item is indicated by the depth property inside the item. */
|
|
29
31
|
thread: ThreadHiddenItem[]
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -60,7 +62,7 @@ export interface ThreadHiddenItem {
|
|
|
60
62
|
uri: string
|
|
61
63
|
/** The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths. */
|
|
62
64
|
depth: number
|
|
63
|
-
value: $Typed<
|
|
65
|
+
value: $Typed<AppBskyUnspeccedDefs.ThreadItemPost> | { $type: string }
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
const hashThreadHiddenItem = 'threadHiddenItem'
|
|
@@ -72,22 +74,3 @@ export function isThreadHiddenItem<V>(v: V) {
|
|
|
72
74
|
export function validateThreadHiddenItem<V>(v: V) {
|
|
73
75
|
return validate<ThreadHiddenItem & V>(v, id, hashThreadHiddenItem)
|
|
74
76
|
}
|
|
75
|
-
|
|
76
|
-
export interface ThreadHiddenItemPost {
|
|
77
|
-
$type?: 'app.bsky.unspecced.getPostThreadHiddenV2#threadHiddenItemPost'
|
|
78
|
-
post: AppBskyFeedDefs.PostView
|
|
79
|
-
/** The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread. */
|
|
80
|
-
hiddenByThreadgate: boolean
|
|
81
|
-
/** This is by an account muted by the viewer requesting it. */
|
|
82
|
-
mutedByViewer: boolean
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const hashThreadHiddenItemPost = 'threadHiddenItemPost'
|
|
86
|
-
|
|
87
|
-
export function isThreadHiddenItemPost<V>(v: V) {
|
|
88
|
-
return is$typed(v, id, hashThreadHiddenItemPost)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function validateThreadHiddenItemPost<V>(v: V) {
|
|
92
|
-
return validate<ThreadHiddenItemPost & V>(v, id, hashThreadHiddenItemPost)
|
|
93
|
-
}
|