@atproto/api 0.6.19 → 0.6.21

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +4 -0
  3. package/definitions/moderation-behaviors.d.ts +1 -0
  4. package/definitions/profile-moderation-behaviors.json +25 -0
  5. package/dist/agent.d.ts +2 -0
  6. package/dist/bsky-agent.d.ts +7 -0
  7. package/dist/client/index.d.ts +15 -0
  8. package/dist/client/lexicons.d.ts +142 -0
  9. package/dist/client/types/app/bsky/actor/defs.d.ts +1 -0
  10. package/dist/client/types/com/atproto/server/confirmEmail.d.ts +30 -0
  11. package/dist/client/types/com/atproto/server/createAccount.d.ts +2 -0
  12. package/dist/client/types/com/atproto/server/createSession.d.ts +2 -0
  13. package/dist/client/types/com/atproto/server/getSession.d.ts +1 -0
  14. package/dist/client/types/com/atproto/server/refreshSession.d.ts +1 -0
  15. package/dist/client/types/com/atproto/server/requestEmailConfirmation.d.ts +13 -0
  16. package/dist/client/types/com/atproto/server/requestEmailUpdate.d.ts +18 -0
  17. package/dist/client/types/com/atproto/server/reserveSigningKey.d.ts +18 -0
  18. package/dist/client/types/com/atproto/server/updateEmail.d.ts +27 -0
  19. package/dist/client/types/com/atproto/sync/listRepos.d.ts +1 -0
  20. package/dist/index.js +754 -321
  21. package/dist/index.js.map +3 -3
  22. package/dist/moderation/accumulator.d.ts +1 -0
  23. package/dist/types.d.ts +1 -0
  24. package/docs/moderation-behaviors/profiles.md +17 -0
  25. package/package.json +8 -7
  26. package/src/agent.ts +32 -1
  27. package/src/bsky-agent.ts +43 -0
  28. package/src/client/index.ts +65 -0
  29. package/src/client/lexicons.ts +166 -1
  30. package/src/client/types/app/bsky/actor/defs.ts +1 -0
  31. package/src/client/types/com/atproto/server/confirmEmail.ts +61 -0
  32. package/src/client/types/com/atproto/server/createAccount.ts +2 -0
  33. package/src/client/types/com/atproto/server/createSession.ts +2 -0
  34. package/src/client/types/com/atproto/server/getSession.ts +1 -0
  35. package/src/client/types/com/atproto/server/refreshSession.ts +1 -0
  36. package/src/client/types/com/atproto/server/requestEmailConfirmation.ts +28 -0
  37. package/src/client/types/com/atproto/server/requestEmailUpdate.ts +34 -0
  38. package/src/client/types/com/atproto/server/reserveSigningKey.ts +35 -0
  39. package/src/client/types/com/atproto/server/updateEmail.ts +55 -0
  40. package/src/client/types/com/atproto/sync/listRepos.ts +1 -0
  41. package/src/moderation/accumulator.ts +13 -0
  42. package/src/moderation/subjects/account.ts +7 -1
  43. package/src/types.ts +1 -0
  44. package/tests/agent.test.ts +27 -21
  45. package/tests/bsky-agent.test.ts +19 -25
  46. package/tests/errors.test.ts +5 -11
  47. package/tests/rich-text-detection.test.ts +3 -3
  48. package/tests/util/index.ts +3 -0
  49. package/tests/util/moderation-behavior.ts +10 -2
@@ -16,6 +16,7 @@ export interface InputSchema {
16
16
  inviteCode?: string
17
17
  password: string
18
18
  recoveryKey?: string
19
+ plcOp?: Uint8Array
19
20
  [k: string]: unknown
20
21
  }
21
22
 
@@ -24,6 +25,7 @@ export interface OutputSchema {
24
25
  refreshJwt: string
25
26
  handle: string
26
27
  did: string
28
+ didDoc?: {}
27
29
  [k: string]: unknown
28
30
  }
29
31
 
@@ -21,7 +21,9 @@ export interface OutputSchema {
21
21
  refreshJwt: string
22
22
  handle: string
23
23
  did: string
24
+ didDoc?: {}
24
25
  email?: string
26
+ emailConfirmed?: boolean
25
27
  [k: string]: unknown
26
28
  }
27
29
 
@@ -15,6 +15,7 @@ export interface OutputSchema {
15
15
  handle: string
16
16
  did: string
17
17
  email?: string
18
+ emailConfirmed?: boolean
18
19
  [k: string]: unknown
19
20
  }
20
21
 
@@ -16,6 +16,7 @@ export interface OutputSchema {
16
16
  refreshJwt: string
17
17
  handle: string
18
18
  did: string
19
+ didDoc?: {}
19
20
  [k: string]: unknown
20
21
  }
21
22
 
@@ -0,0 +1,28 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
9
+
10
+ export interface QueryParams {}
11
+
12
+ export type InputSchema = undefined
13
+
14
+ export interface CallOptions {
15
+ headers?: Headers
16
+ qp?: QueryParams
17
+ }
18
+
19
+ export interface Response {
20
+ success: boolean
21
+ headers: Headers
22
+ }
23
+
24
+ export function toKnownErr(e: any) {
25
+ if (e instanceof XRPCError) {
26
+ }
27
+ return e
28
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
9
+
10
+ export interface QueryParams {}
11
+
12
+ export type InputSchema = undefined
13
+
14
+ export interface OutputSchema {
15
+ tokenRequired: boolean
16
+ [k: string]: unknown
17
+ }
18
+
19
+ export interface CallOptions {
20
+ headers?: Headers
21
+ qp?: QueryParams
22
+ }
23
+
24
+ export interface Response {
25
+ success: boolean
26
+ headers: Headers
27
+ data: OutputSchema
28
+ }
29
+
30
+ export function toKnownErr(e: any) {
31
+ if (e instanceof XRPCError) {
32
+ }
33
+ return e
34
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
9
+
10
+ export interface QueryParams {}
11
+
12
+ export type InputSchema = undefined
13
+
14
+ export interface OutputSchema {
15
+ /** Public signing key in the form of a did:key. */
16
+ signingKey: string
17
+ [k: string]: unknown
18
+ }
19
+
20
+ export interface CallOptions {
21
+ headers?: Headers
22
+ qp?: QueryParams
23
+ }
24
+
25
+ export interface Response {
26
+ success: boolean
27
+ headers: Headers
28
+ data: OutputSchema
29
+ }
30
+
31
+ export function toKnownErr(e: any) {
32
+ if (e instanceof XRPCError) {
33
+ }
34
+ return e
35
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { Headers, XRPCError } from '@atproto/xrpc'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
+ import { isObj, hasProp } from '../../../../util'
7
+ import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
9
+
10
+ export interface QueryParams {}
11
+
12
+ export interface InputSchema {
13
+ email: string
14
+ /** Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed. */
15
+ token?: string
16
+ [k: string]: unknown
17
+ }
18
+
19
+ export interface CallOptions {
20
+ headers?: Headers
21
+ qp?: QueryParams
22
+ encoding: 'application/json'
23
+ }
24
+
25
+ export interface Response {
26
+ success: boolean
27
+ headers: Headers
28
+ }
29
+
30
+ export class ExpiredTokenError extends XRPCError {
31
+ constructor(src: XRPCError) {
32
+ super(src.status, src.error, src.message, src.headers)
33
+ }
34
+ }
35
+
36
+ export class InvalidTokenError extends XRPCError {
37
+ constructor(src: XRPCError) {
38
+ super(src.status, src.error, src.message, src.headers)
39
+ }
40
+ }
41
+
42
+ export class TokenRequiredError extends XRPCError {
43
+ constructor(src: XRPCError) {
44
+ super(src.status, src.error, src.message, src.headers)
45
+ }
46
+ }
47
+
48
+ export function toKnownErr(e: any) {
49
+ if (e instanceof XRPCError) {
50
+ if (e.error === 'ExpiredToken') return new ExpiredTokenError(e)
51
+ if (e.error === 'InvalidToken') return new InvalidTokenError(e)
52
+ if (e.error === 'TokenRequired') return new TokenRequiredError(e)
53
+ }
54
+ return e
55
+ }
@@ -39,6 +39,7 @@ export function toKnownErr(e: any) {
39
39
  export interface Repo {
40
40
  did: string
41
41
  head: string
42
+ rev: string
42
43
  [k: string]: unknown
43
44
  }
44
45
 
@@ -1,4 +1,5 @@
1
1
  import { AppBskyGraphDefs } from '../client/index'
2
+ import { AtUri } from '@atproto/syntax'
2
3
  import {
3
4
  Label,
4
5
  LabelPreference,
@@ -28,6 +29,18 @@ export class ModerationCauseAccumulator {
28
29
  }
29
30
  }
30
31
 
32
+ addBlockingByList(
33
+ blockingByList: AppBskyGraphDefs.ListViewBasic | undefined,
34
+ ) {
35
+ if (blockingByList) {
36
+ this.causes.push({
37
+ type: 'blocking',
38
+ source: { type: 'list', list: blockingByList },
39
+ priority: 3,
40
+ })
41
+ }
42
+ }
43
+
31
44
  addBlockedBy(blockedBy: boolean | undefined) {
32
45
  if (blockedBy) {
33
46
  this.causes.push({
@@ -20,7 +20,13 @@ export function decideAccount(
20
20
  acc.addMuted(subject.viewer?.muted)
21
21
  }
22
22
  }
23
- acc.addBlocking(subject.viewer?.blocking)
23
+ if (subject.viewer?.blocking) {
24
+ if (subject.viewer?.blockingByList) {
25
+ acc.addBlockingByList(subject.viewer?.blockingByList)
26
+ } else {
27
+ acc.addBlocking(subject.viewer?.blocking)
28
+ }
29
+ }
24
30
  acc.addBlockedBy(subject.viewer?.blockedBy)
25
31
 
26
32
  for (const label of filterAccountLabels(subject.labels)) {
package/src/types.ts CHANGED
@@ -14,6 +14,7 @@ export interface AtpSessionData {
14
14
  handle: string
15
15
  did: string
16
16
  email?: string
17
+ emailConfirmed?: boolean
17
18
  }
18
19
 
19
20
  /**
@@ -1,29 +1,26 @@
1
1
  import { defaultFetchHandler } from '@atproto/xrpc'
2
- import {
3
- CloseFn,
4
- runTestServer,
5
- TestServerInfo,
6
- } from '@atproto/pds/tests/_util'
7
2
  import {
8
3
  AtpAgent,
9
4
  AtpAgentFetchHandlerResponse,
10
5
  AtpSessionEvent,
11
6
  AtpSessionData,
12
7
  } from '..'
8
+ import { TestNetworkNoAppView } from '@atproto/dev-env'
13
9
 
14
10
  describe('agent', () => {
15
- let server: TestServerInfo
16
- let close: CloseFn
11
+ let network: TestNetworkNoAppView
17
12
 
18
13
  beforeAll(async () => {
19
- server = await runTestServer({
14
+ network = await TestNetworkNoAppView.create({
20
15
  dbPostgresSchema: 'api_agent',
16
+ pds: {
17
+ enableDidDocWithSession: true,
18
+ },
21
19
  })
22
- close = server.close
23
20
  })
24
21
 
25
22
  afterAll(async () => {
26
- await close()
23
+ await network.close()
27
24
  })
28
25
 
29
26
  it('creates a new session on account creation.', async () => {
@@ -34,7 +31,7 @@ describe('agent', () => {
34
31
  sessions.push(sess)
35
32
  }
36
33
 
37
- const agent = new AtpAgent({ service: server.url, persistSession })
34
+ const agent = new AtpAgent({ service: network.pds.url, persistSession })
38
35
 
39
36
  const res = await agent.createAccount({
40
37
  handle: 'user1.test',
@@ -48,6 +45,7 @@ describe('agent', () => {
48
45
  expect(agent.session?.handle).toEqual(res.data.handle)
49
46
  expect(agent.session?.did).toEqual(res.data.did)
50
47
  expect(agent.session?.email).toEqual('user1@test.com')
48
+ expect(agent.session?.emailConfirmed).toEqual(false)
51
49
 
52
50
  const { data: sessionInfo } = await agent.api.com.atproto.server.getSession(
53
51
  {},
@@ -56,6 +54,7 @@ describe('agent', () => {
56
54
  did: res.data.did,
57
55
  handle: res.data.handle,
58
56
  email: 'user1@test.com',
57
+ emailConfirmed: false,
59
58
  })
60
59
 
61
60
  expect(events.length).toEqual(1)
@@ -72,7 +71,7 @@ describe('agent', () => {
72
71
  sessions.push(sess)
73
72
  }
74
73
 
75
- const agent1 = new AtpAgent({ service: server.url, persistSession })
74
+ const agent1 = new AtpAgent({ service: network.pds.url, persistSession })
76
75
 
77
76
  const email = 'user2@test.com'
78
77
  await agent1.createAccount({
@@ -81,7 +80,7 @@ describe('agent', () => {
81
80
  password: 'password',
82
81
  })
83
82
 
84
- const agent2 = new AtpAgent({ service: server.url, persistSession })
83
+ const agent2 = new AtpAgent({ service: network.pds.url, persistSession })
85
84
  const res1 = await agent2.login({
86
85
  identifier: 'user2.test',
87
86
  password: 'password',
@@ -93,6 +92,7 @@ describe('agent', () => {
93
92
  expect(agent2.session?.handle).toEqual(res1.data.handle)
94
93
  expect(agent2.session?.did).toEqual(res1.data.did)
95
94
  expect(agent2.session?.email).toEqual('user2@test.com')
95
+ expect(agent2.session?.emailConfirmed).toEqual(false)
96
96
 
97
97
  const { data: sessionInfo } =
98
98
  await agent2.api.com.atproto.server.getSession({})
@@ -100,6 +100,7 @@ describe('agent', () => {
100
100
  did: res1.data.did,
101
101
  handle: res1.data.handle,
102
102
  email,
103
+ emailConfirmed: false,
103
104
  })
104
105
 
105
106
  expect(events.length).toEqual(2)
@@ -118,7 +119,7 @@ describe('agent', () => {
118
119
  sessions.push(sess)
119
120
  }
120
121
 
121
- const agent1 = new AtpAgent({ service: server.url, persistSession })
122
+ const agent1 = new AtpAgent({ service: network.pds.url, persistSession })
122
123
 
123
124
  await agent1.createAccount({
124
125
  handle: 'user3.test',
@@ -129,7 +130,7 @@ describe('agent', () => {
129
130
  throw new Error('No session created')
130
131
  }
131
132
 
132
- const agent2 = new AtpAgent({ service: server.url, persistSession })
133
+ const agent2 = new AtpAgent({ service: network.pds.url, persistSession })
133
134
  const res1 = await agent2.resumeSession(agent1.session)
134
135
 
135
136
  expect(agent2.hasSession).toEqual(true)
@@ -142,6 +143,7 @@ describe('agent', () => {
142
143
  did: res1.data.did,
143
144
  handle: res1.data.handle,
144
145
  email: res1.data.email,
146
+ emailConfirmed: false,
145
147
  })
146
148
 
147
149
  expect(events.length).toEqual(2)
@@ -160,7 +162,7 @@ describe('agent', () => {
160
162
  sessions.push(sess)
161
163
  }
162
164
 
163
- const agent = new AtpAgent({ service: server.url, persistSession })
165
+ const agent = new AtpAgent({ service: network.pds.url, persistSession })
164
166
 
165
167
  // create an account and a session with it
166
168
  await agent.createAccount({
@@ -206,6 +208,8 @@ describe('agent', () => {
206
208
  expect(agent.session?.refreshJwt).not.toEqual(session1.refreshJwt)
207
209
  expect(agent.session?.handle).toEqual(session1.handle)
208
210
  expect(agent.session?.did).toEqual(session1.did)
211
+ expect(agent.session?.email).toEqual(session1.email)
212
+ expect(agent.session?.emailConfirmed).toEqual(session1.emailConfirmed)
209
213
 
210
214
  expect(events.length).toEqual(2)
211
215
  expect(events[0]).toEqual('create')
@@ -223,7 +227,7 @@ describe('agent', () => {
223
227
  sessions.push(sess)
224
228
  }
225
229
 
226
- const agent = new AtpAgent({ service: server.url, persistSession })
230
+ const agent = new AtpAgent({ service: network.pds.url, persistSession })
227
231
 
228
232
  // create an account and a session with it
229
233
  await agent.createAccount({
@@ -283,6 +287,8 @@ describe('agent', () => {
283
287
  expect(agent.session?.refreshJwt).not.toEqual(session1.refreshJwt)
284
288
  expect(agent.session?.handle).toEqual(session1.handle)
285
289
  expect(agent.session?.did).toEqual(session1.did)
290
+ expect(agent.session?.email).toEqual(session1.email)
291
+ expect(agent.session?.emailConfirmed).toEqual(session1.emailConfirmed)
286
292
 
287
293
  expect(events.length).toEqual(2)
288
294
  expect(events[0]).toEqual('create')
@@ -300,7 +306,7 @@ describe('agent', () => {
300
306
  sessions.push(sess)
301
307
  }
302
308
 
303
- const agent = new AtpAgent({ service: server.url, persistSession })
309
+ const agent = new AtpAgent({ service: network.pds.url, persistSession })
304
310
 
305
311
  try {
306
312
  await agent.login({
@@ -340,7 +346,7 @@ describe('agent', () => {
340
346
  sessions.push(sess)
341
347
  }
342
348
 
343
- const agent = new AtpAgent({ service: server.url, persistSession })
349
+ const agent = new AtpAgent({ service: network.pds.url, persistSession })
344
350
 
345
351
  // create an account and a session with it
346
352
  await agent.createAccount({
@@ -411,7 +417,7 @@ describe('agent', () => {
411
417
  newHandlerCallCount++
412
418
  }
413
419
 
414
- const agent = new AtpAgent({ service: server.url, persistSession })
420
+ const agent = new AtpAgent({ service: network.pds.url, persistSession })
415
421
 
416
422
  await agent.createAccount({
417
423
  handle: 'user7.test',
@@ -443,7 +449,7 @@ describe('agent', () => {
443
449
  sessions.push(sess)
444
450
  }
445
451
 
446
- const agent = new AtpAgent({ service: server.url, persistSession })
452
+ const agent = new AtpAgent({ service: network.pds.url, persistSession })
447
453
 
448
454
  await expect(
449
455
  agent.createAccount({
@@ -1,23 +1,17 @@
1
- import {
2
- CloseFn,
3
- runTestServer,
4
- TestServerInfo,
5
- } from '@atproto/pds/tests/_util'
1
+ import { TestNetworkNoAppView } from '@atproto/dev-env'
6
2
  import { BskyAgent, ComAtprotoRepoPutRecord, AppBskyActorProfile } from '..'
7
3
 
8
4
  describe('agent', () => {
9
- let server: TestServerInfo
10
- let close: CloseFn
5
+ let network: TestNetworkNoAppView
11
6
 
12
7
  beforeAll(async () => {
13
- server = await runTestServer({
8
+ network = await TestNetworkNoAppView.create({
14
9
  dbPostgresSchema: 'bsky_agent',
15
10
  })
16
- close = server.close
17
11
  })
18
12
 
19
13
  afterAll(async () => {
20
- await close()
14
+ await network.close()
21
15
  })
22
16
 
23
17
  const getProfileDisplayName = async (
@@ -35,7 +29,7 @@ describe('agent', () => {
35
29
  }
36
30
 
37
31
  it('upsertProfile correctly creates and updates profiles.', async () => {
38
- const agent = new BskyAgent({ service: server.url })
32
+ const agent = new BskyAgent({ service: network.pds.url })
39
33
 
40
34
  await agent.createAccount({
41
35
  handle: 'user1.test',
@@ -67,7 +61,7 @@ describe('agent', () => {
67
61
  })
68
62
 
69
63
  it('upsertProfile correctly handles CAS failures.', async () => {
70
- const agent = new BskyAgent({ service: server.url })
64
+ const agent = new BskyAgent({ service: network.pds.url })
71
65
 
72
66
  await agent.createAccount({
73
67
  handle: 'user2.test',
@@ -106,7 +100,7 @@ describe('agent', () => {
106
100
  })
107
101
 
108
102
  it('upsertProfile wont endlessly retry CAS failures.', async () => {
109
- const agent = new BskyAgent({ service: server.url })
103
+ const agent = new BskyAgent({ service: network.pds.url })
110
104
 
111
105
  await agent.createAccount({
112
106
  handle: 'user3.test',
@@ -135,7 +129,7 @@ describe('agent', () => {
135
129
  })
136
130
 
137
131
  it('upsertProfile validates the record.', async () => {
138
- const agent = new BskyAgent({ service: server.url })
132
+ const agent = new BskyAgent({ service: network.pds.url })
139
133
 
140
134
  await agent.createAccount({
141
135
  handle: 'user4.test',
@@ -153,70 +147,70 @@ describe('agent', () => {
153
147
 
154
148
  describe('app', () => {
155
149
  it('should retrieve the api app', () => {
156
- const agent = new BskyAgent({ service: server.url })
150
+ const agent = new BskyAgent({ service: network.pds.url })
157
151
  expect(agent.app).toBe(agent.api.app)
158
152
  })
159
153
  })
160
154
 
161
155
  describe('post', () => {
162
156
  it('should throw if no session', async () => {
163
- const agent = new BskyAgent({ service: server.url })
157
+ const agent = new BskyAgent({ service: network.pds.url })
164
158
  await expect(agent.post({ text: 'foo' })).rejects.toThrow('Not logged in')
165
159
  })
166
160
  })
167
161
 
168
162
  describe('deletePost', () => {
169
163
  it('should throw if no session', async () => {
170
- const agent = new BskyAgent({ service: server.url })
164
+ const agent = new BskyAgent({ service: network.pds.url })
171
165
  await expect(agent.deletePost('foo')).rejects.toThrow('Not logged in')
172
166
  })
173
167
  })
174
168
 
175
169
  describe('like', () => {
176
170
  it('should throw if no session', async () => {
177
- const agent = new BskyAgent({ service: server.url })
171
+ const agent = new BskyAgent({ service: network.pds.url })
178
172
  await expect(agent.like('foo', 'bar')).rejects.toThrow('Not logged in')
179
173
  })
180
174
  })
181
175
 
182
176
  describe('deleteLike', () => {
183
177
  it('should throw if no session', async () => {
184
- const agent = new BskyAgent({ service: server.url })
178
+ const agent = new BskyAgent({ service: network.pds.url })
185
179
  await expect(agent.deleteLike('foo')).rejects.toThrow('Not logged in')
186
180
  })
187
181
  })
188
182
 
189
183
  describe('repost', () => {
190
184
  it('should throw if no session', async () => {
191
- const agent = new BskyAgent({ service: server.url })
185
+ const agent = new BskyAgent({ service: network.pds.url })
192
186
  await expect(agent.repost('foo', 'bar')).rejects.toThrow('Not logged in')
193
187
  })
194
188
  })
195
189
 
196
190
  describe('deleteRepost', () => {
197
191
  it('should throw if no session', async () => {
198
- const agent = new BskyAgent({ service: server.url })
192
+ const agent = new BskyAgent({ service: network.pds.url })
199
193
  await expect(agent.deleteRepost('foo')).rejects.toThrow('Not logged in')
200
194
  })
201
195
  })
202
196
 
203
197
  describe('follow', () => {
204
198
  it('should throw if no session', async () => {
205
- const agent = new BskyAgent({ service: server.url })
199
+ const agent = new BskyAgent({ service: network.pds.url })
206
200
  await expect(agent.follow('foo')).rejects.toThrow('Not logged in')
207
201
  })
208
202
  })
209
203
 
210
204
  describe('deleteFollow', () => {
211
205
  it('should throw if no session', async () => {
212
- const agent = new BskyAgent({ service: server.url })
206
+ const agent = new BskyAgent({ service: network.pds.url })
213
207
  await expect(agent.deleteFollow('foo')).rejects.toThrow('Not logged in')
214
208
  })
215
209
  })
216
210
 
217
211
  describe('preferences methods', () => {
218
212
  it('gets and sets preferences correctly', async () => {
219
- const agent = new BskyAgent({ service: server.url })
213
+ const agent = new BskyAgent({ service: network.pds.url })
220
214
 
221
215
  await agent.createAccount({
222
216
  handle: 'user5.test',
@@ -714,7 +708,7 @@ describe('agent', () => {
714
708
  })
715
709
 
716
710
  it('resolves duplicates correctly', async () => {
717
- const agent = new BskyAgent({ service: server.url })
711
+ const agent = new BskyAgent({ service: network.pds.url })
718
712
 
719
713
  await agent.createAccount({
720
714
  handle: 'user6.test',
@@ -1,25 +1,19 @@
1
- import {
2
- CloseFn,
3
- runTestServer,
4
- TestServerInfo,
5
- } from '@atproto/pds/tests/_util'
6
1
  import { AtpAgent, ComAtprotoServerCreateAccount } from '..'
2
+ import { TestNetworkNoAppView } from '@atproto/dev-env'
7
3
 
8
4
  describe('errors', () => {
9
- let server: TestServerInfo
5
+ let network: TestNetworkNoAppView
10
6
  let client: AtpAgent
11
- let close: CloseFn
12
7
 
13
8
  beforeAll(async () => {
14
- server = await runTestServer({
9
+ network = await TestNetworkNoAppView.create({
15
10
  dbPostgresSchema: 'known_errors',
16
11
  })
17
- client = new AtpAgent({ service: server.url })
18
- close = server.close
12
+ client = network.pds.getClient()
19
13
  })
20
14
 
21
15
  afterAll(async () => {
22
- await close()
16
+ await network.close()
23
17
  })
24
18
 
25
19
  it('constructs the correct error instance', async () => {
@@ -295,10 +295,10 @@ describe('detectFacets', () => {
295
295
  const rt = new RichText({ text: input })
296
296
  await rt.detectFacets(agent)
297
297
 
298
- let detectedTags: string[] = []
299
- let detectedIndices: { byteStart: number; byteEnd: number }[] = []
298
+ const detectedTags: string[] = []
299
+ const detectedIndices: { byteStart: number; byteEnd: number }[] = []
300
300
 
301
- for (const { facet, ...rest } of rt.segments()) {
301
+ for (const { facet } of rt.segments()) {
302
302
  if (!facet) continue
303
303
  for (const feature of facet.features) {
304
304
  if (isTag(feature)) {
@@ -135,6 +135,7 @@ export const mock = {
135
135
  mutedByList,
136
136
  blockedBy,
137
137
  blocking,
138
+ blockingByList,
138
139
  following,
139
140
  followedBy,
140
141
  }: {
@@ -142,6 +143,7 @@ export const mock = {
142
143
  mutedByList?: AppBskyGraphDefs.ListViewBasic
143
144
  blockedBy?: boolean
144
145
  blocking?: string
146
+ blockingByList?: AppBskyGraphDefs.ListViewBasic
145
147
  following?: string
146
148
  followedBy?: string
147
149
  }): AppBskyActorDefs.ViewerState {
@@ -150,6 +152,7 @@ export const mock = {
150
152
  mutedByList,
151
153
  blockedBy,
152
154
  blocking,
155
+ blockingByList,
153
156
  following,
154
157
  followedBy,
155
158
  }