@atproto/bsky 0.0.11 → 0.0.13
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 +29 -0
- package/LICENSE.txt +7 -0
- package/README.md +6 -1
- package/dist/api/com/atproto/admin/util.d.ts +5 -0
- package/dist/context.d.ts +6 -1
- package/dist/db/index.js +51 -2
- package/dist/db/index.js.map +3 -3
- package/dist/db/migrations/20230929T192920807Z-record-cursor-indexes.d.ts +3 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/did-cache.d.ts +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1630 -755
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +8 -0
- package/dist/lexicon/lexicons.d.ts +243 -3
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +28 -0
- package/dist/lexicon/types/com/atproto/admin/getAccountInfo.d.ts +29 -0
- package/dist/lexicon/types/com/atproto/admin/getSubjectStatus.d.ts +39 -0
- package/dist/lexicon/types/com/atproto/admin/searchRepos.d.ts +0 -1
- package/dist/lexicon/types/com/atproto/admin/updateSubjectStatus.d.ts +46 -0
- package/dist/lexicon/types/com/atproto/server/createAccount.d.ts +4 -2
- package/dist/lexicon/types/com/atproto/server/createSession.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/server/refreshSession.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/server/reserveSigningKey.d.ts +36 -0
- package/dist/lexicon/types/com/atproto/sync/listRepos.d.ts +1 -0
- package/dist/services/actor/types.d.ts +1 -0
- package/dist/services/graph/index.d.ts +2 -0
- package/dist/services/moderation/index.d.ts +13 -3
- package/package.json +14 -15
- package/src/api/app/bsky/feed/getAuthorFeed.ts +2 -2
- package/src/api/app/bsky/feed/getPostThread.ts +2 -2
- package/src/api/app/bsky/notification/listNotifications.ts +33 -22
- package/src/api/com/atproto/admin/getModerationAction.ts +28 -2
- package/src/api/com/atproto/admin/getModerationReport.ts +27 -2
- package/src/api/com/atproto/admin/getRecord.ts +14 -2
- package/src/api/com/atproto/admin/getRepo.ts +13 -2
- package/src/api/com/atproto/admin/reverseModerationAction.ts +31 -5
- package/src/api/com/atproto/admin/searchRepos.ts +2 -5
- package/src/api/com/atproto/admin/takeModerationAction.ts +41 -7
- package/src/api/com/atproto/admin/util.ts +50 -0
- package/src/api/well-known.ts +8 -0
- package/src/auth.ts +12 -5
- package/src/auto-moderator/index.ts +1 -0
- package/src/context.ts +25 -1
- package/src/db/migrations/20230929T192920807Z-record-cursor-indexes.ts +40 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/did-cache.ts +29 -14
- package/src/feed-gen/with-friends.ts +2 -2
- package/src/index.ts +4 -1
- package/src/indexer/subscription.ts +1 -21
- package/src/lexicon/index.ts +48 -0
- package/src/lexicon/lexicons.ts +259 -5
- package/src/lexicon/types/app/bsky/actor/defs.ts +1 -0
- package/src/lexicon/types/com/atproto/admin/defs.ts +61 -0
- package/src/lexicon/types/com/atproto/admin/getAccountInfo.ts +41 -0
- package/src/lexicon/types/com/atproto/admin/getSubjectStatus.ts +54 -0
- package/src/lexicon/types/com/atproto/admin/searchRepos.ts +0 -1
- package/src/lexicon/types/com/atproto/admin/updateSubjectStatus.ts +61 -0
- package/src/lexicon/types/com/atproto/server/createAccount.ts +4 -2
- package/src/lexicon/types/com/atproto/server/createSession.ts +1 -0
- package/src/lexicon/types/com/atproto/server/refreshSession.ts +1 -0
- package/src/lexicon/types/com/atproto/server/reserveSigningKey.ts +51 -0
- package/src/lexicon/types/com/atproto/sync/listRepos.ts +1 -0
- package/src/logger.ts +8 -0
- package/src/services/actor/index.ts +7 -1
- package/src/services/actor/types.ts +1 -0
- package/src/services/actor/views.ts +26 -8
- package/src/services/graph/index.ts +26 -7
- package/src/services/indexing/index.ts +15 -17
- package/src/services/moderation/index.ts +94 -14
- package/src/services/moderation/views.ts +1 -0
- package/tests/__snapshots__/feed-generation.test.ts.snap +12 -12
- package/tests/__snapshots__/indexing.test.ts.snap +4 -4
- package/tests/admin/__snapshots__/get-moderation-action.test.ts.snap +172 -0
- package/tests/admin/__snapshots__/get-moderation-actions.test.ts.snap +178 -0
- package/tests/admin/__snapshots__/get-moderation-report.test.ts.snap +177 -0
- package/tests/admin/__snapshots__/get-moderation-reports.test.ts.snap +307 -0
- package/tests/admin/__snapshots__/get-record.test.ts.snap +275 -0
- package/tests/admin/__snapshots__/get-repo.test.ts.snap +103 -0
- package/tests/admin/get-moderation-action.test.ts +100 -0
- package/tests/admin/get-moderation-actions.test.ts +164 -0
- package/tests/admin/get-moderation-report.test.ts +100 -0
- package/tests/admin/get-moderation-reports.test.ts +332 -0
- package/tests/admin/get-record.test.ts +115 -0
- package/tests/admin/get-repo.test.ts +101 -0
- package/tests/{moderation.test.ts → admin/moderation.test.ts} +107 -9
- package/tests/admin/repo-search.test.ts +124 -0
- package/tests/algos/hot-classic.test.ts +3 -5
- package/tests/algos/whats-hot.test.ts +3 -5
- package/tests/algos/with-friends.test.ts +2 -4
- package/tests/auth.test.ts +64 -0
- package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -3
- package/tests/auto-moderator/labeler.test.ts +5 -7
- package/tests/auto-moderator/takedowns.test.ts +11 -12
- package/tests/blob-resolver.test.ts +1 -3
- package/tests/did-cache.test.ts +2 -5
- package/tests/feed-generation.test.ts +8 -6
- package/tests/handle-invalidation.test.ts +2 -3
- package/tests/image/server.test.ts +1 -4
- package/tests/image/sharp.test.ts +1 -1
- package/tests/indexing.test.ts +4 -4
- package/tests/notification-server.test.ts +2 -3
- package/tests/pipeline/backpressure.test.ts +2 -3
- package/tests/pipeline/reingest.test.ts +7 -4
- package/tests/pipeline/repartition.test.ts +2 -3
- package/tests/reprocessing.test.ts +2 -6
- package/tests/seeds/basic.ts +4 -4
- package/tests/seeds/follows.ts +1 -1
- package/tests/seeds/likes.ts +1 -1
- package/tests/seeds/reposts.ts +1 -1
- package/tests/seeds/users-bulk.ts +1 -1
- package/tests/seeds/users.ts +1 -1
- package/tests/server.test.ts +1 -3
- package/tests/subscription/repo.test.ts +2 -4
- package/tests/views/__snapshots__/author-feed.test.ts.snap +24 -24
- package/tests/views/__snapshots__/block-lists.test.ts.snap +42 -7
- package/tests/views/__snapshots__/blocks.test.ts.snap +2 -2
- package/tests/views/__snapshots__/list-feed.test.ts.snap +6 -6
- package/tests/views/__snapshots__/mute-lists.test.ts.snap +15 -4
- package/tests/views/__snapshots__/mutes.test.ts.snap +2 -2
- package/tests/views/__snapshots__/notifications.test.ts.snap +2 -2
- package/tests/views/__snapshots__/posts.test.ts.snap +8 -8
- package/tests/views/__snapshots__/thread.test.ts.snap +10 -10
- package/tests/views/__snapshots__/timeline.test.ts.snap +58 -58
- package/tests/views/actor-likes.test.ts +2 -3
- package/tests/views/actor-search.test.ts +5 -5
- package/tests/views/admin/repo-search.test.ts +2 -4
- package/tests/views/author-feed.test.ts +2 -4
- package/tests/views/block-lists.test.ts +34 -7
- package/tests/views/blocks.test.ts +6 -3
- package/tests/views/follows.test.ts +2 -4
- package/tests/views/likes.test.ts +2 -5
- package/tests/views/list-feed.test.ts +2 -4
- package/tests/views/mute-lists.test.ts +23 -5
- package/tests/views/mutes.test.ts +2 -5
- package/tests/views/notifications.test.ts +2 -4
- package/tests/views/posts.test.ts +2 -5
- package/tests/views/profile.test.ts +4 -5
- package/tests/views/reposts.test.ts +2 -4
- package/tests/views/suggested-follows.test.ts +2 -3
- package/tests/views/suggestions.test.ts +2 -4
- package/tests/views/thread.test.ts +2 -4
- package/tests/views/threadgating.test.ts +2 -3
- package/tests/views/timeline.test.ts +2 -4
- package/LICENSE +0 -21
- package/dist/env.d.ts +0 -1
- package/example.dev.env +0 -5
- package/src/env.ts +0 -9
- package/tests/seeds/client.ts +0 -466
- /package/tests/{__snapshots__ → admin/__snapshots__}/moderation.test.ts.snap +0 -0
- /package/tests/{image/fixtures → sample-img}/at.png +0 -0
- /package/tests/{image/fixtures → sample-img}/hd-key.jpg +0 -0
- /package/tests/{image/fixtures → sample-img}/key-alt.jpg +0 -0
- /package/tests/{image/fixtures → sample-img}/key-landscape-large.jpg +0 -0
- /package/tests/{image/fixtures → sample-img}/key-landscape-small.jpg +0 -0
- /package/tests/{image/fixtures → sample-img}/key-portrait-large.jpg +0 -0
- /package/tests/{image/fixtures → sample-img}/key-portrait-small.jpg +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient, RecordRef } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot } from '../_util'
|
|
4
|
-
import { SeedClient } from '../seeds/client'
|
|
5
4
|
import basicSeed from '../seeds/basic'
|
|
6
|
-
import { RecordRef } from '@atproto/bsky/tests/seeds/client'
|
|
7
5
|
import { BlockedActorError } from '@atproto/api/src/client/types/app/bsky/feed/getAuthorFeed'
|
|
8
6
|
import { BlockedByActorError } from '@atproto/api/src/client/types/app/bsky/feed/getAuthorFeed'
|
|
9
7
|
|
|
@@ -25,7 +23,7 @@ describe('pds views with blocking from block lists', () => {
|
|
|
25
23
|
})
|
|
26
24
|
agent = network.bsky.getClient()
|
|
27
25
|
pdsAgent = network.pds.getClient()
|
|
28
|
-
sc =
|
|
26
|
+
sc = network.getSeedClient()
|
|
29
27
|
await basicSeed(sc)
|
|
30
28
|
alice = sc.dids.alice
|
|
31
29
|
bob = sc.dids.bob
|
|
@@ -52,7 +50,7 @@ describe('pds views with blocking from block lists', () => {
|
|
|
52
50
|
it('creates a list with some items', async () => {
|
|
53
51
|
const avatar = await sc.uploadFile(
|
|
54
52
|
alice,
|
|
55
|
-
'tests/
|
|
53
|
+
'tests/sample-img/key-portrait-small.jpg',
|
|
56
54
|
'image/jpeg',
|
|
57
55
|
)
|
|
58
56
|
// alice creates block list with bob & carol that dan uses
|
|
@@ -60,7 +58,7 @@ describe('pds views with blocking from block lists', () => {
|
|
|
60
58
|
{ repo: alice },
|
|
61
59
|
{
|
|
62
60
|
name: 'alice blocks',
|
|
63
|
-
purpose: 'app.bsky.graph.defs#
|
|
61
|
+
purpose: 'app.bsky.graph.defs#modlist',
|
|
64
62
|
description: 'big list of blocks',
|
|
65
63
|
avatar: avatar.image,
|
|
66
64
|
createdAt: new Date().toISOString(),
|
|
@@ -86,6 +84,15 @@ describe('pds views with blocking from block lists', () => {
|
|
|
86
84
|
},
|
|
87
85
|
sc.getHeaders(alice),
|
|
88
86
|
)
|
|
87
|
+
await pdsAgent.api.app.bsky.graph.listitem.create(
|
|
88
|
+
{ repo: alice },
|
|
89
|
+
{
|
|
90
|
+
subject: sc.dids.dan,
|
|
91
|
+
list: list.uri,
|
|
92
|
+
createdAt: new Date().toISOString(),
|
|
93
|
+
},
|
|
94
|
+
sc.getHeaders(alice),
|
|
95
|
+
)
|
|
89
96
|
await network.processAll()
|
|
90
97
|
})
|
|
91
98
|
|
|
@@ -194,6 +201,7 @@ describe('pds views with blocking from block lists', () => {
|
|
|
194
201
|
{ headers: await network.serviceHeaders(carol) },
|
|
195
202
|
)
|
|
196
203
|
expect(resCarol.data.viewer?.blocking).toBeUndefined()
|
|
204
|
+
expect(resCarol.data.viewer?.blockingByList).toBeUndefined()
|
|
197
205
|
expect(resCarol.data.viewer?.blockedBy).toBe(true)
|
|
198
206
|
|
|
199
207
|
const resDan = await agent.api.app.bsky.actor.getProfile(
|
|
@@ -201,6 +209,9 @@ describe('pds views with blocking from block lists', () => {
|
|
|
201
209
|
{ headers: await network.serviceHeaders(dan) },
|
|
202
210
|
)
|
|
203
211
|
expect(resDan.data.viewer?.blocking).toBeDefined()
|
|
212
|
+
expect(resDan.data.viewer?.blockingByList?.uri).toEqual(
|
|
213
|
+
resDan.data.viewer?.blocking,
|
|
214
|
+
)
|
|
204
215
|
expect(resDan.data.viewer?.blockedBy).toBe(false)
|
|
205
216
|
})
|
|
206
217
|
|
|
@@ -210,8 +221,10 @@ describe('pds views with blocking from block lists', () => {
|
|
|
210
221
|
{ headers: await network.serviceHeaders(carol) },
|
|
211
222
|
)
|
|
212
223
|
expect(resCarol.data.profiles[0].viewer?.blocking).toBeUndefined()
|
|
224
|
+
expect(resCarol.data.profiles[0].viewer?.blockingByList).toBeUndefined()
|
|
213
225
|
expect(resCarol.data.profiles[0].viewer?.blockedBy).toBe(false)
|
|
214
226
|
expect(resCarol.data.profiles[1].viewer?.blocking).toBeUndefined()
|
|
227
|
+
expect(resCarol.data.profiles[1].viewer?.blockingByList).toBeUndefined()
|
|
215
228
|
expect(resCarol.data.profiles[1].viewer?.blockedBy).toBe(true)
|
|
216
229
|
|
|
217
230
|
const resDan = await agent.api.app.bsky.actor.getProfiles(
|
|
@@ -219,11 +232,25 @@ describe('pds views with blocking from block lists', () => {
|
|
|
219
232
|
{ headers: await network.serviceHeaders(dan) },
|
|
220
233
|
)
|
|
221
234
|
expect(resDan.data.profiles[0].viewer?.blocking).toBeUndefined()
|
|
235
|
+
expect(resDan.data.profiles[0].viewer?.blockingByList).toBeUndefined()
|
|
222
236
|
expect(resDan.data.profiles[0].viewer?.blockedBy).toBe(false)
|
|
223
237
|
expect(resDan.data.profiles[1].viewer?.blocking).toBeDefined()
|
|
238
|
+
expect(resDan.data.profiles[1].viewer?.blockingByList?.uri).toEqual(
|
|
239
|
+
resDan.data.profiles[1].viewer?.blocking,
|
|
240
|
+
)
|
|
224
241
|
expect(resDan.data.profiles[1].viewer?.blockedBy).toBe(false)
|
|
225
242
|
})
|
|
226
243
|
|
|
244
|
+
it('ignores self-blocks', async () => {
|
|
245
|
+
const res = await agent.api.app.bsky.actor.getProfile(
|
|
246
|
+
{ actor: dan }, // dan subscribes to list that contains himself
|
|
247
|
+
{ headers: await network.serviceHeaders(dan) },
|
|
248
|
+
)
|
|
249
|
+
expect(res.data.viewer?.blocking).toBeUndefined()
|
|
250
|
+
expect(res.data.viewer?.blockingByList).toBeUndefined()
|
|
251
|
+
expect(res.data.viewer?.blockedBy).toBe(false)
|
|
252
|
+
})
|
|
253
|
+
|
|
227
254
|
it('does not return notifs for blocked accounts', async () => {
|
|
228
255
|
const resCarol = await agent.api.app.bsky.notification.listNotifications(
|
|
229
256
|
{
|
|
@@ -337,7 +364,7 @@ describe('pds views with blocking from block lists', () => {
|
|
|
337
364
|
{ repo: alice },
|
|
338
365
|
{
|
|
339
366
|
name: 'new list',
|
|
340
|
-
purpose: 'app.bsky.graph.defs#
|
|
367
|
+
purpose: 'app.bsky.graph.defs#modlist',
|
|
341
368
|
description: 'blah blah',
|
|
342
369
|
createdAt: new Date().toISOString(),
|
|
343
370
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import assert from 'assert'
|
|
2
|
+
import { TestNetwork, RecordRef, SeedClient } from '@atproto/dev-env'
|
|
2
3
|
import AtpAgent, { AtUri } from '@atproto/api'
|
|
3
4
|
import { BlockedActorError } from '@atproto/api/src/client/types/app/bsky/feed/getAuthorFeed'
|
|
4
5
|
import { BlockedByActorError } from '@atproto/api/src/client/types/app/bsky/feed/getAuthorFeed'
|
|
@@ -7,9 +8,7 @@ import {
|
|
|
7
8
|
isViewRecord as isEmbedViewRecord,
|
|
8
9
|
isViewBlocked as isEmbedViewBlocked,
|
|
9
10
|
} from '@atproto/api/src/client/types/app/bsky/embed/record'
|
|
10
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
11
11
|
import { forSnapshot } from '../_util'
|
|
12
|
-
import { RecordRef, SeedClient } from '../seeds/client'
|
|
13
12
|
import basicSeed from '../seeds/basic'
|
|
14
13
|
|
|
15
14
|
describe('pds views with blocking', () => {
|
|
@@ -32,7 +31,7 @@ describe('pds views with blocking', () => {
|
|
|
32
31
|
})
|
|
33
32
|
agent = network.bsky.getClient()
|
|
34
33
|
pdsAgent = network.pds.getClient()
|
|
35
|
-
sc =
|
|
34
|
+
sc = network.getSeedClient()
|
|
36
35
|
await basicSeed(sc)
|
|
37
36
|
alice = sc.dids.alice
|
|
38
37
|
carol = sc.dids.carol
|
|
@@ -226,8 +225,10 @@ describe('pds views with blocking', () => {
|
|
|
226
225
|
{ headers: await network.serviceHeaders(carol) },
|
|
227
226
|
)
|
|
228
227
|
expect(resCarol.data.profiles[0].viewer?.blocking).toBeUndefined()
|
|
228
|
+
expect(resCarol.data.profiles[0].viewer?.blockingByList).toBeUndefined()
|
|
229
229
|
expect(resCarol.data.profiles[0].viewer?.blockedBy).toBe(false)
|
|
230
230
|
expect(resCarol.data.profiles[1].viewer?.blocking).toBeUndefined()
|
|
231
|
+
expect(resCarol.data.profiles[1].viewer?.blockingByList).toBeUndefined()
|
|
231
232
|
expect(resCarol.data.profiles[1].viewer?.blockedBy).toBe(true)
|
|
232
233
|
|
|
233
234
|
const resDan = await agent.api.app.bsky.actor.getProfiles(
|
|
@@ -235,8 +236,10 @@ describe('pds views with blocking', () => {
|
|
|
235
236
|
{ headers: await network.serviceHeaders(dan) },
|
|
236
237
|
)
|
|
237
238
|
expect(resDan.data.profiles[0].viewer?.blocking).toBeUndefined()
|
|
239
|
+
expect(resDan.data.profiles[0].viewer?.blockingByList).toBeUndefined()
|
|
238
240
|
expect(resDan.data.profiles[0].viewer?.blockedBy).toBe(false)
|
|
239
241
|
expect(resDan.data.profiles[1].viewer?.blocking).toBeDefined()
|
|
242
|
+
expect(resDan.data.profiles[1].viewer?.blockingByList).toBeUndefined()
|
|
240
243
|
expect(resDan.data.profiles[1].viewer?.blockedBy).toBe(false)
|
|
241
244
|
})
|
|
242
245
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot, paginateAll, stripViewer } from '../_util'
|
|
4
|
-
import { SeedClient } from '../seeds/client'
|
|
5
4
|
import followsSeed from '../seeds/follows'
|
|
6
5
|
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
7
6
|
|
|
@@ -18,8 +17,7 @@ describe('pds follow views', () => {
|
|
|
18
17
|
dbPostgresSchema: 'bsky_views_follows',
|
|
19
18
|
})
|
|
20
19
|
agent = network.bsky.getClient()
|
|
21
|
-
|
|
22
|
-
sc = new SeedClient(pdsAgent)
|
|
20
|
+
sc = network.getSeedClient()
|
|
23
21
|
await followsSeed(sc)
|
|
24
22
|
await network.processAll()
|
|
25
23
|
await network.bsky.processAll()
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
3
|
-
import { SeedClient } from '../seeds/client'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
4
3
|
import likesSeed from '../seeds/likes'
|
|
5
4
|
import { constantDate, forSnapshot, paginateAll, stripViewer } from '../_util'
|
|
6
5
|
|
|
7
6
|
describe('pds like views', () => {
|
|
8
7
|
let network: TestNetwork
|
|
9
8
|
let agent: AtpAgent
|
|
10
|
-
let pdsAgent: AtpAgent
|
|
11
9
|
let sc: SeedClient
|
|
12
10
|
|
|
13
11
|
// account dids, for convenience
|
|
@@ -19,8 +17,7 @@ describe('pds like views', () => {
|
|
|
19
17
|
dbPostgresSchema: 'bsky_views_likes',
|
|
20
18
|
})
|
|
21
19
|
agent = network.bsky.getClient()
|
|
22
|
-
|
|
23
|
-
sc = new SeedClient(pdsAgent)
|
|
20
|
+
sc = network.getSeedClient()
|
|
24
21
|
await likesSeed(sc)
|
|
25
22
|
await network.processAll()
|
|
26
23
|
alice = sc.dids.alice
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient, RecordRef } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot, paginateAll, stripViewerFromPost } from '../_util'
|
|
4
|
-
import { RecordRef, SeedClient } from '../seeds/client'
|
|
5
4
|
import basicSeed from '../seeds/basic'
|
|
6
5
|
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
7
6
|
|
|
@@ -22,8 +21,7 @@ describe('list feed views', () => {
|
|
|
22
21
|
dbPostgresSchema: 'bsky_views_list_feed',
|
|
23
22
|
})
|
|
24
23
|
agent = network.bsky.getClient()
|
|
25
|
-
|
|
26
|
-
sc = new SeedClient(pdsAgent)
|
|
24
|
+
sc = network.getSeedClient()
|
|
27
25
|
await basicSeed(sc)
|
|
28
26
|
alice = sc.dids.alice
|
|
29
27
|
bob = sc.dids.bob
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AtpAgent, { AtUri } from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient, RecordRef } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot } from '../_util'
|
|
4
|
-
import { RecordRef, SeedClient } from '../seeds/client'
|
|
5
4
|
import basicSeed from '../seeds/basic'
|
|
6
5
|
|
|
7
6
|
describe('bsky views with mutes from mute lists', () => {
|
|
@@ -21,7 +20,7 @@ describe('bsky views with mutes from mute lists', () => {
|
|
|
21
20
|
})
|
|
22
21
|
agent = network.bsky.getClient()
|
|
23
22
|
pdsAgent = network.pds.getClient()
|
|
24
|
-
sc =
|
|
23
|
+
sc = network.getSeedClient()
|
|
25
24
|
await basicSeed(sc)
|
|
26
25
|
alice = sc.dids.alice
|
|
27
26
|
bob = sc.dids.bob
|
|
@@ -43,7 +42,7 @@ describe('bsky views with mutes from mute lists', () => {
|
|
|
43
42
|
it('creates a list with some items', async () => {
|
|
44
43
|
const avatar = await sc.uploadFile(
|
|
45
44
|
alice,
|
|
46
|
-
'tests/
|
|
45
|
+
'tests/sample-img/key-portrait-small.jpg',
|
|
47
46
|
'image/jpeg',
|
|
48
47
|
)
|
|
49
48
|
// alice creates mute list with bob & carol that dan uses
|
|
@@ -80,6 +79,16 @@ describe('bsky views with mutes from mute lists', () => {
|
|
|
80
79
|
},
|
|
81
80
|
sc.getHeaders(alice),
|
|
82
81
|
)
|
|
82
|
+
await pdsAgent.api.app.bsky.graph.listitem.create(
|
|
83
|
+
{ repo: alice },
|
|
84
|
+
{
|
|
85
|
+
subject: sc.dids.dan,
|
|
86
|
+
list: list.uri,
|
|
87
|
+
reason: 'idk',
|
|
88
|
+
createdAt: new Date().toISOString(),
|
|
89
|
+
},
|
|
90
|
+
sc.getHeaders(alice),
|
|
91
|
+
)
|
|
83
92
|
await network.processAll()
|
|
84
93
|
})
|
|
85
94
|
|
|
@@ -161,6 +170,15 @@ describe('bsky views with mutes from mute lists', () => {
|
|
|
161
170
|
expect(res.data.profiles[1].viewer?.mutedByList?.uri).toEqual(listUri)
|
|
162
171
|
})
|
|
163
172
|
|
|
173
|
+
it('ignores self-mutes', async () => {
|
|
174
|
+
const res = await agent.api.app.bsky.actor.getProfile(
|
|
175
|
+
{ actor: dan }, // dan subscribes to list that contains himself
|
|
176
|
+
{ headers: await network.serviceHeaders(dan) },
|
|
177
|
+
)
|
|
178
|
+
expect(res.data.viewer?.muted).toBe(false)
|
|
179
|
+
expect(res.data.viewer?.mutedByList).toBeUndefined()
|
|
180
|
+
})
|
|
181
|
+
|
|
164
182
|
it('does not return notifs for muted accounts', async () => {
|
|
165
183
|
const res = await agent.api.app.bsky.notification.listNotifications(
|
|
166
184
|
{
|
|
@@ -343,7 +361,7 @@ describe('bsky views with mutes from mute lists', () => {
|
|
|
343
361
|
expect(got.data.list.name).toBe('updated alice mutes')
|
|
344
362
|
expect(got.data.list.description).toBe('new descript')
|
|
345
363
|
expect(got.data.list.avatar).toBeUndefined()
|
|
346
|
-
expect(got.data.items.length).toBe(
|
|
364
|
+
expect(got.data.items.length).toBe(3)
|
|
347
365
|
})
|
|
348
366
|
|
|
349
367
|
it('embeds lists in posts', async () => {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot, paginateAll } from '../_util'
|
|
4
|
-
import { SeedClient } from '../seeds/client'
|
|
5
4
|
import basicSeed from '../seeds/basic'
|
|
6
5
|
import usersBulkSeed from '../seeds/users-bulk'
|
|
7
6
|
|
|
8
7
|
describe('mute views', () => {
|
|
9
8
|
let network: TestNetwork
|
|
10
9
|
let agent: AtpAgent
|
|
11
|
-
let pdsAgent: AtpAgent
|
|
12
10
|
let sc: SeedClient
|
|
13
11
|
let alice: string
|
|
14
12
|
let bob: string
|
|
@@ -22,8 +20,7 @@ describe('mute views', () => {
|
|
|
22
20
|
dbPostgresSchema: 'bsky_views_mutes',
|
|
23
21
|
})
|
|
24
22
|
agent = network.bsky.getClient()
|
|
25
|
-
|
|
26
|
-
sc = new SeedClient(pdsAgent)
|
|
23
|
+
sc = network.getSeedClient()
|
|
27
24
|
await basicSeed(sc)
|
|
28
25
|
await usersBulkSeed(sc, 10)
|
|
29
26
|
alice = sc.dids.alice
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
4
4
|
import { forSnapshot, paginateAll } from '../_util'
|
|
5
|
-
import { SeedClient } from '../seeds/client'
|
|
6
5
|
import basicSeed from '../seeds/basic'
|
|
7
6
|
import { Notification } from '../../src/lexicon/types/app/bsky/notification/listNotifications'
|
|
8
7
|
|
|
@@ -19,8 +18,7 @@ describe('notification views', () => {
|
|
|
19
18
|
dbPostgresSchema: 'bsky_views_notifications',
|
|
20
19
|
})
|
|
21
20
|
agent = network.bsky.getClient()
|
|
22
|
-
|
|
23
|
-
sc = new SeedClient(pdsAgent)
|
|
21
|
+
sc = network.getSeedClient()
|
|
24
22
|
await basicSeed(sc)
|
|
25
23
|
await network.processAll()
|
|
26
24
|
await network.bsky.processAll()
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AtpAgent, { AppBskyFeedPost } from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot, stripViewerFromPost } from '../_util'
|
|
4
|
-
import { SeedClient } from '../seeds/client'
|
|
5
4
|
import basicSeed from '../seeds/basic'
|
|
6
5
|
|
|
7
6
|
describe('pds posts views', () => {
|
|
@@ -16,10 +15,9 @@ describe('pds posts views', () => {
|
|
|
16
15
|
})
|
|
17
16
|
agent = network.bsky.getClient()
|
|
18
17
|
pdsAgent = network.pds.getClient()
|
|
19
|
-
sc =
|
|
18
|
+
sc = network.getSeedClient()
|
|
20
19
|
await basicSeed(sc)
|
|
21
20
|
await network.processAll()
|
|
22
|
-
await network.bsky.processAll()
|
|
23
21
|
})
|
|
24
22
|
|
|
25
23
|
afterAll(async () => {
|
|
@@ -99,7 +97,6 @@ describe('pds posts views', () => {
|
|
|
99
97
|
)
|
|
100
98
|
|
|
101
99
|
await network.processAll()
|
|
102
|
-
await network.bsky.processAll()
|
|
103
100
|
|
|
104
101
|
const { data } = await agent.api.app.bsky.feed.getPosts({ uris: [uri] })
|
|
105
102
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import fs from 'fs/promises'
|
|
2
2
|
import AtpAgent from '@atproto/api'
|
|
3
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
3
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
4
4
|
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
5
5
|
import { forSnapshot, stripViewer } from '../_util'
|
|
6
6
|
import { ids } from '../../src/lexicon/lexicons'
|
|
7
|
-
import { SeedClient } from '../seeds/client'
|
|
8
7
|
import basicSeed from '../seeds/basic'
|
|
9
8
|
|
|
10
9
|
describe('pds profile views', () => {
|
|
@@ -24,7 +23,7 @@ describe('pds profile views', () => {
|
|
|
24
23
|
})
|
|
25
24
|
agent = network.bsky.getClient()
|
|
26
25
|
pdsAgent = network.pds.getClient()
|
|
27
|
-
sc =
|
|
26
|
+
sc = network.getSeedClient()
|
|
28
27
|
await basicSeed(sc)
|
|
29
28
|
await network.processAll()
|
|
30
29
|
await network.bsky.processAll()
|
|
@@ -109,10 +108,10 @@ describe('pds profile views', () => {
|
|
|
109
108
|
|
|
110
109
|
it('presents avatars & banners', async () => {
|
|
111
110
|
const avatarImg = await fs.readFile(
|
|
112
|
-
'tests/
|
|
111
|
+
'tests/sample-img/key-portrait-small.jpg',
|
|
113
112
|
)
|
|
114
113
|
const bannerImg = await fs.readFile(
|
|
115
|
-
'tests/
|
|
114
|
+
'tests/sample-img/key-landscape-small.jpg',
|
|
116
115
|
)
|
|
117
116
|
const avatarRes = await pdsAgent.api.com.atproto.repo.uploadBlob(
|
|
118
117
|
avatarImg,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot, paginateAll, stripViewer } from '../_util'
|
|
4
|
-
import { SeedClient } from '../seeds/client'
|
|
5
4
|
import repostsSeed from '../seeds/reposts'
|
|
6
5
|
|
|
7
6
|
describe('pds repost views', () => {
|
|
@@ -18,8 +17,7 @@ describe('pds repost views', () => {
|
|
|
18
17
|
dbPostgresSchema: 'bsky_views_reposts',
|
|
19
18
|
})
|
|
20
19
|
agent = network.bsky.getClient()
|
|
21
|
-
|
|
22
|
-
sc = new SeedClient(pdsAgent)
|
|
20
|
+
sc = network.getSeedClient()
|
|
23
21
|
await repostsSeed(sc)
|
|
24
22
|
await network.processAll()
|
|
25
23
|
alice = sc.dids.alice
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import AtpAgent, { AtUri } from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
3
|
-
import { SeedClient } from '../seeds/client'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
4
3
|
import likesSeed from '../seeds/likes'
|
|
5
4
|
|
|
6
5
|
describe('suggested follows', () => {
|
|
@@ -15,7 +14,7 @@ describe('suggested follows', () => {
|
|
|
15
14
|
})
|
|
16
15
|
agent = network.bsky.getClient()
|
|
17
16
|
pdsAgent = network.pds.getClient()
|
|
18
|
-
sc =
|
|
17
|
+
sc = network.getSeedClient()
|
|
19
18
|
await likesSeed(sc)
|
|
20
19
|
await network.processAll()
|
|
21
20
|
await network.bsky.processAll()
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { stripViewer } from '../_util'
|
|
4
|
-
import { SeedClient } from '../seeds/client'
|
|
5
4
|
import basicSeed from '../seeds/basic'
|
|
6
5
|
|
|
7
6
|
describe('pds user search views', () => {
|
|
@@ -14,8 +13,7 @@ describe('pds user search views', () => {
|
|
|
14
13
|
dbPostgresSchema: 'bsky_views_suggestions',
|
|
15
14
|
})
|
|
16
15
|
agent = network.bsky.getClient()
|
|
17
|
-
|
|
18
|
-
sc = new SeedClient(pdsAgent)
|
|
16
|
+
sc = network.getSeedClient()
|
|
19
17
|
await basicSeed(sc)
|
|
20
18
|
await network.processAll()
|
|
21
19
|
await network.bsky.processAll()
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import AtpAgent, { AppBskyFeedGetPostThread } from '@atproto/api'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
4
4
|
import { forSnapshot, stripViewerFromThread } from '../_util'
|
|
5
|
-
import { SeedClient } from '../seeds/client'
|
|
6
5
|
import basicSeed from '../seeds/basic'
|
|
7
6
|
import assert from 'assert'
|
|
8
7
|
import { isThreadViewPost } from '@atproto/api/src/client/types/app/bsky/feed/defs'
|
|
@@ -22,8 +21,7 @@ describe('pds thread views', () => {
|
|
|
22
21
|
dbPostgresSchema: 'bsky_views_thread',
|
|
23
22
|
})
|
|
24
23
|
agent = network.bsky.getClient()
|
|
25
|
-
|
|
26
|
-
sc = new SeedClient(pdsAgent)
|
|
24
|
+
sc = network.getSeedClient()
|
|
27
25
|
await basicSeed(sc)
|
|
28
26
|
alice = sc.dids.alice
|
|
29
27
|
bob = sc.dids.bob
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import assert from 'assert'
|
|
2
2
|
import AtpAgent from '@atproto/api'
|
|
3
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
3
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
4
4
|
import {
|
|
5
5
|
isNotFoundPost,
|
|
6
6
|
isThreadViewPost,
|
|
7
7
|
} from '../../src/lexicon/types/app/bsky/feed/defs'
|
|
8
|
-
import { SeedClient } from '../seeds/client'
|
|
9
8
|
import basicSeed from '../seeds/basic'
|
|
10
9
|
import { forSnapshot } from '../_util'
|
|
11
10
|
|
|
@@ -21,7 +20,7 @@ describe('views with thread gating', () => {
|
|
|
21
20
|
})
|
|
22
21
|
agent = network.bsky.getClient()
|
|
23
22
|
pdsAgent = network.pds.getClient()
|
|
24
|
-
sc =
|
|
23
|
+
sc = network.getSeedClient()
|
|
25
24
|
await basicSeed(sc)
|
|
26
25
|
await network.processAll()
|
|
27
26
|
})
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import assert from 'assert'
|
|
2
2
|
import AtpAgent from '@atproto/api'
|
|
3
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
3
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
4
4
|
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
5
5
|
import { forSnapshot, getOriginator, paginateAll } from '../_util'
|
|
6
|
-
import { SeedClient } from '../seeds/client'
|
|
7
6
|
import basicSeed from '../seeds/basic'
|
|
8
7
|
import { FeedAlgorithm } from '../../src/api/app/bsky/util/feed'
|
|
9
8
|
import { FeedViewPost } from '../../src/lexicon/types/app/bsky/feed/defs'
|
|
@@ -24,8 +23,7 @@ describe('timeline views', () => {
|
|
|
24
23
|
dbPostgresSchema: 'bsky_views_home_feed',
|
|
25
24
|
})
|
|
26
25
|
agent = network.bsky.getClient()
|
|
27
|
-
|
|
28
|
-
sc = new SeedClient(pdsAgent)
|
|
26
|
+
sc = network.getSeedClient()
|
|
29
27
|
await basicSeed(sc)
|
|
30
28
|
await network.processAll()
|
|
31
29
|
alice = sc.dids.alice
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022-2023 Bluesky PBC
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/example.dev.env
DELETED
package/src/env.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// NOTE: this file should be imported first, particularly before `@atproto/common` (for logging), to ensure that environment variables are respected in library code
|
|
2
|
-
import dotenv from 'dotenv'
|
|
3
|
-
|
|
4
|
-
const env = process.env.ENV
|
|
5
|
-
if (env) {
|
|
6
|
-
dotenv.config({ path: `./.${env}.env` })
|
|
7
|
-
} else {
|
|
8
|
-
dotenv.config()
|
|
9
|
-
}
|