@atproto/api 0.13.7 → 0.13.9
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 +17 -0
- package/README.md +1 -1
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +17 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/lexicons.d.ts +118 -0
- package/dist/client/lexicons.d.ts.map +1 -1
- package/dist/client/lexicons.js +135 -3
- package/dist/client/lexicons.js.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.d.ts +2 -0
- package/dist/client/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/client/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/client/types/app/bsky/actor/profile.d.ts +1 -0
- package/dist/client/types/app/bsky/actor/profile.d.ts.map +1 -1
- package/dist/client/types/app/bsky/actor/profile.js.map +1 -1
- package/dist/client/types/app/bsky/feed/defs.d.ts +13 -2
- package/dist/client/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/client/types/app/bsky/feed/defs.js +21 -1
- package/dist/client/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/client/types/app/bsky/feed/getAuthorFeed.d.ts +1 -0
- package/dist/client/types/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
- package/dist/client/types/app/bsky/feed/getAuthorFeed.js.map +1 -1
- package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +2 -0
- package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
- package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.js.map +1 -1
- package/dist/client/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts +2 -0
- package/dist/client/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts.map +1 -1
- package/dist/client/types/app/bsky/unspecced/getSuggestionsSkeleton.js.map +1 -1
- package/dist/client/types/com/atproto/repo/getRecord.d.ts +4 -1
- package/dist/client/types/com/atproto/repo/getRecord.d.ts.map +1 -1
- package/dist/client/types/com/atproto/repo/getRecord.js +15 -1
- package/dist/client/types/com/atproto/repo/getRecord.js.map +1 -1
- package/dist/client/types/tools/ozone/moderation/getRecords.d.ts +27 -0
- package/dist/client/types/tools/ozone/moderation/getRecords.d.ts.map +1 -0
- package/dist/client/types/tools/ozone/moderation/getRecords.js +8 -0
- package/dist/client/types/tools/ozone/moderation/getRecords.js.map +1 -0
- package/dist/client/types/tools/ozone/moderation/getRepos.d.ts +27 -0
- package/dist/client/types/tools/ozone/moderation/getRepos.d.ts.map +1 -0
- package/dist/client/types/tools/ozone/moderation/getRepos.js +8 -0
- package/dist/client/types/tools/ozone/moderation/getRepos.js.map +1 -0
- package/package.json +5 -5
- package/src/client/index.ts +33 -6
- package/src/client/lexicons.ts +137 -3
- package/src/client/types/app/bsky/actor/defs.ts +2 -0
- package/src/client/types/app/bsky/actor/profile.ts +1 -0
- package/src/client/types/app/bsky/feed/defs.ts +38 -2
- package/src/client/types/app/bsky/feed/getAuthorFeed.ts +1 -0
- package/src/client/types/app/bsky/graph/getSuggestedFollowsByActor.ts +2 -0
- package/src/client/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +2 -0
- package/src/client/types/com/atproto/repo/getRecord.ts +10 -0
- package/src/client/types/tools/ozone/moderation/getRecords.ts +39 -0
- package/src/client/types/tools/ozone/moderation/getRepos.ts +39 -0
- package/tests/{bsky-agent.test.ts → atp-agent.test.ts} +42 -42
|
@@ -3,7 +3,7 @@ import { TID } from '@atproto/common-web'
|
|
|
3
3
|
import {
|
|
4
4
|
AppBskyActorDefs,
|
|
5
5
|
AppBskyActorProfile,
|
|
6
|
-
|
|
6
|
+
AtpAgent,
|
|
7
7
|
ComAtprotoRepoPutRecord,
|
|
8
8
|
DEFAULT_LABEL_SETTINGS,
|
|
9
9
|
} from '../src'
|
|
@@ -27,7 +27,7 @@ describe('agent', () => {
|
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
const getProfileDisplayName = async (
|
|
30
|
-
agent:
|
|
30
|
+
agent: AtpAgent,
|
|
31
31
|
): Promise<string | undefined> => {
|
|
32
32
|
try {
|
|
33
33
|
const res = await agent.app.bsky.actor.profile.get({
|
|
@@ -41,14 +41,14 @@ describe('agent', () => {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
it('clones correctly', () => {
|
|
44
|
-
const agent = new
|
|
44
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
45
45
|
const agent2 = agent.clone()
|
|
46
|
-
expect(agent2 instanceof
|
|
46
|
+
expect(agent2 instanceof AtpAgent).toBeTruthy()
|
|
47
47
|
expect(agent.service).toEqual(agent2.service)
|
|
48
48
|
})
|
|
49
49
|
|
|
50
50
|
it('upsertProfile correctly creates and updates profiles.', async () => {
|
|
51
|
-
const agent = new
|
|
51
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
52
52
|
|
|
53
53
|
await agent.createAccount({
|
|
54
54
|
handle: 'user1.test',
|
|
@@ -80,7 +80,7 @@ describe('agent', () => {
|
|
|
80
80
|
})
|
|
81
81
|
|
|
82
82
|
it('upsertProfile correctly handles CAS failures.', async () => {
|
|
83
|
-
const agent = new
|
|
83
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
84
84
|
await agent.createAccount({
|
|
85
85
|
handle: 'user2.test',
|
|
86
86
|
email: 'user2@test.com',
|
|
@@ -118,7 +118,7 @@ describe('agent', () => {
|
|
|
118
118
|
})
|
|
119
119
|
|
|
120
120
|
it('upsertProfile wont endlessly retry CAS failures.', async () => {
|
|
121
|
-
const agent = new
|
|
121
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
122
122
|
await agent.createAccount({
|
|
123
123
|
handle: 'user3.test',
|
|
124
124
|
email: 'user3@test.com',
|
|
@@ -146,7 +146,7 @@ describe('agent', () => {
|
|
|
146
146
|
})
|
|
147
147
|
|
|
148
148
|
it('upsertProfile validates the record.', async () => {
|
|
149
|
-
const agent = new
|
|
149
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
150
150
|
await agent.createAccount({
|
|
151
151
|
handle: 'user4.test',
|
|
152
152
|
email: 'user4@test.com',
|
|
@@ -163,7 +163,7 @@ describe('agent', () => {
|
|
|
163
163
|
|
|
164
164
|
describe('app', () => {
|
|
165
165
|
it('should retrieve the api app', () => {
|
|
166
|
-
const agent = new
|
|
166
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
167
167
|
expect(agent.api).toBe(agent)
|
|
168
168
|
expect(agent.app).toBeDefined()
|
|
169
169
|
})
|
|
@@ -171,70 +171,70 @@ describe('agent', () => {
|
|
|
171
171
|
|
|
172
172
|
describe('post', () => {
|
|
173
173
|
it('should throw if no session', async () => {
|
|
174
|
-
const agent = new
|
|
174
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
175
175
|
await expect(agent.post({ text: 'foo' })).rejects.toThrow('Not logged in')
|
|
176
176
|
})
|
|
177
177
|
})
|
|
178
178
|
|
|
179
179
|
describe('deletePost', () => {
|
|
180
180
|
it('should throw if no session', async () => {
|
|
181
|
-
const agent = new
|
|
181
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
182
182
|
await expect(agent.deletePost('foo')).rejects.toThrow('Not logged in')
|
|
183
183
|
})
|
|
184
184
|
})
|
|
185
185
|
|
|
186
186
|
describe('like', () => {
|
|
187
187
|
it('should throw if no session', async () => {
|
|
188
|
-
const agent = new
|
|
188
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
189
189
|
await expect(agent.like('foo', 'bar')).rejects.toThrow('Not logged in')
|
|
190
190
|
})
|
|
191
191
|
})
|
|
192
192
|
|
|
193
193
|
describe('deleteLike', () => {
|
|
194
194
|
it('should throw if no session', async () => {
|
|
195
|
-
const agent = new
|
|
195
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
196
196
|
await expect(agent.deleteLike('foo')).rejects.toThrow('Not logged in')
|
|
197
197
|
})
|
|
198
198
|
})
|
|
199
199
|
|
|
200
200
|
describe('repost', () => {
|
|
201
201
|
it('should throw if no session', async () => {
|
|
202
|
-
const agent = new
|
|
202
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
203
203
|
await expect(agent.repost('foo', 'bar')).rejects.toThrow('Not logged in')
|
|
204
204
|
})
|
|
205
205
|
})
|
|
206
206
|
|
|
207
207
|
describe('deleteRepost', () => {
|
|
208
208
|
it('should throw if no session', async () => {
|
|
209
|
-
const agent = new
|
|
209
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
210
210
|
await expect(agent.deleteRepost('foo')).rejects.toThrow('Not logged in')
|
|
211
211
|
})
|
|
212
212
|
})
|
|
213
213
|
|
|
214
214
|
describe('follow', () => {
|
|
215
215
|
it('should throw if no session', async () => {
|
|
216
|
-
const agent = new
|
|
216
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
217
217
|
await expect(agent.follow('foo')).rejects.toThrow('Not logged in')
|
|
218
218
|
})
|
|
219
219
|
})
|
|
220
220
|
|
|
221
221
|
describe('deleteFollow', () => {
|
|
222
222
|
it('should throw if no session', async () => {
|
|
223
|
-
const agent = new
|
|
223
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
224
224
|
await expect(agent.deleteFollow('foo')).rejects.toThrow('Not logged in')
|
|
225
225
|
})
|
|
226
226
|
})
|
|
227
227
|
|
|
228
228
|
describe('preferences methods', () => {
|
|
229
229
|
it('gets and sets preferences correctly', async () => {
|
|
230
|
-
const agent = new
|
|
230
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
231
231
|
await agent.createAccount({
|
|
232
232
|
handle: 'user5.test',
|
|
233
233
|
email: 'user5@test.com',
|
|
234
234
|
password: 'password',
|
|
235
235
|
})
|
|
236
236
|
|
|
237
|
-
const DEFAULT_LABELERS =
|
|
237
|
+
const DEFAULT_LABELERS = AtpAgent.appLabelers.map((did) => ({
|
|
238
238
|
did,
|
|
239
239
|
labels: {},
|
|
240
240
|
}))
|
|
@@ -1174,7 +1174,7 @@ describe('agent', () => {
|
|
|
1174
1174
|
})
|
|
1175
1175
|
|
|
1176
1176
|
it('resolves duplicates correctly', async () => {
|
|
1177
|
-
const agent = new
|
|
1177
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
1178
1178
|
|
|
1179
1179
|
await agent.createAccount({
|
|
1180
1180
|
handle: 'user6.test',
|
|
@@ -1318,7 +1318,7 @@ describe('agent', () => {
|
|
|
1318
1318
|
porn: 'warn',
|
|
1319
1319
|
},
|
|
1320
1320
|
labelers: [
|
|
1321
|
-
...
|
|
1321
|
+
...AtpAgent.appLabelers.map((did) => ({ did, labels: {} })),
|
|
1322
1322
|
{
|
|
1323
1323
|
did: 'did:plc:first-labeler',
|
|
1324
1324
|
labels: {},
|
|
@@ -1376,7 +1376,7 @@ describe('agent', () => {
|
|
|
1376
1376
|
porn: 'warn',
|
|
1377
1377
|
},
|
|
1378
1378
|
labelers: [
|
|
1379
|
-
...
|
|
1379
|
+
...AtpAgent.appLabelers.map((did) => ({ did, labels: {} })),
|
|
1380
1380
|
{
|
|
1381
1381
|
did: 'did:plc:first-labeler',
|
|
1382
1382
|
labels: {},
|
|
@@ -1435,7 +1435,7 @@ describe('agent', () => {
|
|
|
1435
1435
|
porn: 'ignore',
|
|
1436
1436
|
},
|
|
1437
1437
|
labelers: [
|
|
1438
|
-
...
|
|
1438
|
+
...AtpAgent.appLabelers.map((did) => ({ did, labels: {} })),
|
|
1439
1439
|
{
|
|
1440
1440
|
did: 'did:plc:first-labeler',
|
|
1441
1441
|
labels: {},
|
|
@@ -1494,7 +1494,7 @@ describe('agent', () => {
|
|
|
1494
1494
|
porn: 'ignore',
|
|
1495
1495
|
},
|
|
1496
1496
|
labelers: [
|
|
1497
|
-
...
|
|
1497
|
+
...AtpAgent.appLabelers.map((did) => ({ did, labels: {} })),
|
|
1498
1498
|
{
|
|
1499
1499
|
did: 'did:plc:first-labeler',
|
|
1500
1500
|
labels: {},
|
|
@@ -1549,7 +1549,7 @@ describe('agent', () => {
|
|
|
1549
1549
|
porn: 'ignore',
|
|
1550
1550
|
},
|
|
1551
1551
|
labelers: [
|
|
1552
|
-
...
|
|
1552
|
+
...AtpAgent.appLabelers.map((did) => ({ did, labels: {} })),
|
|
1553
1553
|
{
|
|
1554
1554
|
did: 'did:plc:first-labeler',
|
|
1555
1555
|
labels: {},
|
|
@@ -1604,7 +1604,7 @@ describe('agent', () => {
|
|
|
1604
1604
|
porn: 'ignore',
|
|
1605
1605
|
},
|
|
1606
1606
|
labelers: [
|
|
1607
|
-
...
|
|
1607
|
+
...AtpAgent.appLabelers.map((did) => ({ did, labels: {} })),
|
|
1608
1608
|
{
|
|
1609
1609
|
did: 'did:plc:first-labeler',
|
|
1610
1610
|
labels: {},
|
|
@@ -1671,7 +1671,7 @@ describe('agent', () => {
|
|
|
1671
1671
|
porn: 'ignore',
|
|
1672
1672
|
},
|
|
1673
1673
|
labelers: [
|
|
1674
|
-
...
|
|
1674
|
+
...AtpAgent.appLabelers.map((did) => ({ did, labels: {} })),
|
|
1675
1675
|
{
|
|
1676
1676
|
did: 'did:plc:first-labeler',
|
|
1677
1677
|
labels: {},
|
|
@@ -1773,10 +1773,10 @@ describe('agent', () => {
|
|
|
1773
1773
|
})
|
|
1774
1774
|
|
|
1775
1775
|
describe('muted words', () => {
|
|
1776
|
-
let agent:
|
|
1776
|
+
let agent: AtpAgent
|
|
1777
1777
|
|
|
1778
1778
|
beforeAll(async () => {
|
|
1779
|
-
agent = new
|
|
1779
|
+
agent = new AtpAgent({ service: network.pds.url })
|
|
1780
1780
|
await agent.createAccount({
|
|
1781
1781
|
handle: 'user7.test',
|
|
1782
1782
|
email: 'user7@test.com',
|
|
@@ -2196,10 +2196,10 @@ describe('agent', () => {
|
|
|
2196
2196
|
})
|
|
2197
2197
|
|
|
2198
2198
|
describe('legacy muted words', () => {
|
|
2199
|
-
let agent:
|
|
2199
|
+
let agent: AtpAgent
|
|
2200
2200
|
|
|
2201
2201
|
async function updatePreferences(
|
|
2202
|
-
agent:
|
|
2202
|
+
agent: AtpAgent,
|
|
2203
2203
|
cb: (
|
|
2204
2204
|
prefs: AppBskyActorDefs.Preferences,
|
|
2205
2205
|
) => AppBskyActorDefs.Preferences | false,
|
|
@@ -2252,7 +2252,7 @@ describe('agent', () => {
|
|
|
2252
2252
|
}
|
|
2253
2253
|
|
|
2254
2254
|
beforeAll(async () => {
|
|
2255
|
-
agent = new
|
|
2255
|
+
agent = new AtpAgent({ service: network.pds.url })
|
|
2256
2256
|
await agent.createAccount({
|
|
2257
2257
|
handle: 'user7-1.test',
|
|
2258
2258
|
email: 'user7-1@test.com',
|
|
@@ -2374,11 +2374,11 @@ describe('agent', () => {
|
|
|
2374
2374
|
})
|
|
2375
2375
|
|
|
2376
2376
|
describe('hidden posts', () => {
|
|
2377
|
-
let agent:
|
|
2377
|
+
let agent: AtpAgent
|
|
2378
2378
|
const postUri = 'at://did:plc:fake/app.bsky.feed.post/fake'
|
|
2379
2379
|
|
|
2380
2380
|
beforeAll(async () => {
|
|
2381
|
-
agent = new
|
|
2381
|
+
agent = new AtpAgent({ service: network.pds.url })
|
|
2382
2382
|
await agent.createAccount({
|
|
2383
2383
|
handle: 'user8.test',
|
|
2384
2384
|
email: 'user8@test.com',
|
|
@@ -2411,13 +2411,13 @@ describe('agent', () => {
|
|
|
2411
2411
|
})
|
|
2412
2412
|
|
|
2413
2413
|
describe(`saved feeds v2`, () => {
|
|
2414
|
-
let agent:
|
|
2414
|
+
let agent: AtpAgent
|
|
2415
2415
|
let i = 0
|
|
2416
2416
|
const feedUri = () => `at://bob.com/app.bsky.feed.generator/${i++}`
|
|
2417
2417
|
const listUri = () => `at://bob.com/app.bsky.graph.list/${i++}`
|
|
2418
2418
|
|
|
2419
2419
|
beforeAll(async () => {
|
|
2420
|
-
agent = new
|
|
2420
|
+
agent = new AtpAgent({ service: network.pds.url })
|
|
2421
2421
|
await agent.createAccount({
|
|
2422
2422
|
handle: 'user9.test',
|
|
2423
2423
|
email: 'user9@test.com',
|
|
@@ -2885,12 +2885,12 @@ describe('agent', () => {
|
|
|
2885
2885
|
})
|
|
2886
2886
|
|
|
2887
2887
|
describe(`saved feeds v2: migration scenarios`, () => {
|
|
2888
|
-
let agent:
|
|
2888
|
+
let agent: AtpAgent
|
|
2889
2889
|
let i = 0
|
|
2890
2890
|
const feedUri = () => `at://bob.com/app.bsky.feed.generator/${i++}`
|
|
2891
2891
|
|
|
2892
2892
|
beforeAll(async () => {
|
|
2893
|
-
agent = new
|
|
2893
|
+
agent = new AtpAgent({ service: network.pds.url })
|
|
2894
2894
|
await agent.createAccount({
|
|
2895
2895
|
handle: 'user10.test',
|
|
2896
2896
|
email: 'user10@test.com',
|
|
@@ -3205,7 +3205,7 @@ describe('agent', () => {
|
|
|
3205
3205
|
|
|
3206
3206
|
describe('queued nudges', () => {
|
|
3207
3207
|
it('queueNudges & dismissNudges', async () => {
|
|
3208
|
-
const agent = new
|
|
3208
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
3209
3209
|
await agent.createAccount({
|
|
3210
3210
|
handle: 'user11.test',
|
|
3211
3211
|
email: 'user11@test.com',
|
|
@@ -3236,7 +3236,7 @@ describe('agent', () => {
|
|
|
3236
3236
|
|
|
3237
3237
|
describe('guided tours', () => {
|
|
3238
3238
|
it('setActiveProgressGuide', async () => {
|
|
3239
|
-
const agent = new
|
|
3239
|
+
const agent = new AtpAgent({ service: network.pds.url })
|
|
3240
3240
|
|
|
3241
3241
|
await agent.createAccount({
|
|
3242
3242
|
handle: 'user12.test',
|
|
@@ -3273,7 +3273,7 @@ describe('agent', () => {
|
|
|
3273
3273
|
})
|
|
3274
3274
|
|
|
3275
3275
|
describe('nuxs', () => {
|
|
3276
|
-
let agent:
|
|
3276
|
+
let agent: AtpAgent
|
|
3277
3277
|
|
|
3278
3278
|
const nux = {
|
|
3279
3279
|
id: 'a',
|
|
@@ -3283,7 +3283,7 @@ describe('agent', () => {
|
|
|
3283
3283
|
}
|
|
3284
3284
|
|
|
3285
3285
|
beforeAll(async () => {
|
|
3286
|
-
agent = new
|
|
3286
|
+
agent = new AtpAgent({ service: network.pds.url })
|
|
3287
3287
|
|
|
3288
3288
|
await agent.createAccount({
|
|
3289
3289
|
handle: 'nuxs.test',
|