@atproto/pds 0.5.6 → 0.5.8

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 (243) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/background.d.ts +12 -6
  3. package/dist/background.d.ts.map +1 -1
  4. package/dist/background.js +32 -13
  5. package/dist/background.js.map +1 -1
  6. package/dist/context.d.ts.map +1 -1
  7. package/dist/context.js +4 -31
  8. package/dist/context.js.map +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +33 -11
  12. package/dist/index.js.map +1 -1
  13. package/dist/lexicons/app/bsky/authFullApp.defs.d.ts.map +1 -1
  14. package/dist/lexicons/app/bsky/authFullApp.defs.js +1 -0
  15. package/dist/lexicons/app/bsky/authFullApp.defs.js.map +1 -1
  16. package/dist/lexicons/app/bsky/authViewAll.defs.d.ts.map +1 -1
  17. package/dist/lexicons/app/bsky/authViewAll.defs.js +1 -0
  18. package/dist/lexicons/app/bsky/authViewAll.defs.js.map +1 -1
  19. package/dist/lexicons/app/bsky/feed/searchPostsV2.d.ts +3 -0
  20. package/dist/lexicons/app/bsky/feed/searchPostsV2.d.ts.map +1 -0
  21. package/dist/lexicons/app/bsky/feed/searchPostsV2.defs.d.ts +158 -0
  22. package/dist/lexicons/app/bsky/feed/searchPostsV2.defs.d.ts.map +1 -0
  23. package/dist/lexicons/app/bsky/feed/searchPostsV2.defs.js +74 -0
  24. package/dist/lexicons/app/bsky/feed/searchPostsV2.defs.js.map +1 -0
  25. package/dist/lexicons/app/bsky/feed/searchPostsV2.js +6 -0
  26. package/dist/lexicons/app/bsky/feed/searchPostsV2.js.map +1 -0
  27. package/dist/lexicons/app/bsky/feed.d.ts +1 -0
  28. package/dist/lexicons/app/bsky/feed.d.ts.map +1 -1
  29. package/dist/lexicons/app/bsky/feed.js +1 -0
  30. package/dist/lexicons/app/bsky/feed.js.map +1 -1
  31. package/dist/lexicons/app/bsky/notification/defs.defs.d.ts +5 -0
  32. package/dist/lexicons/app/bsky/notification/defs.defs.d.ts.map +1 -1
  33. package/dist/lexicons/app/bsky/notification/defs.defs.js +1 -0
  34. package/dist/lexicons/app/bsky/notification/defs.defs.js.map +1 -1
  35. package/dist/lexicons/chat/bsky/actor/declaration.defs.d.ts +1 -1
  36. package/dist/lexicons/chat/bsky/actor/declaration.defs.js.map +1 -1
  37. package/dist/lexicons/chat/bsky/actor/defs.defs.d.ts +4 -6
  38. package/dist/lexicons/chat/bsky/actor/defs.defs.d.ts.map +1 -1
  39. package/dist/lexicons/chat/bsky/actor/defs.defs.js +2 -3
  40. package/dist/lexicons/chat/bsky/actor/defs.defs.js.map +1 -1
  41. package/dist/lexicons/chat/bsky/convo/defs.defs.d.ts +64 -70
  42. package/dist/lexicons/chat/bsky/convo/defs.defs.d.ts.map +1 -1
  43. package/dist/lexicons/chat/bsky/convo/defs.defs.js +32 -35
  44. package/dist/lexicons/chat/bsky/convo/defs.defs.js.map +1 -1
  45. package/dist/lexicons/chat/bsky/convo/getUnreadCounts.defs.d.ts +1 -1
  46. package/dist/lexicons/chat/bsky/convo/getUnreadCounts.defs.d.ts.map +1 -1
  47. package/dist/lexicons/chat/bsky/convo/getUnreadCounts.defs.js +1 -1
  48. package/dist/lexicons/chat/bsky/convo/getUnreadCounts.defs.js.map +1 -1
  49. package/dist/lexicons/chat/bsky/convo/listConvoRequests.defs.d.ts +1 -1
  50. package/dist/lexicons/chat/bsky/convo/listConvoRequests.defs.d.ts.map +1 -1
  51. package/dist/lexicons/chat/bsky/convo/listConvoRequests.defs.js +1 -1
  52. package/dist/lexicons/chat/bsky/convo/listConvoRequests.defs.js.map +1 -1
  53. package/dist/lexicons/chat/bsky/convo/lockConvo.defs.d.ts +1 -1
  54. package/dist/lexicons/chat/bsky/convo/lockConvo.defs.d.ts.map +1 -1
  55. package/dist/lexicons/chat/bsky/convo/lockConvo.defs.js +1 -1
  56. package/dist/lexicons/chat/bsky/convo/lockConvo.defs.js.map +1 -1
  57. package/dist/lexicons/chat/bsky/convo/unlockConvo.defs.d.ts +1 -1
  58. package/dist/lexicons/chat/bsky/convo/unlockConvo.defs.d.ts.map +1 -1
  59. package/dist/lexicons/chat/bsky/convo/unlockConvo.defs.js +1 -1
  60. package/dist/lexicons/chat/bsky/convo/unlockConvo.defs.js.map +1 -1
  61. package/dist/lexicons/chat/bsky/group/addMembers.defs.d.ts +1 -1
  62. package/dist/lexicons/chat/bsky/group/addMembers.defs.d.ts.map +1 -1
  63. package/dist/lexicons/chat/bsky/group/addMembers.defs.js +1 -1
  64. package/dist/lexicons/chat/bsky/group/addMembers.defs.js.map +1 -1
  65. package/dist/lexicons/chat/bsky/group/approveJoinRequest.defs.d.ts +1 -1
  66. package/dist/lexicons/chat/bsky/group/approveJoinRequest.defs.d.ts.map +1 -1
  67. package/dist/lexicons/chat/bsky/group/approveJoinRequest.defs.js +1 -1
  68. package/dist/lexicons/chat/bsky/group/approveJoinRequest.defs.js.map +1 -1
  69. package/dist/lexicons/chat/bsky/group/createGroup.defs.d.ts +1 -1
  70. package/dist/lexicons/chat/bsky/group/createGroup.defs.d.ts.map +1 -1
  71. package/dist/lexicons/chat/bsky/group/createGroup.defs.js +1 -1
  72. package/dist/lexicons/chat/bsky/group/createGroup.defs.js.map +1 -1
  73. package/dist/lexicons/chat/bsky/group/createJoinLink.defs.d.ts +1 -1
  74. package/dist/lexicons/chat/bsky/group/createJoinLink.defs.d.ts.map +1 -1
  75. package/dist/lexicons/chat/bsky/group/createJoinLink.defs.js +1 -1
  76. package/dist/lexicons/chat/bsky/group/createJoinLink.defs.js.map +1 -1
  77. package/dist/lexicons/chat/bsky/group/disableJoinLink.defs.d.ts +1 -1
  78. package/dist/lexicons/chat/bsky/group/disableJoinLink.defs.d.ts.map +1 -1
  79. package/dist/lexicons/chat/bsky/group/disableJoinLink.defs.js +1 -1
  80. package/dist/lexicons/chat/bsky/group/disableJoinLink.defs.js.map +1 -1
  81. package/dist/lexicons/chat/bsky/group/editGroup.defs.d.ts +1 -1
  82. package/dist/lexicons/chat/bsky/group/editGroup.defs.d.ts.map +1 -1
  83. package/dist/lexicons/chat/bsky/group/editGroup.defs.js +1 -1
  84. package/dist/lexicons/chat/bsky/group/editGroup.defs.js.map +1 -1
  85. package/dist/lexicons/chat/bsky/group/editJoinLink.defs.d.ts +1 -1
  86. package/dist/lexicons/chat/bsky/group/editJoinLink.defs.d.ts.map +1 -1
  87. package/dist/lexicons/chat/bsky/group/editJoinLink.defs.js +1 -1
  88. package/dist/lexicons/chat/bsky/group/editJoinLink.defs.js.map +1 -1
  89. package/dist/lexicons/chat/bsky/group/enableJoinLink.defs.d.ts +1 -1
  90. package/dist/lexicons/chat/bsky/group/enableJoinLink.defs.d.ts.map +1 -1
  91. package/dist/lexicons/chat/bsky/group/enableJoinLink.defs.js +1 -1
  92. package/dist/lexicons/chat/bsky/group/enableJoinLink.defs.js.map +1 -1
  93. package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.d.ts +1 -1
  94. package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.d.ts.map +1 -1
  95. package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.js +1 -1
  96. package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.js.map +1 -1
  97. package/dist/lexicons/chat/bsky/group/listJoinRequests.defs.d.ts +1 -1
  98. package/dist/lexicons/chat/bsky/group/listJoinRequests.defs.d.ts.map +1 -1
  99. package/dist/lexicons/chat/bsky/group/listJoinRequests.defs.js +1 -1
  100. package/dist/lexicons/chat/bsky/group/listJoinRequests.defs.js.map +1 -1
  101. package/dist/lexicons/chat/bsky/group/listMutualGroups.defs.d.ts +1 -1
  102. package/dist/lexicons/chat/bsky/group/listMutualGroups.defs.d.ts.map +1 -1
  103. package/dist/lexicons/chat/bsky/group/listMutualGroups.defs.js +1 -1
  104. package/dist/lexicons/chat/bsky/group/listMutualGroups.defs.js.map +1 -1
  105. package/dist/lexicons/chat/bsky/group/rejectJoinRequest.defs.d.ts +1 -1
  106. package/dist/lexicons/chat/bsky/group/rejectJoinRequest.defs.d.ts.map +1 -1
  107. package/dist/lexicons/chat/bsky/group/rejectJoinRequest.defs.js +1 -1
  108. package/dist/lexicons/chat/bsky/group/rejectJoinRequest.defs.js.map +1 -1
  109. package/dist/lexicons/chat/bsky/group/removeMembers.defs.d.ts +1 -1
  110. package/dist/lexicons/chat/bsky/group/removeMembers.defs.d.ts.map +1 -1
  111. package/dist/lexicons/chat/bsky/group/removeMembers.defs.js +1 -1
  112. package/dist/lexicons/chat/bsky/group/removeMembers.defs.js.map +1 -1
  113. package/dist/lexicons/chat/bsky/group/requestJoin.defs.d.ts +1 -1
  114. package/dist/lexicons/chat/bsky/group/requestJoin.defs.d.ts.map +1 -1
  115. package/dist/lexicons/chat/bsky/group/requestJoin.defs.js +1 -1
  116. package/dist/lexicons/chat/bsky/group/requestJoin.defs.js.map +1 -1
  117. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.d.ts +1 -1
  118. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.d.ts.map +1 -1
  119. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.js +1 -1
  120. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.js.map +1 -1
  121. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.d.ts +1 -1
  122. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.d.ts.map +1 -1
  123. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.js +1 -1
  124. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.js.map +1 -1
  125. package/dist/lexicons/chat/bsky/moderation/defs.defs.d.ts +6 -6
  126. package/dist/lexicons/chat/bsky/moderation/defs.defs.d.ts.map +1 -1
  127. package/dist/lexicons/chat/bsky/moderation/defs.defs.js +3 -3
  128. package/dist/lexicons/chat/bsky/moderation/defs.defs.js.map +1 -1
  129. package/dist/lexicons/chat/bsky/moderation/getConvo.defs.d.ts +1 -1
  130. package/dist/lexicons/chat/bsky/moderation/getConvo.defs.d.ts.map +1 -1
  131. package/dist/lexicons/chat/bsky/moderation/getConvo.defs.js +1 -1
  132. package/dist/lexicons/chat/bsky/moderation/getConvo.defs.js.map +1 -1
  133. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.d.ts +1 -1
  134. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.d.ts.map +1 -1
  135. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.js +1 -1
  136. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.js.map +1 -1
  137. package/dist/lexicons/chat/bsky/moderation/getConvos.defs.d.ts +1 -1
  138. package/dist/lexicons/chat/bsky/moderation/getConvos.defs.d.ts.map +1 -1
  139. package/dist/lexicons/chat/bsky/moderation/getConvos.defs.js +1 -1
  140. package/dist/lexicons/chat/bsky/moderation/getConvos.defs.js.map +1 -1
  141. package/dist/lexicons/chat/bsky/notification/defs.d.ts +2 -0
  142. package/dist/lexicons/chat/bsky/notification/defs.d.ts.map +1 -0
  143. package/dist/lexicons/chat/bsky/notification/defs.defs.d.ts +20 -0
  144. package/dist/lexicons/chat/bsky/notification/defs.defs.d.ts.map +1 -0
  145. package/dist/lexicons/chat/bsky/notification/defs.defs.js +19 -0
  146. package/dist/lexicons/chat/bsky/notification/defs.defs.js.map +1 -0
  147. package/dist/lexicons/chat/bsky/notification/defs.js +5 -0
  148. package/dist/lexicons/chat/bsky/notification/defs.js.map +1 -0
  149. package/dist/lexicons/chat/bsky/notification/getPreferences.d.ts +3 -0
  150. package/dist/lexicons/chat/bsky/notification/getPreferences.d.ts.map +1 -0
  151. package/dist/lexicons/chat/bsky/notification/getPreferences.defs.d.ts +18 -0
  152. package/dist/lexicons/chat/bsky/notification/getPreferences.defs.d.ts.map +1 -0
  153. package/dist/lexicons/chat/bsky/notification/getPreferences.defs.js +16 -0
  154. package/dist/lexicons/chat/bsky/notification/getPreferences.defs.js.map +1 -0
  155. package/dist/lexicons/chat/bsky/notification/getPreferences.js +6 -0
  156. package/dist/lexicons/chat/bsky/notification/getPreferences.js.map +1 -0
  157. package/dist/lexicons/chat/bsky/notification/putPreferences.d.ts +3 -0
  158. package/dist/lexicons/chat/bsky/notification/putPreferences.d.ts.map +1 -0
  159. package/dist/lexicons/chat/bsky/notification/putPreferences.defs.d.ts +27 -0
  160. package/dist/lexicons/chat/bsky/notification/putPreferences.defs.d.ts.map +1 -0
  161. package/dist/lexicons/chat/bsky/notification/putPreferences.defs.js +22 -0
  162. package/dist/lexicons/chat/bsky/notification/putPreferences.defs.js.map +1 -0
  163. package/dist/lexicons/chat/bsky/notification/putPreferences.js +6 -0
  164. package/dist/lexicons/chat/bsky/notification/putPreferences.js.map +1 -0
  165. package/dist/lexicons/chat/bsky/notification.d.ts +4 -0
  166. package/dist/lexicons/chat/bsky/notification.d.ts.map +1 -0
  167. package/dist/lexicons/chat/bsky/notification.js +7 -0
  168. package/dist/lexicons/chat/bsky/notification.js.map +1 -0
  169. package/dist/lexicons/chat/bsky.d.ts +1 -0
  170. package/dist/lexicons/chat/bsky.d.ts.map +1 -1
  171. package/dist/lexicons/chat/bsky.js +1 -0
  172. package/dist/lexicons/chat/bsky.js.map +1 -1
  173. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts +4 -0
  174. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts.map +1 -1
  175. package/dist/lexicons/tools/ozone/report/defs.defs.js +2 -0
  176. package/dist/lexicons/tools/ozone/report/defs.defs.js.map +1 -1
  177. package/dist/lexicons/tools/ozone/report/queryActivities.d.ts +3 -0
  178. package/dist/lexicons/tools/ozone/report/queryActivities.d.ts.map +1 -0
  179. package/dist/lexicons/tools/ozone/report/queryActivities.defs.d.ts +42 -0
  180. package/dist/lexicons/tools/ozone/report/queryActivities.defs.d.ts.map +1 -0
  181. package/dist/lexicons/tools/ozone/report/queryActivities.defs.js +31 -0
  182. package/dist/lexicons/tools/ozone/report/queryActivities.defs.js.map +1 -0
  183. package/dist/lexicons/tools/ozone/report/queryActivities.js +6 -0
  184. package/dist/lexicons/tools/ozone/report/queryActivities.js.map +1 -0
  185. package/dist/lexicons/tools/ozone/report.d.ts +1 -0
  186. package/dist/lexicons/tools/ozone/report.d.ts.map +1 -1
  187. package/dist/lexicons/tools/ozone/report.js +1 -0
  188. package/dist/lexicons/tools/ozone/report.js.map +1 -1
  189. package/dist/pipethrough.d.ts +3 -0
  190. package/dist/pipethrough.d.ts.map +1 -1
  191. package/dist/pipethrough.js +32 -0
  192. package/dist/pipethrough.js.map +1 -1
  193. package/package.json +13 -13
  194. package/src/background.ts +49 -18
  195. package/src/context.ts +4 -37
  196. package/src/index.ts +31 -13
  197. package/src/pipethrough.ts +38 -1
  198. package/tests/_util.ts +8 -25
  199. package/tests/account-deactivation.test.ts +3 -2
  200. package/tests/account-deletion.test.ts +1 -1
  201. package/tests/account-migration.test.ts +2 -2
  202. package/tests/account-status.test.ts +1 -1
  203. package/tests/account.test.ts +1 -1
  204. package/tests/app-passwords.test.ts +1 -1
  205. package/tests/auth.test.ts +1 -1
  206. package/tests/blob-deletes.test.ts +5 -4
  207. package/tests/create-post.test.ts +1 -1
  208. package/tests/crud.test.ts +1 -1
  209. package/tests/db.test.ts +1 -1
  210. package/tests/email-confirmation.test.ts +1 -1
  211. package/tests/file-uploads.test.ts +2 -2
  212. package/tests/get-service-auth.test.ts +1 -1
  213. package/tests/handles.test.ts +1 -1
  214. package/tests/invite-codes.test.ts +1 -1
  215. package/tests/invites-admin.test.ts +5 -4
  216. package/tests/moderation.test.ts +1 -1
  217. package/tests/moderator-auth.test.ts +1 -1
  218. package/tests/plc-operations.test.ts +3 -2
  219. package/tests/preferences.test.ts +1 -1
  220. package/tests/proxied/admin.test.ts +3 -2
  221. package/tests/proxied/feedgen.test.ts +1 -1
  222. package/tests/proxied/notif.test.ts +6 -13
  223. package/tests/proxied/procedures.test.ts +5 -4
  224. package/tests/proxied/proxy-catchall.test.ts +9 -8
  225. package/tests/proxied/proxy-header.test.ts +14 -9
  226. package/tests/proxied/proxy-oauth-aud.test.ts +17 -10
  227. package/tests/proxied/read-after-write.test.ts +7 -7
  228. package/tests/proxied/views.test.ts +6 -5
  229. package/tests/races.test.ts +1 -1
  230. package/tests/rate-limits.test.ts +1 -1
  231. package/tests/recovery.test.ts +1 -1
  232. package/tests/seeds/basic.ts +2 -2
  233. package/tests/seeds/follows.ts +1 -1
  234. package/tests/seeds/users-bulk.ts +2 -1
  235. package/tests/seeds/users.ts +5 -2
  236. package/tests/sequencer.test.ts +6 -4
  237. package/tests/server.test.ts +11 -13
  238. package/tests/sync/invertible-ops.test.ts +4 -1
  239. package/tests/sync/list.test.ts +1 -1
  240. package/tests/sync/subscribe-repos.test.ts +7 -6
  241. package/tests/sync/sync.test.ts +2 -2
  242. package/tests/takedown-appeal.test.ts +3 -2
  243. package/tsconfig.build.tsbuildinfo +1 -1
@@ -3,6 +3,8 @@ import http from 'node:http'
3
3
  import { AddressInfo } from 'node:net'
4
4
  import * as plc from '@did-plc/lib'
5
5
  import express from 'express'
6
+ // eslint-disable-next-line import/default
7
+ import httpTerminator from 'http-terminator'
6
8
  import { Keypair } from '@atproto/crypto'
7
9
  import { SeedClient, TestNetworkNoAppView, usersSeed } from '@atproto/dev-env'
8
10
  import { ScopePermissions } from '@atproto/oauth-scopes'
@@ -30,7 +32,7 @@ describe('proxy oauth audience', () => {
30
32
  let sc: SeedClient
31
33
  let alice: string
32
34
  let upstream: ProxyServer
33
- let server: http.Server
35
+ let terminator: httpTerminator.HttpTerminator
34
36
  let serverUrl: string
35
37
 
36
38
  beforeAll(async () => {
@@ -88,15 +90,18 @@ describe('proxy oauth audience', () => {
88
90
  res.status(err.status ?? err.statusCode ?? 500).end()
89
91
  },
90
92
  )
91
- server = app.listen(0)
93
+ const server = app.listen(0)
92
94
  await once(server, 'listening')
95
+ terminator = httpTerminator.createHttpTerminator({ server })
93
96
  serverUrl = `http://localhost:${(server.address() as AddressInfo).port}`
94
97
  })
95
98
 
96
99
  afterAll(async () => {
97
- await new Promise<void>((resolve) => server.close(() => resolve()))
98
- await upstream.close()
99
- await network.close()
100
+ await Promise.all([
101
+ terminator?.terminate(),
102
+ upstream?.close(),
103
+ network?.close(),
104
+ ])
100
105
  })
101
106
 
102
107
  it('matches an OAuth rpc scope granted with combined did#serviceId aud', async () => {
@@ -127,11 +132,15 @@ describe('proxy oauth audience', () => {
127
132
  })
128
133
 
129
134
  class ProxyServer {
135
+ private terminator: httpTerminator.HttpTerminator
136
+
130
137
  constructor(
131
- public server: http.Server,
138
+ server: http.Server,
132
139
  public url: string,
133
140
  public did: string,
134
- ) {}
141
+ ) {
142
+ this.terminator = httpTerminator.createHttpTerminator({ server })
143
+ }
135
144
 
136
145
  static async create(
137
146
  plcClient: plc.Client,
@@ -168,8 +177,6 @@ class ProxyServer {
168
177
  }
169
178
 
170
179
  close(): Promise<void> {
171
- return new Promise<void>((resolve) => {
172
- this.server.close(() => resolve())
173
- })
180
+ return this.terminator.terminate()
174
181
  }
175
182
  }
@@ -9,6 +9,7 @@ import {
9
9
  AtpAgent,
10
10
  } from '@atproto/api'
11
11
  import { RecordRef, SeedClient, TestNetwork } from '@atproto/dev-env'
12
+ import type { DidString } from '@atproto/syntax'
12
13
  import { app } from '../../src/lexicons/index.js'
13
14
  import basicSeed from '../seeds/basic.js'
14
15
 
@@ -17,8 +18,8 @@ describe('proxy read after write', () => {
17
18
  let agent: AtpAgent
18
19
  let sc: SeedClient
19
20
 
20
- let alice: string
21
- let carol: string
21
+ let alice: DidString
22
+ let carol: DidString
22
23
 
23
24
  beforeAll(async () => {
24
25
  network = await TestNetwork.create({
@@ -27,15 +28,14 @@ describe('proxy read after write', () => {
27
28
  agent = network.pds.getAgent()
28
29
  sc = network.getSeedClient()
29
30
  await basicSeed(sc, { addModLabels: network.bsky })
30
- await network.processAll()
31
31
  alice = sc.dids.alice
32
32
  carol = sc.dids.carol
33
- await network.bsky.sub.destroy()
33
+ await network.processAll()
34
+ await network.bsky.sub.stop()
34
35
  })
35
36
 
36
- afterAll(async () => {
37
- await network.close()
38
- })
37
+ beforeEach(async () => network.processAll())
38
+ afterAll(async () => network?.close())
39
39
 
40
40
  it('handles read after write on profiles', async () => {
41
41
  await sc.updateProfile(alice, { displayName: 'blah' })
@@ -1,5 +1,6 @@
1
1
  import { AtUri, AtpAgent } from '@atproto/api'
2
2
  import { SeedClient, TestNetwork } from '@atproto/dev-env'
3
+ import type { DidString } from '@atproto/syntax'
3
4
  import { forSnapshot } from '../_util.js'
4
5
  import basicSeed from '../seeds/basic.js'
5
6
 
@@ -8,10 +9,10 @@ describe('proxies view requests', () => {
8
9
  let agent: AtpAgent
9
10
  let sc: SeedClient
10
11
 
11
- let alice: string
12
- let bob: string
13
- let carol: string
14
- let dan: string
12
+ let alice: DidString
13
+ let bob: DidString
14
+ let carol: DidString
15
+ let dan: DidString
15
16
 
16
17
  beforeAll(async () => {
17
18
  network = await TestNetwork.create({
@@ -45,7 +46,7 @@ describe('proxies view requests', () => {
45
46
  })
46
47
 
47
48
  afterAll(async () => {
48
- await network.close()
49
+ await network?.close()
49
50
  })
50
51
 
51
52
  it('actor.getProfile', async () => {
@@ -31,7 +31,7 @@ describe('races', () => {
31
31
  })
32
32
 
33
33
  afterAll(async () => {
34
- await network.close()
34
+ await network?.close()
35
35
  })
36
36
 
37
37
  const processCommitWithWait = async (
@@ -27,7 +27,7 @@ describe('rate limits', () => {
27
27
  })
28
28
 
29
29
  afterAll(async () => {
30
- await network.close()
30
+ await network?.close()
31
31
  })
32
32
 
33
33
  it('rate limits by ip', async () => {
@@ -31,7 +31,7 @@ describe('recovery', () => {
31
31
  })
32
32
 
33
33
  afterAll(async () => {
34
- await network.close()
34
+ await network?.close()
35
35
  })
36
36
 
37
37
  const getStats = (did: string) => {
@@ -2,10 +2,10 @@ import { EXAMPLE_LABELER, SeedClient, TestBsky } from '@atproto/dev-env'
2
2
  import { app, com } from '../../src/lexicons/index.js'
3
3
  import usersSeed from './users.js'
4
4
 
5
- export default async (
5
+ export default async function basicSeed(
6
6
  sc: SeedClient,
7
7
  opts?: { inviteCode?: string; addModLabels?: TestBsky },
8
- ) => {
8
+ ) {
9
9
  await usersSeed(sc, opts)
10
10
 
11
11
  const alice = sc.dids.alice
@@ -54,4 +54,4 @@ const users = {
54
54
  handle: 'eve.test',
55
55
  password: 'eve-pass',
56
56
  },
57
- }
57
+ } as const
@@ -1,5 +1,6 @@
1
1
  import { chunkArray } from '@atproto/common'
2
2
  import { SeedClient } from '@atproto/dev-env'
3
+ import type { HandleString } from '@atproto/syntax'
3
4
 
4
5
  export default async (sc: SeedClient, max = Infinity) => {
5
6
  // @TODO when these are run in parallel, seem to get an intermittent
@@ -41,7 +42,7 @@ export default async (sc: SeedClient, max = Infinity) => {
41
42
  // return sc
42
43
  // }
43
44
 
44
- const users = [
45
+ const users: { handle: HandleString; displayName: string | null }[] = [
45
46
  { handle: 'silas77.test', displayName: 'Tanya Denesik' },
46
47
  { handle: 'nicolas-krajcik10.test', displayName: null },
47
48
  { handle: 'lennie-strosin.test', displayName: null },
@@ -1,6 +1,9 @@
1
1
  import { SeedClient } from '@atproto/dev-env'
2
2
 
3
- export default async (sc: SeedClient, opts?: { inviteCode?: string }) => {
3
+ export default async function usersSeed(
4
+ sc: SeedClient,
5
+ opts?: { inviteCode?: string },
6
+ ) {
4
7
  await sc.createAccount('alice', {
5
8
  ...users.alice,
6
9
  inviteCode: opts?.inviteCode,
@@ -61,4 +64,4 @@ export const users = {
61
64
  description: undefined,
62
65
  selfLabels: undefined,
63
66
  },
64
- }
67
+ } as const
@@ -7,6 +7,7 @@ import {
7
7
  import { randomStr } from '@atproto/crypto'
8
8
  import { SeedClient, TestNetworkNoAppView } from '@atproto/dev-env'
9
9
  import { readCarWithRoot } from '@atproto/repo'
10
+ import type { DidString } from '@atproto/syntax'
10
11
  import {
11
12
  SeqEvt,
12
13
  Sequencer,
@@ -20,8 +21,8 @@ describe('sequencer', () => {
20
21
  let network: TestNetworkNoAppView
21
22
  let sequencer: Sequencer
22
23
  let sc: SeedClient
23
- let alice: string
24
- let bob: string
24
+ let alice: DidString
25
+ let bob: DidString
25
26
 
26
27
  let totalEvts
27
28
  let lastSeen: number
@@ -45,10 +46,11 @@ describe('sequencer', () => {
45
46
  })
46
47
 
47
48
  afterAll(async () => {
48
- await network.close()
49
+ await network?.close()
49
50
  })
50
51
 
51
- const randomPost = async (by: string) => sc.post(by, randomStr(8, 'base32'))
52
+ const randomPost = async (by: DidString) =>
53
+ sc.post(by, randomStr(8, 'base32'))
52
54
  const createPosts = async (count: number): Promise<void> => {
53
55
  const promises: Promise<unknown>[] = []
54
56
  for (let i = 0; i < count; i++) {
@@ -4,6 +4,7 @@ import { request } from 'undici'
4
4
  import { AtUri, AtpAgent } from '@atproto/api'
5
5
  import { randomStr } from '@atproto/crypto'
6
6
  import { SeedClient, TestNetworkNoAppView } from '@atproto/dev-env'
7
+ import type { DidString } from '@atproto/syntax'
7
8
  import { handler as errorHandler } from '../src/error.js'
8
9
  import { startServer } from './_util.js'
9
10
  import basicSeed from './seeds/basic.js'
@@ -12,7 +13,7 @@ describe('server', () => {
12
13
  let network: TestNetworkNoAppView
13
14
  let agent: AtpAgent
14
15
  let sc: SeedClient
15
- let alice: string
16
+ let alice: DidString
16
17
 
17
18
  beforeAll(async () => {
18
19
  network = await TestNetworkNoAppView.create({
@@ -28,7 +29,7 @@ describe('server', () => {
28
29
  })
29
30
 
30
31
  afterAll(async () => {
31
- await network.close()
32
+ await network?.close()
32
33
  })
33
34
 
34
35
  it('preserves 404s.', async () => {
@@ -43,17 +44,14 @@ describe('server', () => {
43
44
  })
44
45
  .use(errorHandler)
45
46
 
46
- const { origin, stop } = await startServer(app)
47
- try {
48
- const res = await fetch(new URL(`/oops`, origin))
49
- expect(res.status).toEqual(500)
50
- await expect(res.json()).resolves.toEqual({
51
- error: 'InternalServerError',
52
- message: 'Internal Server Error',
53
- })
54
- } finally {
55
- await stop()
56
- }
47
+ await using server = await startServer(app)
48
+
49
+ const res = await fetch(`http://localhost:${server.port}/oops`)
50
+ expect(res.status).toEqual(500)
51
+ await expect(res.json()).resolves.toEqual({
52
+ error: 'InternalServerError',
53
+ message: 'Internal Server Error',
54
+ })
57
55
  })
58
56
 
59
57
  it('limits size of json input.', async () => {
@@ -1,6 +1,8 @@
1
+ import assert from 'node:assert'
1
2
  import { AtUri } from '@atproto/api'
2
3
  import { SeedClient, TestNetworkNoAppView } from '@atproto/dev-env'
3
4
  import * as repo from '@atproto/repo'
5
+ import { isValidDid } from '@atproto/syntax'
4
6
  import { Subscription } from '@atproto/xrpc-server'
5
7
  import { com } from '../../src/lexicons.js'
6
8
  import basicSeed from '../seeds/basic.js'
@@ -33,6 +35,7 @@ describe('invertible ops', () => {
33
35
  ]
34
36
  }
35
37
  for (const post of posts) {
38
+ assert(isValidDid(post.hostname))
36
39
  await sc.deletePost(post.hostname, post)
37
40
  }
38
41
 
@@ -40,7 +43,7 @@ describe('invertible ops', () => {
40
43
  })
41
44
 
42
45
  afterAll(async () => {
43
- await network.close()
46
+ await network?.close()
44
47
  })
45
48
 
46
49
  it('works', async () => {
@@ -17,7 +17,7 @@ describe('sync listing', () => {
17
17
  })
18
18
 
19
19
  afterAll(async () => {
20
- await network.close()
20
+ await network?.close()
21
21
  })
22
22
 
23
23
  it('lists hosted repos in order of creation', async () => {
@@ -12,6 +12,7 @@ import { SeedClient, TestNetworkNoAppView } from '@atproto/dev-env'
12
12
  import { Cid } from '@atproto/lex-data'
13
13
  import * as repo from '@atproto/repo'
14
14
  import { readCar } from '@atproto/repo'
15
+ import type { DidString } from '@atproto/syntax'
15
16
  import { ErrorFrame, Frame, MessageFrame, byFrame } from '@atproto/xrpc-server'
16
17
  import { AccountStatus } from '../../src/account-manager/account-manager.js'
17
18
  import { AppContext } from '../../src/index.js'
@@ -26,10 +27,10 @@ describe('repo subscribe repos', () => {
26
27
 
27
28
  let agent: AtpAgent
28
29
  let sc: SeedClient
29
- let alice: string
30
- let bob: string
31
- let carol: string
32
- let dan: string
30
+ let alice: DidString
31
+ let bob: DidString
32
+ let carol: DidString
33
+ let dan: DidString
33
34
 
34
35
  beforeAll(async () => {
35
36
  network = await TestNetworkNoAppView.create({
@@ -51,7 +52,7 @@ describe('repo subscribe repos', () => {
51
52
  })
52
53
 
53
54
  afterAll(async () => {
54
- await network.close()
55
+ await network?.close()
55
56
  })
56
57
 
57
58
  const getRepo = async (did: string): Promise<repo.VerifiedRepo> => {
@@ -219,7 +220,7 @@ describe('repo subscribe repos', () => {
219
220
  }
220
221
  }
221
222
 
222
- const randomPost = (by: string) => sc.post(by, randomStr(8, 'base32'))
223
+ const randomPost = (by: DidString) => sc.post(by, randomStr(8, 'base32'))
223
224
  const makePosts = async () => {
224
225
  for (let i = 0; i < 10; i++) {
225
226
  await Promise.all([
@@ -39,7 +39,7 @@ describe('repo sync', () => {
39
39
  })
40
40
 
41
41
  afterAll(async () => {
42
- await network.close()
42
+ await network?.close()
43
43
  })
44
44
 
45
45
  it('creates and syncs some records', async () => {
@@ -301,7 +301,7 @@ describe('repo sync', () => {
301
301
  })
302
302
  })
303
303
 
304
- const makePost = async (sc: SeedClient, did: string) => {
304
+ const makePost = async (sc: SeedClient, did: DidString) => {
305
305
  const res = await sc.post(did, randomStr(32, 'base32'))
306
306
  const uri = res.ref.uri
307
307
  const data = await sc.client.call(com.atproto.repo.getRecord, {
@@ -1,12 +1,13 @@
1
1
  import { AtpAgent, ComAtprotoModerationDefs } from '@atproto/api'
2
2
  import { SeedClient, TestNetwork } from '@atproto/dev-env'
3
+ import type { DidString } from '@atproto/syntax'
3
4
  import { forSubjectStatusSnapshot } from './_util.js'
4
5
 
5
6
  describe('appeal account takedown', () => {
6
7
  let network: TestNetwork
7
8
  let agent: AtpAgent
8
9
  let sc: SeedClient
9
- let moderator: string
10
+ let moderator: DidString
10
11
 
11
12
  beforeAll(async () => {
12
13
  network = await TestNetwork.create({
@@ -25,7 +26,7 @@ describe('appeal account takedown', () => {
25
26
  })
26
27
 
27
28
  afterAll(async () => {
28
- await network.close()
29
+ await network?.close()
29
30
  })
30
31
 
31
32
  it('actor takedown allows appeal request.', async () => {