@atproto/bsky 0.0.11 → 0.0.12
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 +13 -0
- 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 +1381 -530
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +8 -0
- package/dist/lexicon/lexicons.d.ts +231 -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 +2 -0
- 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 +30 -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 +13 -14
- 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 +246 -4
- 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 +2 -0
- 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 +44 -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/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,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { AtUri, BlobRef } from '@atproto/api'
|
|
2
3
|
import { Readable } from 'stream'
|
|
3
4
|
import { AutoModerator } from '../../src/auto-moderator'
|
|
4
5
|
import IndexerContext from '../../src/indexer/context'
|
|
5
6
|
import { cidForRecord } from '@atproto/repo'
|
|
6
|
-
import {
|
|
7
|
+
import { TID } from '@atproto/common'
|
|
7
8
|
import { LabelService } from '../../src/services/label'
|
|
8
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
9
|
-
import { SeedClient } from '../seeds/client'
|
|
10
9
|
import usersSeed from '../seeds/users'
|
|
11
10
|
import { CID } from 'multiformats/cid'
|
|
12
11
|
import { ImgLabeler } from '../../src/auto-moderator/hive'
|
|
@@ -37,8 +36,7 @@ describe('labeler', () => {
|
|
|
37
36
|
autoMod = ctx.autoMod
|
|
38
37
|
autoMod.imgLabeler = new TestImgLabeler()
|
|
39
38
|
labelSrvc = ctx.services.label(ctx.db)
|
|
40
|
-
const
|
|
41
|
-
const sc = new SeedClient(pdsAgent)
|
|
39
|
+
const sc = network.getSeedClient()
|
|
42
40
|
await usersSeed(sc)
|
|
43
41
|
await network.processAll()
|
|
44
42
|
alice = sc.dids.alice
|
|
@@ -58,7 +56,7 @@ describe('labeler', () => {
|
|
|
58
56
|
await repoSvc.blobs.associateBlob(
|
|
59
57
|
preparedBlobRef,
|
|
60
58
|
postUri(),
|
|
61
|
-
|
|
59
|
+
TID.nextStr(),
|
|
62
60
|
alice,
|
|
63
61
|
)
|
|
64
62
|
return blobRef
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import fs from 'fs/promises'
|
|
2
|
+
import { TestNetwork, SeedClient, ImageRef } from '@atproto/dev-env'
|
|
2
3
|
import { AtpAgent } from '@atproto/api'
|
|
3
4
|
import { AutoModerator } from '../../src/auto-moderator'
|
|
4
5
|
import IndexerContext from '../../src/indexer/context'
|
|
5
6
|
import { sha256RawToCid } from '@atproto/common'
|
|
6
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
7
|
-
import { ImageRef, SeedClient } from '../seeds/client'
|
|
8
7
|
import usersSeed from '../seeds/users'
|
|
9
8
|
import { CID } from 'multiformats/cid'
|
|
10
9
|
import { AtUri } from '@atproto/syntax'
|
|
@@ -41,31 +40,31 @@ describe('takedowner', () => {
|
|
|
41
40
|
autoMod = ctx.autoMod
|
|
42
41
|
autoMod.imageFlagger = new TestFlagger()
|
|
43
42
|
pdsAgent = new AtpAgent({ service: network.pds.url })
|
|
44
|
-
sc =
|
|
43
|
+
sc = network.getSeedClient()
|
|
45
44
|
await usersSeed(sc)
|
|
46
45
|
await network.processAll()
|
|
47
46
|
alice = sc.dids.alice
|
|
48
47
|
const fileBytes1 = await fs.readFile(
|
|
49
|
-
'tests/
|
|
48
|
+
'tests/sample-img/key-portrait-small.jpg',
|
|
50
49
|
)
|
|
51
50
|
const fileBytes2 = await fs.readFile(
|
|
52
|
-
'tests/
|
|
51
|
+
'tests/sample-img/key-portrait-large.jpg',
|
|
53
52
|
)
|
|
54
53
|
badCid1 = sha256RawToCid(await sha256(fileBytes1))
|
|
55
54
|
badCid2 = sha256RawToCid(await sha256(fileBytes2))
|
|
56
55
|
goodBlob = await sc.uploadFile(
|
|
57
56
|
alice,
|
|
58
|
-
'tests/
|
|
57
|
+
'tests/sample-img/key-landscape-small.jpg',
|
|
59
58
|
'image/jpeg',
|
|
60
59
|
)
|
|
61
60
|
badBlob1 = await sc.uploadFile(
|
|
62
61
|
alice,
|
|
63
|
-
'tests/
|
|
62
|
+
'tests/sample-img/key-portrait-small.jpg',
|
|
64
63
|
'image/jpeg',
|
|
65
64
|
)
|
|
66
65
|
badBlob2 = await sc.uploadFile(
|
|
67
66
|
alice,
|
|
68
|
-
'tests/
|
|
67
|
+
'tests/sample-img/key-portrait-large.jpg',
|
|
69
68
|
'image/jpeg',
|
|
70
69
|
)
|
|
71
70
|
})
|
|
@@ -97,9 +96,9 @@ describe('takedowner', () => {
|
|
|
97
96
|
const recordPds = await network.pds.ctx.db.db
|
|
98
97
|
.selectFrom('record')
|
|
99
98
|
.where('uri', '=', post.ref.uriStr)
|
|
100
|
-
.select('
|
|
99
|
+
.select('takedownRef')
|
|
101
100
|
.executeTakeFirst()
|
|
102
|
-
expect(recordPds?.
|
|
101
|
+
expect(recordPds?.takedownRef).toEqual(modAction.id.toString())
|
|
103
102
|
|
|
104
103
|
expect(testInvalidator.invalidated.length).toBe(1)
|
|
105
104
|
expect(testInvalidator.invalidated[0].subject).toBe(
|
|
@@ -139,9 +138,9 @@ describe('takedowner', () => {
|
|
|
139
138
|
const recordPds = await network.pds.ctx.db.db
|
|
140
139
|
.selectFrom('record')
|
|
141
140
|
.where('uri', '=', res.data.uri)
|
|
142
|
-
.select('
|
|
141
|
+
.select('takedownRef')
|
|
143
142
|
.executeTakeFirst()
|
|
144
|
-
expect(recordPds?.
|
|
143
|
+
expect(recordPds?.takedownRef).toEqual(modAction.id.toString())
|
|
145
144
|
|
|
146
145
|
expect(testInvalidator.invalidated.length).toBe(2)
|
|
147
146
|
expect(testInvalidator.invalidated[1].subject).toBe(
|
|
@@ -2,7 +2,6 @@ import axios, { AxiosInstance } from 'axios'
|
|
|
2
2
|
import { CID } from 'multiformats/cid'
|
|
3
3
|
import { verifyCidForBytes } from '@atproto/common'
|
|
4
4
|
import { TestNetwork } from '@atproto/dev-env'
|
|
5
|
-
import { SeedClient } from './seeds/client'
|
|
6
5
|
import basicSeed from './seeds/basic'
|
|
7
6
|
import { randomBytes } from '@atproto/crypto'
|
|
8
7
|
|
|
@@ -16,8 +15,7 @@ describe('blob resolver', () => {
|
|
|
16
15
|
network = await TestNetwork.create({
|
|
17
16
|
dbPostgresSchema: 'bsky_blob_resolver',
|
|
18
17
|
})
|
|
19
|
-
const
|
|
20
|
-
const sc = new SeedClient(pdsAgent)
|
|
18
|
+
const sc = network.getSeedClient()
|
|
21
19
|
await basicSeed(sc)
|
|
22
20
|
await network.processAll()
|
|
23
21
|
await network.bsky.processAll()
|
package/tests/did-cache.test.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
3
|
-
import { SeedClient } from './seeds/client'
|
|
1
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
4
2
|
import userSeed from './seeds/users'
|
|
5
3
|
import { IdResolver } from '@atproto/identity'
|
|
6
4
|
import DidSqlCache from '../src/did-cache'
|
|
@@ -23,8 +21,7 @@ describe('did cache', () => {
|
|
|
23
21
|
})
|
|
24
22
|
idResolver = network.bsky.indexer.ctx.idResolver
|
|
25
23
|
didCache = network.bsky.indexer.ctx.didCache
|
|
26
|
-
|
|
27
|
-
sc = new SeedClient(pdsAgent)
|
|
24
|
+
sc = network.getSeedClient()
|
|
28
25
|
await userSeed(sc)
|
|
29
26
|
await network.processAll()
|
|
30
27
|
alice = sc.dids.alice
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { TID } from '@atproto/common'
|
|
2
2
|
import { AtUri, AtpAgent } from '@atproto/api'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
TestNetwork,
|
|
5
|
+
TestFeedGen,
|
|
6
|
+
SeedClient,
|
|
7
|
+
RecordRef,
|
|
8
|
+
} from '@atproto/dev-env'
|
|
9
|
+
import { Handler as SkeletonHandler } from '../src/lexicon/types/app/bsky/feed/getFeedSkeleton'
|
|
6
10
|
import { GeneratorView } from '@atproto/api/src/client/types/app/bsky/feed/defs'
|
|
7
11
|
import { UnknownFeedError } from '@atproto/api/src/client/types/app/bsky/feed/getFeed'
|
|
8
12
|
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
@@ -11,9 +15,7 @@ import {
|
|
|
11
15
|
FeedViewPost,
|
|
12
16
|
SkeletonFeedPost,
|
|
13
17
|
} from '../src/lexicon/types/app/bsky/feed/defs'
|
|
14
|
-
import { SeedClient } from './seeds/client'
|
|
15
18
|
import basicSeed from './seeds/basic'
|
|
16
|
-
import { RecordRef } from './seeds/client'
|
|
17
19
|
import { forSnapshot, paginateAll } from './_util'
|
|
18
20
|
|
|
19
21
|
describe('feed generation', () => {
|
|
@@ -38,7 +40,7 @@ describe('feed generation', () => {
|
|
|
38
40
|
})
|
|
39
41
|
agent = network.bsky.getClient()
|
|
40
42
|
pdsAgent = network.pds.getClient()
|
|
41
|
-
sc =
|
|
43
|
+
sc = network.getSeedClient()
|
|
42
44
|
await basicSeed(sc)
|
|
43
45
|
await network.processAll()
|
|
44
46
|
alice = sc.dids.alice
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DAY } from '@atproto/common'
|
|
2
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { AtpAgent } from '@atproto/api'
|
|
4
|
-
import { SeedClient } from './seeds/client'
|
|
5
4
|
import userSeed from './seeds/users'
|
|
6
5
|
|
|
7
6
|
describe('handle invalidation', () => {
|
|
@@ -20,7 +19,7 @@ describe('handle invalidation', () => {
|
|
|
20
19
|
})
|
|
21
20
|
agent = network.bsky.getClient()
|
|
22
21
|
pdsAgent = network.pds.getClient()
|
|
23
|
-
sc =
|
|
22
|
+
sc = network.getSeedClient()
|
|
24
23
|
await userSeed(sc)
|
|
25
24
|
await network.processAll()
|
|
26
25
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import axios, { AxiosInstance } from 'axios'
|
|
2
2
|
import { CID } from 'multiformats/cid'
|
|
3
|
-
import { AtpAgent } from '@atproto/api'
|
|
4
3
|
import { cidForCbor } from '@atproto/common'
|
|
5
4
|
import { TestNetwork } from '@atproto/dev-env'
|
|
6
5
|
import { getInfo } from '../../src/image/sharp'
|
|
7
|
-
import { SeedClient } from '../seeds/client'
|
|
8
6
|
import basicSeed from '../seeds/basic'
|
|
9
7
|
import { ImageUriBuilder } from '../../src/image/uri'
|
|
10
8
|
|
|
@@ -18,8 +16,7 @@ describe('image processing server', () => {
|
|
|
18
16
|
network = await TestNetwork.create({
|
|
19
17
|
dbPostgresSchema: 'bsky_image_processing_server',
|
|
20
18
|
})
|
|
21
|
-
const
|
|
22
|
-
const sc = new SeedClient(pdsAgent)
|
|
19
|
+
const sc = network.getSeedClient()
|
|
23
20
|
await basicSeed(sc)
|
|
24
21
|
await network.processAll()
|
|
25
22
|
await network.bsky.processAll()
|
|
@@ -178,7 +178,7 @@ describe('sharp image processor', () => {
|
|
|
178
178
|
})
|
|
179
179
|
|
|
180
180
|
async function processFixture(fixture: string, options: Options) {
|
|
181
|
-
const image = createReadStream(
|
|
181
|
+
const image = createReadStream(`tests/sample-img/${fixture}`)
|
|
182
182
|
const resized = await resize(image, options)
|
|
183
183
|
return await getInfo(resized)
|
|
184
184
|
}
|
package/tests/indexing.test.ts
CHANGED
|
@@ -11,9 +11,8 @@ import AtpAgent, {
|
|
|
11
11
|
AppBskyFeedRepost,
|
|
12
12
|
AppBskyGraphFollow,
|
|
13
13
|
} from '@atproto/api'
|
|
14
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
14
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
15
15
|
import { forSnapshot } from './_util'
|
|
16
|
-
import { SeedClient } from './seeds/client'
|
|
17
16
|
import usersSeed from './seeds/users'
|
|
18
17
|
import basicSeed from './seeds/basic'
|
|
19
18
|
import { ids } from '../src/lexicon/lexicons'
|
|
@@ -31,7 +30,7 @@ describe('indexing', () => {
|
|
|
31
30
|
})
|
|
32
31
|
agent = network.bsky.getClient()
|
|
33
32
|
pdsAgent = network.pds.getClient()
|
|
34
|
-
sc =
|
|
33
|
+
sc = network.getSeedClient()
|
|
35
34
|
await usersSeed(sc)
|
|
36
35
|
// Data in tests is not processed from subscription
|
|
37
36
|
await network.processAll()
|
|
@@ -648,8 +647,9 @@ describe('indexing', () => {
|
|
|
648
647
|
headers: sc.getHeaders(alice),
|
|
649
648
|
})
|
|
650
649
|
const { token } = await network.pds.ctx.db.db
|
|
651
|
-
.selectFrom('
|
|
650
|
+
.selectFrom('email_token')
|
|
652
651
|
.selectAll()
|
|
652
|
+
.where('purpose', '=', 'delete_account')
|
|
653
653
|
.where('did', '=', alice)
|
|
654
654
|
.executeTakeFirstOrThrow()
|
|
655
655
|
await pdsAgent.api.com.atproto.server.deleteAccount({
|
|
@@ -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 basicSeed from './seeds/basic'
|
|
5
4
|
import { NotificationServer } from '../src/notifications'
|
|
6
5
|
import { Database } from '../src'
|
|
@@ -21,7 +20,7 @@ describe('notification server', () => {
|
|
|
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
|
await network.bsky.processAll()
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
getIndexers,
|
|
6
6
|
getIngester,
|
|
7
7
|
processAll,
|
|
8
|
+
SeedClient,
|
|
8
9
|
} from '@atproto/dev-env'
|
|
9
|
-
import { SeedClient } from '../seeds/client'
|
|
10
10
|
import basicSeed from '../seeds/basic'
|
|
11
11
|
import { BskyIngester } from '../../src'
|
|
12
12
|
|
|
@@ -33,8 +33,7 @@ describe('pipeline backpressure', () => {
|
|
|
33
33
|
name: TEST_NAME,
|
|
34
34
|
partitionIdsByIndexer: [[0], [1]],
|
|
35
35
|
})
|
|
36
|
-
|
|
37
|
-
sc = new SeedClient(pdsAgent)
|
|
36
|
+
sc = network.getSeedClient()
|
|
38
37
|
await basicSeed(sc)
|
|
39
38
|
})
|
|
40
39
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
TestNetworkNoAppView,
|
|
3
|
+
SeedClient,
|
|
4
|
+
getIngester,
|
|
5
|
+
ingestAll,
|
|
6
|
+
} from '@atproto/dev-env'
|
|
3
7
|
import basicSeed from '../seeds/basic'
|
|
4
8
|
import { BskyIngester } from '../../src'
|
|
5
9
|
|
|
@@ -18,8 +22,7 @@ describe('pipeline reingestion', () => {
|
|
|
18
22
|
name: TEST_NAME,
|
|
19
23
|
ingesterPartitionCount: 1,
|
|
20
24
|
})
|
|
21
|
-
|
|
22
|
-
sc = new SeedClient(pdsAgent)
|
|
25
|
+
sc = network.getSeedClient()
|
|
23
26
|
await basicSeed(sc)
|
|
24
27
|
})
|
|
25
28
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BskyIndexers,
|
|
3
3
|
TestNetworkNoAppView,
|
|
4
|
+
SeedClient,
|
|
4
5
|
getIndexers,
|
|
5
6
|
getIngester,
|
|
6
7
|
ingestAll,
|
|
7
8
|
processAll,
|
|
8
9
|
} from '@atproto/dev-env'
|
|
9
|
-
import { SeedClient } from '../seeds/client'
|
|
10
10
|
import usersSeed from '../seeds/users'
|
|
11
11
|
import { BskyIngester } from '../../src'
|
|
12
12
|
import { countAll } from '../../src/db/util'
|
|
@@ -36,8 +36,7 @@ describe('pipeline indexer repartitioning', () => {
|
|
|
36
36
|
name: TEST_NAME,
|
|
37
37
|
partitionIdsByIndexer: [[0], [1]], // two indexers, each consuming one partition
|
|
38
38
|
})
|
|
39
|
-
|
|
40
|
-
sc = new SeedClient(pdsAgent)
|
|
39
|
+
sc = network.getSeedClient()
|
|
41
40
|
await usersSeed(sc)
|
|
42
41
|
})
|
|
43
42
|
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
2
|
import { AtUri } from '@atproto/syntax'
|
|
3
|
-
import
|
|
4
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
5
|
-
import { SeedClient } from './seeds/client'
|
|
3
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
6
4
|
import basicSeed from './seeds/basic'
|
|
7
5
|
import { Database } from '../src/db'
|
|
8
6
|
|
|
9
7
|
describe('reprocessing', () => {
|
|
10
8
|
let network: TestNetwork
|
|
11
|
-
let pdsAgent: AtpAgent
|
|
12
9
|
let sc: SeedClient
|
|
13
10
|
let alice: string
|
|
14
11
|
|
|
@@ -16,8 +13,7 @@ describe('reprocessing', () => {
|
|
|
16
13
|
network = await TestNetwork.create({
|
|
17
14
|
dbPostgresSchema: 'bsky_reprocessing',
|
|
18
15
|
})
|
|
19
|
-
|
|
20
|
-
sc = new SeedClient(pdsAgent)
|
|
16
|
+
sc = network.getSeedClient()
|
|
21
17
|
await basicSeed(sc)
|
|
22
18
|
alice = sc.dids.alice
|
|
23
19
|
await network.processAll()
|
package/tests/seeds/basic.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { SeedClient } from '@atproto/dev-env'
|
|
1
2
|
import { ids } from '../../src/lexicon/lexicons'
|
|
2
|
-
import { SeedClient } from './client'
|
|
3
3
|
import usersSeed from './users'
|
|
4
4
|
|
|
5
5
|
export default async (sc: SeedClient, users = true) => {
|
|
@@ -34,12 +34,12 @@ export default async (sc: SeedClient, users = true) => {
|
|
|
34
34
|
})
|
|
35
35
|
const img1 = await sc.uploadFile(
|
|
36
36
|
carol,
|
|
37
|
-
'tests/
|
|
37
|
+
'tests/sample-img/key-landscape-small.jpg',
|
|
38
38
|
'image/jpeg',
|
|
39
39
|
)
|
|
40
40
|
const img2 = await sc.uploadFile(
|
|
41
41
|
carol,
|
|
42
|
-
'tests/
|
|
42
|
+
'tests/sample-img/key-alt.jpg',
|
|
43
43
|
'image/jpeg',
|
|
44
44
|
)
|
|
45
45
|
await sc.post(
|
|
@@ -100,7 +100,7 @@ export default async (sc: SeedClient, users = true) => {
|
|
|
100
100
|
|
|
101
101
|
const replyImg = await sc.uploadFile(
|
|
102
102
|
bob,
|
|
103
|
-
'tests/
|
|
103
|
+
'tests/sample-img/key-landscape-small.jpg',
|
|
104
104
|
'image/jpeg',
|
|
105
105
|
)
|
|
106
106
|
await sc.reply(
|
package/tests/seeds/follows.ts
CHANGED
package/tests/seeds/likes.ts
CHANGED
package/tests/seeds/reposts.ts
CHANGED
package/tests/seeds/users.ts
CHANGED
package/tests/server.test.ts
CHANGED
|
@@ -4,7 +4,6 @@ import axios, { AxiosError } from 'axios'
|
|
|
4
4
|
import { TestNetwork } from '@atproto/dev-env'
|
|
5
5
|
import { handler as errorHandler } from '../src/error'
|
|
6
6
|
import { Database } from '../src'
|
|
7
|
-
import { SeedClient } from './seeds/client'
|
|
8
7
|
import basicSeed from './seeds/basic'
|
|
9
8
|
|
|
10
9
|
describe('server', () => {
|
|
@@ -16,8 +15,7 @@ describe('server', () => {
|
|
|
16
15
|
network = await TestNetwork.create({
|
|
17
16
|
dbPostgresSchema: 'bsky_server',
|
|
18
17
|
})
|
|
19
|
-
const
|
|
20
|
-
const sc = new SeedClient(pdsAgent)
|
|
18
|
+
const sc = network.getSeedClient()
|
|
21
19
|
await basicSeed(sc)
|
|
22
20
|
await network.processAll()
|
|
23
21
|
alice = sc.dids.alice
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
|
-
|
|
3
|
-
import { TestNetwork } from '@atproto/dev-env'
|
|
2
|
+
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
4
3
|
import { CommitData } from '@atproto/repo'
|
|
5
4
|
import { RepoService } from '@atproto/pds/src/services/repo'
|
|
6
5
|
import { PreparedWrite } from '@atproto/pds/src/repo'
|
|
@@ -11,7 +10,6 @@ import { ids } from '../../src/lexicon/lexicons'
|
|
|
11
10
|
import { forSnapshot } from '../_util'
|
|
12
11
|
import { AppContext, Database } from '../../src'
|
|
13
12
|
import basicSeed from '../seeds/basic'
|
|
14
|
-
import { SeedClient } from '../seeds/client'
|
|
15
13
|
|
|
16
14
|
describe('sync', () => {
|
|
17
15
|
let network: TestNetwork
|
|
@@ -25,7 +23,7 @@ describe('sync', () => {
|
|
|
25
23
|
})
|
|
26
24
|
ctx = network.bsky.ctx
|
|
27
25
|
pdsAgent = network.pds.getClient()
|
|
28
|
-
sc =
|
|
26
|
+
sc = network.getSeedClient()
|
|
29
27
|
await basicSeed(sc)
|
|
30
28
|
})
|
|
31
29
|
|