@atproto/bsky 0.0.79 → 0.0.81
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/feed/getQuotes.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getQuotes.js +3 -1
- package/dist/api/app/bsky/feed/getQuotes.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/lexicon/index.d.ts +11 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +32 -1
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +346 -18
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +364 -24
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/defs.d.ts +13 -0
- package/dist/lexicon/types/app/bsky/embed/defs.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/embed/defs.js +16 -0
- package/dist/lexicon/types/app/bsky/embed/defs.js.map +1 -0
- package/dist/lexicon/types/app/bsky/embed/images.d.ts +3 -10
- package/dist/lexicon/types/app/bsky/embed/images.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/images.js +1 -11
- package/dist/lexicon/types/app/bsky/embed/images.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/record.d.ts +2 -1
- package/dist/lexicon/types/app/bsky/embed/record.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/record.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/recordWithMedia.d.ts +3 -2
- package/dist/lexicon/types/app/bsky/embed/recordWithMedia.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/recordWithMedia.js.map +1 -1
- package/dist/lexicon/types/app/bsky/embed/video.d.ts +33 -0
- package/dist/lexicon/types/app/bsky/embed/video.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/embed/video.js +35 -0
- package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -0
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +2 -1
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/post.d.ts +2 -1
- package/dist/lexicon/types/app/bsky/feed/post.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/post.js.map +1 -1
- package/dist/lexicon/types/app/bsky/video/defs.d.ts +19 -0
- package/dist/lexicon/types/app/bsky/video/defs.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/video/defs.js +16 -0
- package/dist/lexicon/types/app/bsky/video/defs.js.map +1 -0
- package/dist/lexicon/types/app/bsky/video/getJobStatus.d.ts +36 -0
- package/dist/lexicon/types/app/bsky/video/getJobStatus.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/video/getJobStatus.js +3 -0
- package/dist/lexicon/types/app/bsky/video/getJobStatus.js.map +1 -0
- package/dist/lexicon/types/app/bsky/video/getUploadLimits.d.ts +38 -0
- package/dist/lexicon/types/app/bsky/video/getUploadLimits.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/video/getUploadLimits.js +3 -0
- package/dist/lexicon/types/app/bsky/video/getUploadLimits.js.map +1 -0
- package/dist/lexicon/types/app/bsky/video/uploadVideo.d.ts +41 -0
- package/dist/lexicon/types/app/bsky/video/uploadVideo.d.ts.map +1 -0
- package/dist/lexicon/types/app/bsky/video/uploadVideo.js +3 -0
- package/dist/lexicon/types/app/bsky/video/uploadVideo.js.map +1 -0
- package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts +38 -4
- package/dist/lexicon/types/com/atproto/repo/applyWrites.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/applyWrites.js +31 -1
- package/dist/lexicon/types/com/atproto/repo/applyWrites.js.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts +5 -2
- package/dist/lexicon/types/com/atproto/repo/createRecord.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/defs.d.ts +12 -0
- package/dist/lexicon/types/com/atproto/repo/defs.d.ts.map +1 -0
- package/dist/lexicon/types/com/atproto/repo/defs.js +16 -0
- package/dist/lexicon/types/com/atproto/repo/defs.js.map +1 -0
- package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts +14 -2
- package/dist/lexicon/types/com/atproto/repo/deleteRecord.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts +5 -2
- package/dist/lexicon/types/com/atproto/repo/putRecord.d.ts.map +1 -1
- package/dist/views/index.d.ts +5 -2
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +24 -1
- package/dist/views/index.js.map +1 -1
- package/dist/views/types.d.ts +5 -2
- package/dist/views/types.d.ts.map +1 -1
- package/dist/views/types.js +3 -1
- package/dist/views/types.js.map +1 -1
- package/dist/views/util.d.ts +15 -0
- package/dist/views/util.d.ts.map +1 -1
- package/dist/views/util.js +42 -1
- package/dist/views/util.js.map +1 -1
- package/package.json +4 -4
- package/src/api/app/bsky/feed/getQuotes.ts +4 -1
- package/src/config.ts +17 -0
- package/src/index.ts +10 -1
- package/src/lexicon/index.ts +46 -0
- package/src/lexicon/lexicons.ts +367 -25
- package/src/lexicon/types/app/bsky/embed/defs.ts +26 -0
- package/src/lexicon/types/app/bsky/embed/images.ts +3 -21
- package/src/lexicon/types/app/bsky/embed/record.ts +2 -0
- package/src/lexicon/types/app/bsky/embed/recordWithMedia.ts +3 -0
- package/src/lexicon/types/app/bsky/embed/video.ts +67 -0
- package/src/lexicon/types/app/bsky/feed/defs.ts +2 -0
- package/src/lexicon/types/app/bsky/feed/post.ts +2 -0
- package/src/lexicon/types/app/bsky/video/defs.ts +32 -0
- package/src/lexicon/types/app/bsky/video/getJobStatus.ts +46 -0
- package/src/lexicon/types/app/bsky/video/getUploadLimits.ts +47 -0
- package/src/lexicon/types/app/bsky/video/uploadVideo.ts +48 -0
- package/src/lexicon/types/com/atproto/repo/applyWrites.ts +70 -3
- package/src/lexicon/types/com/atproto/repo/createRecord.ts +5 -2
- package/src/lexicon/types/com/atproto/repo/defs.ts +25 -0
- package/src/lexicon/types/com/atproto/repo/deleteRecord.ts +13 -1
- package/src/lexicon/types/com/atproto/repo/putRecord.ts +5 -2
- package/src/views/index.ts +30 -3
- package/src/views/types.ts +16 -1
- package/src/views/util.ts +24 -0
- package/tests/_util.ts +9 -0
- package/tests/views/__snapshots__/posts.test.ts.snap +190 -0
- package/tests/views/posts.test.ts +75 -0
- package/tests/views/quotes.test.ts +15 -0
|
@@ -1,5 +1,195 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`pds posts views embeds video with record. 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"author": Object {
|
|
6
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
7
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
8
|
+
"did": "user(0)",
|
|
9
|
+
"displayName": "ali",
|
|
10
|
+
"handle": "alice.test",
|
|
11
|
+
"labels": Array [
|
|
12
|
+
Object {
|
|
13
|
+
"cid": "cids(2)",
|
|
14
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
15
|
+
"src": "user(0)",
|
|
16
|
+
"uri": "record(1)",
|
|
17
|
+
"val": "self-label-a",
|
|
18
|
+
},
|
|
19
|
+
Object {
|
|
20
|
+
"cid": "cids(2)",
|
|
21
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
22
|
+
"src": "user(0)",
|
|
23
|
+
"uri": "record(1)",
|
|
24
|
+
"val": "self-label-b",
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
"cid": "cids(0)",
|
|
29
|
+
"embed": Object {
|
|
30
|
+
"$type": "app.bsky.embed.recordWithMedia#view",
|
|
31
|
+
"media": Object {
|
|
32
|
+
"$type": "app.bsky.embed.video#view",
|
|
33
|
+
"alt": "alt text",
|
|
34
|
+
"aspectRatio": Object {
|
|
35
|
+
"height": 3,
|
|
36
|
+
"width": 4,
|
|
37
|
+
},
|
|
38
|
+
"cid": "cids(3)",
|
|
39
|
+
"playlist": "https://bsky.public.url/vid/user(1)/cids(3)/playlist.m3u8",
|
|
40
|
+
"thumbnail": "https://bsky.public.url/vid/user(1)/cids(3)/thumbnail.jpg",
|
|
41
|
+
},
|
|
42
|
+
"record": Object {
|
|
43
|
+
"record": Object {
|
|
44
|
+
"$type": "app.bsky.embed.record#viewRecord",
|
|
45
|
+
"author": Object {
|
|
46
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
47
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
48
|
+
"did": "user(0)",
|
|
49
|
+
"displayName": "ali",
|
|
50
|
+
"handle": "alice.test",
|
|
51
|
+
"labels": Array [
|
|
52
|
+
Object {
|
|
53
|
+
"cid": "cids(2)",
|
|
54
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
55
|
+
"src": "user(0)",
|
|
56
|
+
"uri": "record(1)",
|
|
57
|
+
"val": "self-label-a",
|
|
58
|
+
},
|
|
59
|
+
Object {
|
|
60
|
+
"cid": "cids(2)",
|
|
61
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
62
|
+
"src": "user(0)",
|
|
63
|
+
"uri": "record(1)",
|
|
64
|
+
"val": "self-label-b",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
"cid": "cids(4)",
|
|
69
|
+
"embeds": Array [],
|
|
70
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
71
|
+
"labels": Array [],
|
|
72
|
+
"likeCount": 0,
|
|
73
|
+
"quoteCount": 1,
|
|
74
|
+
"replyCount": 0,
|
|
75
|
+
"repostCount": 0,
|
|
76
|
+
"uri": "record(2)",
|
|
77
|
+
"value": Object {
|
|
78
|
+
"$type": "app.bsky.feed.post",
|
|
79
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
80
|
+
"text": "embedded",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
86
|
+
"labels": Array [],
|
|
87
|
+
"likeCount": 0,
|
|
88
|
+
"quoteCount": 0,
|
|
89
|
+
"record": Object {
|
|
90
|
+
"$type": "app.bsky.feed.post",
|
|
91
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
92
|
+
"embed": Object {
|
|
93
|
+
"$type": "app.bsky.embed.recordWithMedia",
|
|
94
|
+
"media": Object {
|
|
95
|
+
"$type": "app.bsky.embed.video",
|
|
96
|
+
"alt": "alt text",
|
|
97
|
+
"aspectRatio": Object {
|
|
98
|
+
"height": 3,
|
|
99
|
+
"width": 4,
|
|
100
|
+
},
|
|
101
|
+
"video": Object {
|
|
102
|
+
"$type": "blob",
|
|
103
|
+
"mimeType": "image/mp4",
|
|
104
|
+
"ref": Object {
|
|
105
|
+
"$link": "cids(3)",
|
|
106
|
+
},
|
|
107
|
+
"size": 13,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
"record": Object {
|
|
111
|
+
"record": Object {
|
|
112
|
+
"cid": "cids(4)",
|
|
113
|
+
"uri": "record(2)",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
"text": "video",
|
|
118
|
+
},
|
|
119
|
+
"replyCount": 0,
|
|
120
|
+
"repostCount": 0,
|
|
121
|
+
"uri": "record(0)",
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
exports[`pds posts views embeds video. 1`] = `
|
|
126
|
+
Object {
|
|
127
|
+
"author": Object {
|
|
128
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
129
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
130
|
+
"did": "user(0)",
|
|
131
|
+
"displayName": "ali",
|
|
132
|
+
"handle": "alice.test",
|
|
133
|
+
"labels": Array [
|
|
134
|
+
Object {
|
|
135
|
+
"cid": "cids(2)",
|
|
136
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
137
|
+
"src": "user(0)",
|
|
138
|
+
"uri": "record(1)",
|
|
139
|
+
"val": "self-label-a",
|
|
140
|
+
},
|
|
141
|
+
Object {
|
|
142
|
+
"cid": "cids(2)",
|
|
143
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
144
|
+
"src": "user(0)",
|
|
145
|
+
"uri": "record(1)",
|
|
146
|
+
"val": "self-label-b",
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
"cid": "cids(0)",
|
|
151
|
+
"embed": Object {
|
|
152
|
+
"$type": "app.bsky.embed.video#view",
|
|
153
|
+
"alt": "alt text",
|
|
154
|
+
"aspectRatio": Object {
|
|
155
|
+
"height": 3,
|
|
156
|
+
"width": 4,
|
|
157
|
+
},
|
|
158
|
+
"cid": "cids(3)",
|
|
159
|
+
"playlist": "https://bsky.public.url/vid/user(1)/cids(3)/playlist.m3u8",
|
|
160
|
+
"thumbnail": "https://bsky.public.url/vid/user(1)/cids(3)/thumbnail.jpg",
|
|
161
|
+
},
|
|
162
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
163
|
+
"labels": Array [],
|
|
164
|
+
"likeCount": 0,
|
|
165
|
+
"quoteCount": 0,
|
|
166
|
+
"record": Object {
|
|
167
|
+
"$type": "app.bsky.feed.post",
|
|
168
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
169
|
+
"embed": Object {
|
|
170
|
+
"$type": "app.bsky.embed.video",
|
|
171
|
+
"alt": "alt text",
|
|
172
|
+
"aspectRatio": Object {
|
|
173
|
+
"height": 3,
|
|
174
|
+
"width": 4,
|
|
175
|
+
},
|
|
176
|
+
"video": Object {
|
|
177
|
+
"$type": "blob",
|
|
178
|
+
"mimeType": "image/mp4",
|
|
179
|
+
"ref": Object {
|
|
180
|
+
"$link": "cids(3)",
|
|
181
|
+
},
|
|
182
|
+
"size": 13,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
"text": "video",
|
|
186
|
+
},
|
|
187
|
+
"replyCount": 0,
|
|
188
|
+
"repostCount": 0,
|
|
189
|
+
"uri": "record(0)",
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
|
|
3
193
|
exports[`pds posts views fetches posts 1`] = `
|
|
4
194
|
Array [
|
|
5
195
|
Object {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AppBskyFeedPost, AtpAgent } from '@atproto/api'
|
|
2
2
|
import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot, stripViewerFromPost } from '../_util'
|
|
4
|
+
import { RecordEmbed, VideoEmbed } from '../../src/views/types'
|
|
5
|
+
import { RecordWithMedia } from '../../dist/views/types'
|
|
4
6
|
import { ids } from '../../src/lexicon/lexicons'
|
|
5
7
|
|
|
6
8
|
describe('pds posts views', () => {
|
|
@@ -114,4 +116,77 @@ describe('pds posts views', () => {
|
|
|
114
116
|
// @ts-ignore we know it's a post record
|
|
115
117
|
expect(data.posts[0].record.tags).toEqual(['javascript', 'hehe'])
|
|
116
118
|
})
|
|
119
|
+
|
|
120
|
+
it('embeds video.', async () => {
|
|
121
|
+
const { data: video } = await pdsAgent.api.com.atproto.repo.uploadBlob(
|
|
122
|
+
Buffer.from('notarealvideo'),
|
|
123
|
+
{
|
|
124
|
+
headers: sc.getHeaders(sc.dids.alice),
|
|
125
|
+
encoding: 'image/mp4',
|
|
126
|
+
},
|
|
127
|
+
)
|
|
128
|
+
const { uri } = await pdsAgent.api.app.bsky.feed.post.create(
|
|
129
|
+
{ repo: sc.dids.alice },
|
|
130
|
+
{
|
|
131
|
+
text: 'video',
|
|
132
|
+
createdAt: new Date().toISOString(),
|
|
133
|
+
embed: {
|
|
134
|
+
$type: 'app.bsky.embed.video',
|
|
135
|
+
video: video.blob,
|
|
136
|
+
alt: 'alt text',
|
|
137
|
+
aspectRatio: { height: 3, width: 4 },
|
|
138
|
+
} satisfies VideoEmbed,
|
|
139
|
+
},
|
|
140
|
+
sc.getHeaders(sc.dids.alice),
|
|
141
|
+
)
|
|
142
|
+
await network.processAll()
|
|
143
|
+
const { data } = await agent.app.bsky.feed.getPosts({ uris: [uri] })
|
|
144
|
+
expect(data.posts.length).toBe(1)
|
|
145
|
+
expect(forSnapshot(data.posts[0])).toMatchSnapshot()
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
it('embeds video with record.', async () => {
|
|
149
|
+
const { data: video } = await pdsAgent.api.com.atproto.repo.uploadBlob(
|
|
150
|
+
Buffer.from('notarealvideo'),
|
|
151
|
+
{
|
|
152
|
+
headers: sc.getHeaders(sc.dids.alice),
|
|
153
|
+
encoding: 'image/mp4',
|
|
154
|
+
},
|
|
155
|
+
)
|
|
156
|
+
const embedRecord = await pdsAgent.api.app.bsky.feed.post.create(
|
|
157
|
+
{ repo: sc.dids.alice },
|
|
158
|
+
{
|
|
159
|
+
text: 'embedded',
|
|
160
|
+
createdAt: new Date().toISOString(),
|
|
161
|
+
},
|
|
162
|
+
sc.getHeaders(sc.dids.alice),
|
|
163
|
+
)
|
|
164
|
+
const { uri } = await pdsAgent.api.app.bsky.feed.post.create(
|
|
165
|
+
{ repo: sc.dids.alice },
|
|
166
|
+
{
|
|
167
|
+
text: 'video',
|
|
168
|
+
createdAt: new Date().toISOString(),
|
|
169
|
+
embed: {
|
|
170
|
+
$type: 'app.bsky.embed.recordWithMedia',
|
|
171
|
+
record: {
|
|
172
|
+
record: {
|
|
173
|
+
uri: embedRecord.uri,
|
|
174
|
+
cid: embedRecord.cid,
|
|
175
|
+
},
|
|
176
|
+
} satisfies RecordEmbed,
|
|
177
|
+
media: {
|
|
178
|
+
$type: 'app.bsky.embed.video',
|
|
179
|
+
video: video.blob,
|
|
180
|
+
alt: 'alt text',
|
|
181
|
+
aspectRatio: { height: 3, width: 4 },
|
|
182
|
+
} satisfies VideoEmbed,
|
|
183
|
+
} satisfies RecordWithMedia,
|
|
184
|
+
},
|
|
185
|
+
sc.getHeaders(sc.dids.alice),
|
|
186
|
+
)
|
|
187
|
+
await network.processAll()
|
|
188
|
+
const { data } = await agent.app.bsky.feed.getPosts({ uris: [uri] })
|
|
189
|
+
expect(data.posts.length).toBe(1)
|
|
190
|
+
expect(forSnapshot(data.posts[0])).toMatchSnapshot()
|
|
191
|
+
})
|
|
117
192
|
})
|
|
@@ -42,6 +42,21 @@ describe('pds quote views', () => {
|
|
|
42
42
|
expect(forSnapshot(alicePostQuotes.data)).toMatchSnapshot()
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
+
it('does not return post in list when the quote author has a block', async () => {
|
|
46
|
+
await sc.block(eve, carol)
|
|
47
|
+
await network.processAll()
|
|
48
|
+
|
|
49
|
+
const quotes = await agent.api.app.bsky.feed.getQuotes(
|
|
50
|
+
{ uri: sc.posts[alice][0].ref.uriStr, limit: 30 },
|
|
51
|
+
{
|
|
52
|
+
headers: await network.serviceHeaders(carol, ids.AppBskyFeedGetQuotes),
|
|
53
|
+
},
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
expect(quotes.data.posts.length).toBe(0)
|
|
57
|
+
await sc.unblock(eve, carol)
|
|
58
|
+
})
|
|
59
|
+
|
|
45
60
|
it('utilizes limit parameter and cursor', async () => {
|
|
46
61
|
const alicePostQuotes1 = await agent.api.app.bsky.feed.getQuotes(
|
|
47
62
|
{ uri: sc.posts[alice][1].ref.uriStr, limit: 3 },
|