@atproto/bsky 0.0.64 → 0.0.66
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 +19 -0
- package/dist/api/app/bsky/actor/getSuggestions.js +1 -1
- package/dist/api/app/bsky/actor/getSuggestions.js.map +1 -1
- package/dist/api/app/bsky/actor/searchActors.js +1 -1
- package/dist/api/app/bsky/actor/searchActors.js.map +1 -1
- package/dist/api/app/bsky/feed/getPostThread.js +1 -10
- package/dist/api/app/bsky/feed/getPostThread.js.map +1 -1
- package/dist/api/app/bsky/feed/searchPosts.js +1 -1
- package/dist/api/app/bsky/feed/searchPosts.js.map +1 -1
- package/dist/api/app/bsky/graph/getActorStarterPacks.d.ts +4 -0
- package/dist/api/app/bsky/graph/getActorStarterPacks.d.ts.map +1 -0
- package/dist/api/app/bsky/graph/getActorStarterPacks.js +58 -0
- package/dist/api/app/bsky/graph/getActorStarterPacks.js.map +1 -0
- package/dist/api/app/bsky/graph/getStarterPack.d.ts +4 -0
- package/dist/api/app/bsky/graph/getStarterPack.d.ts.map +1 -0
- package/dist/api/app/bsky/graph/getStarterPack.js +45 -0
- package/dist/api/app/bsky/graph/getStarterPack.js.map +1 -0
- package/dist/api/app/bsky/graph/getStarterPacks.d.ts +4 -0
- package/dist/api/app/bsky/graph/getStarterPacks.d.ts.map +1 -0
- package/dist/api/app/bsky/graph/getStarterPacks.js +40 -0
- package/dist/api/app/bsky/graph/getStarterPacks.js.map +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +6 -0
- package/dist/api/index.js.map +1 -1
- package/dist/data-plane/server/db/database-schema.d.ts +2 -1
- package/dist/data-plane/server/db/database-schema.d.ts.map +1 -1
- package/dist/data-plane/server/db/migrations/20240606T222548219Z-starter-packs.d.ts +4 -0
- package/dist/data-plane/server/db/migrations/20240606T222548219Z-starter-packs.d.ts.map +1 -0
- package/dist/data-plane/server/db/migrations/20240606T222548219Z-starter-packs.js +47 -0
- package/dist/data-plane/server/db/migrations/20240606T222548219Z-starter-packs.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/profile.d.ts +2 -0
- package/dist/data-plane/server/db/tables/profile.d.ts.map +1 -1
- package/dist/data-plane/server/db/tables/starter-pack.d.ts +14 -0
- package/dist/data-plane/server/db/tables/starter-pack.d.ts.map +1 -0
- package/dist/data-plane/server/db/tables/starter-pack.js +5 -0
- package/dist/data-plane/server/db/tables/starter-pack.js.map +1 -0
- package/dist/data-plane/server/indexing/index.d.ts +2 -0
- package/dist/data-plane/server/indexing/index.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/index.js +2 -0
- package/dist/data-plane/server/indexing/index.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/profile.d.ts.map +1 -1
- package/dist/data-plane/server/indexing/plugins/profile.js +18 -2
- package/dist/data-plane/server/indexing/plugins/profile.js.map +1 -1
- package/dist/data-plane/server/indexing/plugins/starter-pack.d.ts +11 -0
- package/dist/data-plane/server/indexing/plugins/starter-pack.d.ts.map +1 -0
- package/dist/data-plane/server/indexing/plugins/starter-pack.js +78 -0
- package/dist/data-plane/server/indexing/plugins/starter-pack.js.map +1 -0
- package/dist/data-plane/server/routes/index.d.ts.map +1 -1
- package/dist/data-plane/server/routes/index.js +2 -0
- package/dist/data-plane/server/routes/index.js.map +1 -1
- package/dist/data-plane/server/routes/interactions.d.ts.map +1 -1
- package/dist/data-plane/server/routes/interactions.js +57 -1
- package/dist/data-plane/server/routes/interactions.js.map +1 -1
- package/dist/data-plane/server/routes/profile.d.ts.map +1 -1
- package/dist/data-plane/server/routes/profile.js +1 -0
- package/dist/data-plane/server/routes/profile.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/data-plane/server/routes/starter-packs.d.ts +6 -0
- package/dist/data-plane/server/routes/starter-packs.d.ts.map +1 -0
- package/dist/data-plane/server/routes/starter-packs.js +25 -0
- package/dist/data-plane/server/routes/starter-packs.js.map +1 -0
- package/dist/data-plane/server/util.d.ts +6 -6
- package/dist/hydration/actor.d.ts +2 -0
- package/dist/hydration/actor.d.ts.map +1 -1
- package/dist/hydration/actor.js +2 -0
- package/dist/hydration/actor.js.map +1 -1
- package/dist/hydration/feed.d.ts +1 -5
- package/dist/hydration/feed.d.ts.map +1 -1
- package/dist/hydration/feed.js +0 -1
- package/dist/hydration/feed.js.map +1 -1
- package/dist/hydration/graph.d.ts +17 -1
- package/dist/hydration/graph.d.ts.map +1 -1
- package/dist/hydration/graph.js +30 -1
- package/dist/hydration/graph.js.map +1 -1
- package/dist/hydration/hydrator.d.ts +9 -3
- package/dist/hydration/hydrator.d.ts.map +1 -1
- package/dist/hydration/hydrator.js +114 -5
- package/dist/hydration/hydrator.js.map +1 -1
- package/dist/hydration/util.d.ts +4 -0
- package/dist/hydration/util.d.ts.map +1 -1
- package/dist/hydration/util.js.map +1 -1
- package/dist/lexicon/index.d.ts +7 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +13 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +362 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +367 -2
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +22 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js +21 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/profile.d.ts +3 -0
- package/dist/lexicon/types/app/bsky/actor/profile.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/profile.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts +36 -1
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/defs.js +23 -1
- package/dist/lexicon/types/app/bsky/graph/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getActorStarterPacks.d.ts +39 -0
- package/dist/lexicon/types/app/bsky/graph/getActorStarterPacks.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/getActorStarterPacks.js +3 -0
- package/dist/lexicon/types/app/bsky/graph/getActorStarterPacks.js.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPack.d.ts +37 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPack.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPack.js +3 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPack.js.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPacks.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPacks.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPacks.js +3 -0
- package/dist/lexicon/types/app/bsky/graph/getStarterPacks.js.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/starterpack.d.ts +25 -0
- package/dist/lexicon/types/app/bsky/graph/starterpack.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/graph/starterpack.js +27 -0
- package/dist/lexicon/types/app/bsky/graph/starterpack.js.map +1 -0
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts +2 -2
- package/dist/lexicon/types/app/bsky/notification/listNotifications.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/notification/listNotifications.js.map +1 -1
- package/dist/proto/bsky_connect.d.ts +39 -1
- package/dist/proto/bsky_connect.d.ts.map +1 -1
- package/dist/proto/bsky_connect.js +38 -0
- package/dist/proto/bsky_connect.js.map +1 -1
- package/dist/proto/bsky_pb.d.ts +160 -0
- package/dist/proto/bsky_pb.d.ts.map +1 -1
- package/dist/proto/bsky_pb.js +508 -4
- package/dist/proto/bsky_pb.js.map +1 -1
- package/dist/views/index.d.ts +4 -1
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +89 -0
- package/dist/views/index.js.map +1 -1
- package/package.json +5 -5
- package/proto/bsky.proto +47 -0
- package/src/api/app/bsky/actor/getSuggestions.ts +1 -1
- package/src/api/app/bsky/actor/searchActors.ts +1 -1
- package/src/api/app/bsky/feed/getPostThread.ts +1 -9
- package/src/api/app/bsky/feed/searchPosts.ts +1 -1
- package/src/api/app/bsky/graph/getActorStarterPacks.ts +99 -0
- package/src/api/app/bsky/graph/getStarterPack.ts +80 -0
- package/src/api/app/bsky/graph/getStarterPacks.ts +81 -0
- package/src/api/index.ts +6 -0
- package/src/data-plane/server/db/database-schema.ts +2 -0
- package/src/data-plane/server/db/migrations/20240606T222548219Z-starter-packs.ts +45 -0
- package/src/data-plane/server/db/migrations/index.ts +1 -0
- package/src/data-plane/server/db/tables/profile.ts +2 -0
- package/src/data-plane/server/db/tables/starter-pack.ts +16 -0
- package/src/data-plane/server/indexing/index.ts +3 -0
- package/src/data-plane/server/indexing/plugins/profile.ts +16 -2
- package/src/data-plane/server/indexing/plugins/starter-pack.ts +76 -0
- package/src/data-plane/server/routes/index.ts +2 -0
- package/src/data-plane/server/routes/interactions.ts +56 -2
- package/src/data-plane/server/routes/profile.ts +1 -0
- package/src/data-plane/server/routes/records.ts +1 -0
- package/src/data-plane/server/routes/starter-packs.ts +32 -0
- package/src/hydration/actor.ts +5 -0
- package/src/hydration/feed.ts +1 -2
- package/src/hydration/graph.ts +55 -2
- package/src/hydration/hydrator.ts +143 -6
- package/src/hydration/util.ts +2 -0
- package/src/lexicon/index.ts +37 -0
- package/src/lexicon/lexicons.ts +372 -2
- package/src/lexicon/types/app/bsky/actor/defs.ts +44 -0
- package/src/lexicon/types/app/bsky/actor/profile.ts +3 -0
- package/src/lexicon/types/app/bsky/graph/defs.ts +58 -0
- package/src/lexicon/types/app/bsky/graph/getActorStarterPacks.ts +49 -0
- package/src/lexicon/types/app/bsky/graph/getStarterPack.ts +47 -0
- package/src/lexicon/types/app/bsky/graph/getStarterPacks.ts +46 -0
- package/src/lexicon/types/app/bsky/graph/starterpack.ts +50 -0
- package/src/lexicon/types/app/bsky/notification/listNotifications.ts +2 -1
- package/src/proto/bsky_connect.ts +46 -0
- package/src/proto/bsky_pb.ts +512 -0
- package/src/views/index.ts +98 -1
- package/tests/__snapshots__/feed-generation.test.ts.snap +28 -0
- package/tests/data-plane/__snapshots__/indexing.test.ts.snap +9 -0
- package/tests/views/__snapshots__/author-feed.test.ts.snap +29 -0
- package/tests/views/__snapshots__/block-lists.test.ts.snap +16 -0
- package/tests/views/__snapshots__/blocks.test.ts.snap +4 -0
- package/tests/views/__snapshots__/follows.test.ts.snap +34 -0
- package/tests/views/__snapshots__/labeler-service.test.ts.snap +4 -0
- package/tests/views/__snapshots__/likes.test.ts.snap +1 -0
- package/tests/views/__snapshots__/list-feed.test.ts.snap +12 -0
- package/tests/views/__snapshots__/mute-lists.test.ts.snap +20 -0
- package/tests/views/__snapshots__/mutes.test.ts.snap +8 -0
- package/tests/views/__snapshots__/notifications.test.ts.snap +10 -0
- package/tests/views/__snapshots__/posts.test.ts.snap +6 -0
- package/tests/views/__snapshots__/profile.test.ts.snap +18 -0
- package/tests/views/__snapshots__/reposts.test.ts.snap +1 -0
- package/tests/views/__snapshots__/starter-packs.test.ts.snap +482 -0
- package/tests/views/__snapshots__/thread.test.ts.snap +22 -0
- package/tests/views/__snapshots__/threadgating.test.ts.snap +2 -0
- package/tests/views/__snapshots__/timeline.test.ts.snap +81 -0
- package/tests/views/starter-packs.test.ts +121 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import AtpAgent from '@atproto/api'
|
|
2
|
+
import { TestNetwork, SeedClient, basicSeed, RecordRef } from '@atproto/dev-env'
|
|
3
|
+
import { isRecord as isProfile } from '../../src/lexicon/types/app/bsky/actor/profile'
|
|
4
|
+
import { forSnapshot } from '../_util'
|
|
5
|
+
import assert from 'assert'
|
|
6
|
+
|
|
7
|
+
describe('starter packs', () => {
|
|
8
|
+
let network: TestNetwork
|
|
9
|
+
let agent: AtpAgent
|
|
10
|
+
let sc: SeedClient
|
|
11
|
+
let sp1: RecordRef
|
|
12
|
+
let sp2: RecordRef
|
|
13
|
+
|
|
14
|
+
beforeAll(async () => {
|
|
15
|
+
network = await TestNetwork.create({
|
|
16
|
+
dbPostgresSchema: 'bsky_views_starter_packs',
|
|
17
|
+
})
|
|
18
|
+
agent = network.bsky.getClient()
|
|
19
|
+
sc = network.getSeedClient()
|
|
20
|
+
await basicSeed(sc)
|
|
21
|
+
await network.processAll()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
beforeAll(async () => {
|
|
25
|
+
const feedgen = await sc.createFeedGen(
|
|
26
|
+
sc.dids.alice,
|
|
27
|
+
'did:web:example.com',
|
|
28
|
+
"alice's feedgen",
|
|
29
|
+
)
|
|
30
|
+
sp1 = await sc.createStarterPack(
|
|
31
|
+
sc.dids.alice,
|
|
32
|
+
"alice's starter pack",
|
|
33
|
+
[sc.dids.bob, sc.dids.carol, sc.dids.dan],
|
|
34
|
+
[feedgen.uriStr],
|
|
35
|
+
)
|
|
36
|
+
sp2 = await sc.createStarterPack(
|
|
37
|
+
sc.dids.alice,
|
|
38
|
+
"alice's empty starter pack",
|
|
39
|
+
[],
|
|
40
|
+
[],
|
|
41
|
+
)
|
|
42
|
+
for (const n of [1, 2, 3]) {
|
|
43
|
+
const { did } = await sc.createAccount(`newskie${n}`, {
|
|
44
|
+
handle: `newskie${n}.test`,
|
|
45
|
+
email: `newskie${n}@test.com`,
|
|
46
|
+
password: `newskie${n}-pass`,
|
|
47
|
+
})
|
|
48
|
+
await sc.createProfile(did, `Newskie ${n}`, 'New here', [], sp1)
|
|
49
|
+
}
|
|
50
|
+
await network.processAll()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
afterAll(async () => {
|
|
54
|
+
await network.close()
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('gets actor starter packs.', async () => {
|
|
58
|
+
const { data } = await agent.api.app.bsky.graph.getActorStarterPacks({
|
|
59
|
+
actor: sc.dids.alice,
|
|
60
|
+
})
|
|
61
|
+
expect(data.starterPacks).toHaveLength(2)
|
|
62
|
+
expect(forSnapshot(data.starterPacks)).toMatchSnapshot()
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('gets starter pack used on profile detail', async () => {
|
|
66
|
+
const { data: profile } = await agent.api.app.bsky.actor.getProfile({
|
|
67
|
+
actor: sc.dids.newskie1,
|
|
68
|
+
})
|
|
69
|
+
expect(forSnapshot(profile.joinedViaStarterPack)).toMatchSnapshot()
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('gets starter pack details', async () => {
|
|
73
|
+
const {
|
|
74
|
+
data: { starterPack },
|
|
75
|
+
} = await agent.api.app.bsky.graph.getStarterPack({
|
|
76
|
+
// resolve w/ handle in uri
|
|
77
|
+
starterPack: sp1.uriStr,
|
|
78
|
+
})
|
|
79
|
+
expect(forSnapshot(starterPack)).toMatchSnapshot()
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('gets starter pack details with handle in uri', async () => {
|
|
83
|
+
const {
|
|
84
|
+
data: { starterPack },
|
|
85
|
+
} = await agent.api.app.bsky.graph.getStarterPack({
|
|
86
|
+
// resolve w/ handle in uri
|
|
87
|
+
starterPack: sp1.uriStr.replace(
|
|
88
|
+
sc.dids.alice,
|
|
89
|
+
sc.accounts[sc.dids.alice].handle,
|
|
90
|
+
),
|
|
91
|
+
})
|
|
92
|
+
expect(starterPack.uri).toBe(sp1.uriStr)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('gets starter pack details', async () => {
|
|
96
|
+
const {
|
|
97
|
+
data: { starterPacks },
|
|
98
|
+
} = await agent.api.app.bsky.graph.getStarterPacks({
|
|
99
|
+
uris: [sp2.uriStr, sp1.uriStr],
|
|
100
|
+
})
|
|
101
|
+
expect(forSnapshot(starterPacks)).toMatchSnapshot()
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it('generates notifications', async () => {
|
|
105
|
+
const {
|
|
106
|
+
data: { notifications },
|
|
107
|
+
} = await agent.api.app.bsky.notification.listNotifications(
|
|
108
|
+
{ limit: 3 }, // three most recent
|
|
109
|
+
{ headers: await network.serviceHeaders(sc.dids.alice) },
|
|
110
|
+
)
|
|
111
|
+
expect(notifications).toHaveLength(3)
|
|
112
|
+
notifications.forEach((notif) => {
|
|
113
|
+
expect(notif.reason).toBe('starterpack-joined')
|
|
114
|
+
expect(notif.reasonSubject).toBe(sp1.uriStr)
|
|
115
|
+
expect(notif.uri).toMatch(/\/app\.bsky\.actor\.profile\/self$/)
|
|
116
|
+
assert(isProfile(notif.record), 'record is not profile')
|
|
117
|
+
expect(notif.record.joinedViaStarterPack?.uri).toBe(sp1.uriStr)
|
|
118
|
+
})
|
|
119
|
+
expect(forSnapshot(notifications)).toMatchSnapshot()
|
|
120
|
+
})
|
|
121
|
+
})
|