@atproto/api 0.7.4 → 0.9.0

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 (412) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +2 -2
  3. package/dist/client/index.d.ts +41 -37
  4. package/dist/client/lexicons.d.ts +113 -48
  5. package/dist/client/types/app/bsky/actor/createScene.d.ts +32 -0
  6. package/dist/client/types/app/bsky/actor/defs.d.ts +1 -1
  7. package/dist/client/types/app/bsky/actor/getPreferences.d.ts +1 -1
  8. package/dist/client/types/app/bsky/actor/getProfile.d.ts +2 -2
  9. package/dist/client/types/app/bsky/actor/getProfiles.d.ts +1 -1
  10. package/dist/client/types/app/bsky/actor/getSuggestions.d.ts +1 -1
  11. package/dist/client/types/app/bsky/actor/ref.d.ts +28 -0
  12. package/dist/client/types/app/bsky/actor/search.d.ts +22 -0
  13. package/dist/client/types/app/bsky/actor/searchActor.d.ts +22 -0
  14. package/dist/client/types/app/bsky/actor/searchActorTypeahead.d.ts +20 -0
  15. package/dist/client/types/app/bsky/actor/searchActors.d.ts +1 -1
  16. package/dist/client/types/app/bsky/actor/searchActorsTypeahead.d.ts +1 -1
  17. package/dist/client/types/app/bsky/actor/searchTypeahead.d.ts +20 -0
  18. package/dist/client/types/app/bsky/actor/updateProfile.d.ts +47 -0
  19. package/dist/client/types/app/bsky/feed/bookmarkFeed.d.ts +17 -0
  20. package/dist/client/types/app/bsky/feed/describeFeedGenerator.d.ts +1 -1
  21. package/dist/client/types/app/bsky/feed/feedViewPost.d.ts +28 -0
  22. package/dist/client/types/app/bsky/feed/getActorFeeds.d.ts +1 -1
  23. package/dist/client/types/app/bsky/feed/getActorLikes.d.ts +1 -1
  24. package/dist/client/types/app/bsky/feed/getAuthorFeed.d.ts +1 -1
  25. package/dist/client/types/app/bsky/feed/getBookmarkedFeeds.d.ts +21 -0
  26. package/dist/client/types/app/bsky/feed/getFeed.d.ts +1 -1
  27. package/dist/client/types/app/bsky/feed/getFeedGenerator.d.ts +1 -1
  28. package/dist/client/types/app/bsky/feed/getFeedGenerators.d.ts +1 -1
  29. package/dist/client/types/app/bsky/feed/getFeedSkeleton.d.ts +1 -1
  30. package/dist/client/types/app/bsky/feed/getLikes.d.ts +1 -1
  31. package/dist/client/types/app/bsky/feed/getListFeed.d.ts +1 -1
  32. package/dist/client/types/app/bsky/feed/getPostThread.d.ts +1 -1
  33. package/dist/client/types/app/bsky/feed/getPosts.d.ts +1 -1
  34. package/dist/client/types/app/bsky/feed/getRepostedBy.d.ts +1 -1
  35. package/dist/client/types/app/bsky/feed/getSavedFeeds.d.ts +21 -0
  36. package/dist/client/types/app/bsky/feed/getSuggestedFeeds.d.ts +1 -1
  37. package/dist/client/types/app/bsky/feed/getTimeline.d.ts +1 -1
  38. package/dist/client/types/app/bsky/feed/getVotes.d.ts +36 -0
  39. package/dist/client/types/app/bsky/feed/saveFeed.d.ts +17 -0
  40. package/dist/client/types/app/bsky/feed/searchPosts.d.ts +1 -1
  41. package/dist/client/types/app/bsky/feed/setVote.d.ts +25 -0
  42. package/dist/client/types/app/bsky/feed/trend.d.ts +9 -0
  43. package/dist/client/types/app/bsky/feed/unbookmarkFeed.d.ts +17 -0
  44. package/dist/client/types/app/bsky/feed/unsaveFeed.d.ts +17 -0
  45. package/dist/client/types/app/bsky/feed/vote.d.ts +10 -0
  46. package/dist/client/types/app/bsky/graph/assertCreator.d.ts +1 -0
  47. package/dist/client/types/app/bsky/graph/assertMember.d.ts +1 -0
  48. package/dist/client/types/app/bsky/graph/assertion.d.ts +10 -0
  49. package/dist/client/types/app/bsky/graph/confirmation.d.ts +11 -0
  50. package/dist/client/types/app/bsky/graph/defs.d.ts +1 -1
  51. package/dist/client/types/app/bsky/graph/getAssertions.d.ts +48 -0
  52. package/dist/client/types/app/bsky/graph/getBlocks.d.ts +1 -1
  53. package/dist/client/types/app/bsky/graph/getFollowers.d.ts +1 -1
  54. package/dist/client/types/app/bsky/graph/getFollows.d.ts +1 -1
  55. package/dist/client/types/app/bsky/graph/getList.d.ts +1 -1
  56. package/dist/client/types/app/bsky/graph/getListBlocks.d.ts +1 -1
  57. package/dist/client/types/app/bsky/graph/getListMutes.d.ts +1 -1
  58. package/dist/client/types/app/bsky/graph/getLists.d.ts +1 -1
  59. package/dist/client/types/app/bsky/graph/getMembers.d.ts +36 -0
  60. package/dist/client/types/app/bsky/graph/getMemberships.d.ts +36 -0
  61. package/dist/client/types/app/bsky/graph/getMutes.d.ts +1 -1
  62. package/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +1 -1
  63. package/dist/client/types/app/bsky/graph/mute.d.ts +17 -0
  64. package/dist/client/types/app/bsky/graph/unmute.d.ts +17 -0
  65. package/dist/client/types/app/bsky/moderation/defs.d.ts +49 -0
  66. package/dist/client/types/app/bsky/moderation/getService.d.ts +16 -0
  67. package/dist/client/types/app/bsky/moderation/getServices.d.ts +19 -0
  68. package/dist/client/types/app/bsky/moderation/service.d.ts +17 -0
  69. package/dist/client/types/app/bsky/notification/getCount.d.ts +17 -0
  70. package/dist/client/types/app/bsky/notification/getUnreadCount.d.ts +1 -1
  71. package/dist/client/types/app/bsky/notification/list.d.ts +35 -0
  72. package/dist/client/types/app/bsky/notification/listNotifications.d.ts +1 -1
  73. package/dist/client/types/app/bsky/system/actorScene.d.ts +1 -0
  74. package/dist/client/types/app/bsky/system/actorUser.d.ts +1 -0
  75. package/dist/client/types/app/bsky/system/declRef.d.ts +8 -0
  76. package/dist/client/types/app/bsky/system/declaration.d.ts +7 -0
  77. package/dist/client/types/app/bsky/unspecced/applyLabels.d.ts +18 -0
  78. package/dist/client/types/app/bsky/unspecced/getPopular.d.ts +1 -1
  79. package/dist/client/types/app/bsky/unspecced/getPopularFeedGenerators.d.ts +1 -1
  80. package/dist/client/types/app/bsky/unspecced/getTimelineSkeleton.d.ts +1 -1
  81. package/dist/client/types/app/bsky/unspecced/searchActorsSkeleton.d.ts +1 -1
  82. package/dist/client/types/app/bsky/unspecced/searchPostsSkeleton.d.ts +1 -1
  83. package/dist/client/types/com/atproto/account/create.d.ts +41 -0
  84. package/dist/client/types/com/atproto/account/createInviteCode.d.ts +22 -0
  85. package/dist/client/types/com/atproto/account/delete.d.ts +25 -0
  86. package/dist/client/types/com/atproto/account/get.d.ts +12 -0
  87. package/dist/client/types/com/atproto/account/requestDelete.d.ts +13 -0
  88. package/dist/client/types/com/atproto/account/requestPasswordReset.d.ts +17 -0
  89. package/dist/client/types/com/atproto/account/resetPassword.d.ts +24 -0
  90. package/dist/client/types/com/atproto/admin/blob.d.ts +37 -0
  91. package/dist/client/types/com/atproto/admin/defs.d.ts +12 -2
  92. package/dist/client/types/com/atproto/admin/emitModerationEvent.d.ts +1 -1
  93. package/dist/client/types/com/atproto/admin/getAccountInfo.d.ts +2 -2
  94. package/dist/client/types/com/atproto/admin/getAccountInfos.d.ts +19 -0
  95. package/dist/client/types/com/atproto/admin/getInviteCodeUsage.d.ts +29 -0
  96. package/dist/client/types/com/atproto/admin/getInviteCodes.d.ts +1 -1
  97. package/dist/client/types/com/atproto/admin/getModerationAction.d.ts +16 -0
  98. package/dist/client/types/com/atproto/admin/getModerationActions.d.ts +22 -0
  99. package/dist/client/types/com/atproto/admin/getModerationEvent.d.ts +2 -2
  100. package/dist/client/types/com/atproto/admin/getModerationReport.d.ts +16 -0
  101. package/dist/client/types/com/atproto/admin/getModerationReports.d.ts +28 -0
  102. package/dist/client/types/com/atproto/admin/getRecord.d.ts +2 -2
  103. package/dist/client/types/com/atproto/admin/getRepo.d.ts +2 -2
  104. package/dist/client/types/com/atproto/admin/getSubjectState.d.ts +26 -0
  105. package/dist/client/types/com/atproto/admin/getSubjectStatus.d.ts +1 -1
  106. package/dist/client/types/com/atproto/admin/getUserAccountInfo.d.ts +16 -0
  107. package/dist/client/types/com/atproto/admin/moderationAction.d.ts +60 -0
  108. package/dist/client/types/com/atproto/admin/moderationReport.d.ts +37 -0
  109. package/dist/client/types/com/atproto/admin/queryModerationEvents.d.ts +1 -1
  110. package/dist/client/types/com/atproto/admin/queryModerationStatuses.d.ts +2 -1
  111. package/dist/client/types/com/atproto/admin/rebaseRepo.d.ts +24 -0
  112. package/dist/client/types/com/atproto/admin/record.d.ts +43 -0
  113. package/dist/client/types/com/atproto/admin/repo.d.ts +45 -0
  114. package/dist/client/types/com/atproto/admin/resolveModerationReports.d.ts +22 -0
  115. package/dist/client/types/com/atproto/admin/reverseModerationAction.d.ts +22 -0
  116. package/dist/client/types/com/atproto/admin/searchRepos.d.ts +1 -1
  117. package/dist/client/types/com/atproto/admin/sendEmail.d.ts +1 -0
  118. package/dist/client/types/com/atproto/admin/takeModerationAction.d.ts +34 -0
  119. package/dist/client/types/com/atproto/admin/updateSubjectState.d.ts +32 -0
  120. package/dist/client/types/com/atproto/blob/upload.d.ts +19 -0
  121. package/dist/client/types/com/atproto/handle/resolve.d.ts +18 -0
  122. package/dist/client/types/com/atproto/handle/update.d.ts +17 -0
  123. package/dist/client/types/com/atproto/identity/resolveHandle.d.ts +1 -1
  124. package/dist/client/types/com/atproto/label/queryLabels.d.ts +1 -1
  125. package/dist/client/types/com/atproto/moderation/defs.d.ts +2 -1
  126. package/dist/client/types/com/atproto/repo/batchWrite.d.ts +46 -0
  127. package/dist/client/types/com/atproto/repo/describe.d.ts +22 -0
  128. package/dist/client/types/com/atproto/repo/describeRepo.d.ts +1 -1
  129. package/dist/client/types/com/atproto/repo/getRecord.d.ts +1 -1
  130. package/dist/client/types/com/atproto/repo/importRepo.d.ts +19 -0
  131. package/dist/client/types/com/atproto/repo/listRecords.d.ts +1 -1
  132. package/dist/client/types/com/atproto/repo/rebaseRepo.d.ts +24 -0
  133. package/dist/client/types/com/atproto/repo/recordRef.d.ts +8 -0
  134. package/dist/client/types/com/atproto/repo/repoRef.d.ts +7 -0
  135. package/dist/client/types/com/atproto/repo/uploadBlob.d.ts +1 -1
  136. package/dist/client/types/com/atproto/repo/uploadRepo.d.ts +19 -0
  137. package/dist/client/types/com/atproto/report/create.d.ts +39 -0
  138. package/dist/client/types/com/atproto/report/reasonType.d.ts +3 -0
  139. package/dist/client/types/com/atproto/report/subject.d.ts +23 -0
  140. package/dist/client/types/com/atproto/server/createAccount.d.ts +2 -0
  141. package/dist/client/types/com/atproto/server/createAppPassword.d.ts +1 -1
  142. package/dist/client/types/com/atproto/server/deleteSession.d.ts +1 -1
  143. package/dist/client/types/com/atproto/server/describeServer.d.ts +2 -1
  144. package/dist/client/types/com/atproto/server/getAccountInviteCodes.d.ts +1 -1
  145. package/dist/client/types/com/atproto/server/getAccountsConfig.d.ts +27 -0
  146. package/dist/client/types/com/atproto/server/getSession.d.ts +1 -1
  147. package/dist/client/types/com/atproto/server/getUserInviteCodes.d.ts +31 -0
  148. package/dist/client/types/com/atproto/server/listAppPasswords.d.ts +1 -1
  149. package/dist/client/types/com/atproto/server/refreshSession.d.ts +1 -1
  150. package/dist/client/types/com/atproto/server/requestAccountDelete.d.ts +1 -1
  151. package/dist/client/types/com/atproto/server/requestEmailConfirmation.d.ts +1 -1
  152. package/dist/client/types/com/atproto/server/requestEmailUpdate.d.ts +1 -1
  153. package/dist/client/types/com/atproto/session/create.d.ts +29 -0
  154. package/dist/client/types/com/atproto/session/delete.d.ts +13 -0
  155. package/dist/client/types/com/atproto/session/get.d.ts +18 -0
  156. package/dist/client/types/com/atproto/session/refresh.d.ts +24 -0
  157. package/dist/client/types/com/atproto/sync/getBlob.d.ts +1 -1
  158. package/dist/client/types/com/atproto/sync/getBlocks.d.ts +1 -1
  159. package/dist/client/types/com/atproto/sync/getCheckout.d.ts +1 -1
  160. package/dist/client/types/com/atproto/sync/getCommitPath.d.ts +20 -0
  161. package/dist/client/types/com/atproto/sync/getCurrent.d.ts +22 -0
  162. package/dist/client/types/com/atproto/sync/getHead.d.ts +1 -1
  163. package/dist/client/types/com/atproto/sync/getLatestCommit.d.ts +1 -1
  164. package/dist/client/types/com/atproto/sync/getRecord.d.ts +1 -1
  165. package/dist/client/types/com/atproto/sync/getRepo.d.ts +1 -1
  166. package/dist/client/types/com/atproto/sync/getRoot.d.ts +21 -0
  167. package/dist/client/types/com/atproto/sync/importRepo.d.ts +16 -0
  168. package/dist/client/types/com/atproto/sync/listBlobs.d.ts +1 -1
  169. package/dist/client/types/com/atproto/sync/listRepos.d.ts +1 -1
  170. package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +9 -0
  171. package/dist/client/types/com/atproto/sync/updateRepo.d.ts +15 -0
  172. package/dist/client/types/com/atproto/temp/fetchLabels.d.ts +1 -1
  173. package/dist/client/types/com/atproto/temp/importRepo.d.ts +1 -1
  174. package/dist/client/types/com/atproto/temp/pushBlob.d.ts +1 -1
  175. package/dist/client/types/com/atproto/temp/requestPhoneVerification.d.ts +17 -0
  176. package/dist/client/types/com/atproto/temp/upgradeRepoVersion.d.ts +18 -0
  177. package/dist/index.js +535 -437
  178. package/dist/index.js.map +3 -3
  179. package/dist/moderation/types.d.ts +14 -14
  180. package/dist/rich-text/detection.d.ts +1 -1
  181. package/dist/rich-text/rich-text.d.ts +5 -5
  182. package/dist/session.d.ts +42 -0
  183. package/dist/src/client/index.d.ts +462 -0
  184. package/dist/src/client/lexicons.d.ts +2910 -0
  185. package/dist/src/client/schemas.d.ts +17 -0
  186. package/dist/src/client/types/app/bsky/actor/createScene.d.ts +32 -0
  187. package/dist/src/client/types/app/bsky/actor/getProfile.d.ts +36 -0
  188. package/dist/src/client/types/app/bsky/actor/getSuggestions.d.ts +36 -0
  189. package/dist/src/client/types/app/bsky/actor/profile.d.ts +15 -0
  190. package/dist/src/client/types/app/bsky/actor/ref.d.ts +14 -0
  191. package/dist/src/client/types/app/bsky/actor/search.d.ts +32 -0
  192. package/dist/src/client/types/app/bsky/actor/searchTypeahead.d.ts +28 -0
  193. package/dist/src/client/types/app/bsky/actor/updateProfile.d.ts +48 -0
  194. package/dist/src/client/types/app/bsky/badge.d.ts +22 -0
  195. package/dist/src/client/types/app/bsky/badgeAccept.d.ts +11 -0
  196. package/dist/src/client/types/app/bsky/badgeOffer.d.ts +11 -0
  197. package/dist/src/client/types/app/bsky/declaration.d.ts +6 -0
  198. package/dist/src/client/types/app/bsky/embed/external.d.ts +26 -0
  199. package/dist/src/client/types/app/bsky/embed/images.d.ts +23 -0
  200. package/dist/src/client/types/app/bsky/feed/embed.d.ts +36 -0
  201. package/dist/src/client/types/app/bsky/feed/feedViewPost.d.ts +26 -0
  202. package/dist/src/client/types/app/bsky/feed/getAuthorFeed.d.ts +22 -0
  203. package/dist/src/client/types/app/bsky/feed/getPostThread.d.ts +43 -0
  204. package/dist/src/client/types/app/bsky/feed/getRepostedBy.d.ts +35 -0
  205. package/dist/src/client/types/app/bsky/feed/getTimeline.d.ts +22 -0
  206. package/dist/src/client/types/app/bsky/feed/getVotes.d.ts +33 -0
  207. package/dist/src/client/types/app/bsky/feed/mediaEmbed.d.ts +18 -0
  208. package/dist/src/client/types/app/bsky/feed/post.d.ts +54 -0
  209. package/dist/src/client/types/app/bsky/feed/repost.d.ts +6 -0
  210. package/dist/src/client/types/app/bsky/feed/setVote.d.ts +25 -0
  211. package/dist/src/client/types/app/bsky/feed/trend.d.ts +6 -0
  212. package/dist/src/client/types/app/bsky/feed/vote.d.ts +7 -0
  213. package/dist/src/client/types/app/bsky/follow.d.ts +9 -0
  214. package/dist/src/client/types/app/bsky/getAuthorFeed.d.ts +56 -0
  215. package/dist/src/client/types/app/bsky/getBadgeMembers.d.ts +29 -0
  216. package/dist/src/client/types/app/bsky/getHomeFeed.d.ts +56 -0
  217. package/dist/src/client/types/app/bsky/getLikedBy.d.ts +29 -0
  218. package/dist/src/client/types/app/bsky/getNotificationCount.d.ts +16 -0
  219. package/dist/src/client/types/app/bsky/getNotifications.d.ts +33 -0
  220. package/dist/src/client/types/app/bsky/getPostThread.d.ts +55 -0
  221. package/dist/src/client/types/app/bsky/getProfile.d.ts +26 -0
  222. package/dist/src/client/types/app/bsky/getRepostedBy.d.ts +29 -0
  223. package/dist/src/client/types/app/bsky/getTimeline.d.ts +56 -0
  224. package/dist/src/client/types/app/bsky/getUserFollowers.d.ts +31 -0
  225. package/dist/src/client/types/app/bsky/getUserFollows.d.ts +31 -0
  226. package/dist/src/client/types/app/bsky/getUsersSearch.d.ts +26 -0
  227. package/dist/src/client/types/app/bsky/getUsersTypeahead.d.ts +22 -0
  228. package/dist/src/client/types/app/bsky/graph/assertCreator.d.ts +1 -0
  229. package/dist/src/client/types/app/bsky/graph/assertMember.d.ts +1 -0
  230. package/dist/src/client/types/app/bsky/graph/assertion.d.ts +7 -0
  231. package/dist/src/client/types/app/bsky/graph/confirmation.d.ts +8 -0
  232. package/dist/src/client/types/app/bsky/graph/follow.d.ts +6 -0
  233. package/dist/src/client/types/app/bsky/graph/getAssertions.d.ts +43 -0
  234. package/dist/src/client/types/app/bsky/graph/getFollowers.d.ts +34 -0
  235. package/dist/src/client/types/app/bsky/graph/getFollows.d.ts +33 -0
  236. package/dist/src/client/types/app/bsky/graph/getMembers.d.ts +33 -0
  237. package/dist/src/client/types/app/bsky/graph/getMemberships.d.ts +33 -0
  238. package/dist/src/client/types/app/bsky/invite.d.ts +10 -0
  239. package/dist/src/client/types/app/bsky/inviteAccept.d.ts +14 -0
  240. package/dist/src/client/types/app/bsky/like.d.ts +10 -0
  241. package/dist/src/client/types/app/bsky/mediaEmbed.d.ts +15 -0
  242. package/dist/src/client/types/app/bsky/notification/getCount.d.ts +17 -0
  243. package/dist/src/client/types/app/bsky/notification/list.d.ts +32 -0
  244. package/dist/src/client/types/app/bsky/notification/updateSeen.d.ts +17 -0
  245. package/dist/src/client/types/app/bsky/post.d.ts +23 -0
  246. package/dist/src/client/types/app/bsky/postNotificationsSeen.d.ts +20 -0
  247. package/dist/src/client/types/app/bsky/profile.d.ts +5 -0
  248. package/dist/src/client/types/app/bsky/repost.d.ts +10 -0
  249. package/dist/src/client/types/app/bsky/system/actorScene.d.ts +1 -0
  250. package/dist/src/client/types/app/bsky/system/actorUser.d.ts +1 -0
  251. package/dist/src/client/types/app/bsky/system/declRef.d.ts +5 -0
  252. package/dist/src/client/types/app/bsky/system/declaration.d.ts +4 -0
  253. package/dist/src/client/types/app/bsky/updateProfile.d.ts +23 -0
  254. package/dist/src/client/types/com/atproto/account/create.d.ts +41 -0
  255. package/dist/src/client/types/com/atproto/account/createInviteCode.d.ts +22 -0
  256. package/dist/src/client/types/com/atproto/account/delete.d.ts +13 -0
  257. package/dist/src/client/types/com/atproto/account/get.d.ts +12 -0
  258. package/dist/src/client/types/com/atproto/account/requestPasswordReset.d.ts +17 -0
  259. package/dist/src/client/types/com/atproto/account/resetPassword.d.ts +24 -0
  260. package/dist/src/client/types/com/atproto/blob/upload.d.ts +19 -0
  261. package/dist/src/client/types/com/atproto/createAccount.d.ts +40 -0
  262. package/dist/src/client/types/com/atproto/createInviteCode.d.ts +20 -0
  263. package/dist/src/client/types/com/atproto/createSession.d.ts +24 -0
  264. package/dist/src/client/types/com/atproto/data/uploadFile.d.ts +19 -0
  265. package/dist/src/client/types/com/atproto/deleteAccount.d.ts +20 -0
  266. package/dist/src/client/types/com/atproto/deleteSession.d.ts +17 -0
  267. package/dist/src/client/types/com/atproto/getAccount.d.ts +16 -0
  268. package/dist/src/client/types/com/atproto/getAccountsConfig.d.ts +17 -0
  269. package/dist/src/client/types/com/atproto/getSession.d.ts +17 -0
  270. package/dist/src/client/types/com/atproto/handle/resolve.d.ts +18 -0
  271. package/dist/src/client/types/com/atproto/refreshSession.d.ts +20 -0
  272. package/dist/src/client/types/com/atproto/repo/batchWrite.d.ts +39 -0
  273. package/dist/src/client/types/com/atproto/repo/createRecord.d.ts +26 -0
  274. package/dist/src/client/types/com/atproto/repo/deleteRecord.d.ts +19 -0
  275. package/dist/src/client/types/com/atproto/repo/describe.d.ts +22 -0
  276. package/dist/src/client/types/com/atproto/repo/getRecord.d.ts +23 -0
  277. package/dist/src/client/types/com/atproto/repo/listRecords.d.ts +30 -0
  278. package/dist/src/client/types/com/atproto/repo/putRecord.d.ts +27 -0
  279. package/dist/src/client/types/com/atproto/repo/strongRef.d.ts +5 -0
  280. package/dist/src/client/types/com/atproto/repoBatchWrite.d.ts +36 -0
  281. package/dist/src/client/types/com/atproto/repoCreateRecord.d.ts +24 -0
  282. package/dist/src/client/types/com/atproto/repoDeleteRecord.d.ts +18 -0
  283. package/dist/src/client/types/com/atproto/repoDescribe.d.ts +21 -0
  284. package/dist/src/client/types/com/atproto/repoGetRecord.d.ts +22 -0
  285. package/dist/src/client/types/com/atproto/repoListRecords.d.ts +27 -0
  286. package/dist/src/client/types/com/atproto/repoPutRecord.d.ts +25 -0
  287. package/dist/src/client/types/com/atproto/requestAccountPasswordReset.d.ts +19 -0
  288. package/dist/src/client/types/com/atproto/resetAccountPassword.d.ts +26 -0
  289. package/dist/src/client/types/com/atproto/resolveHandle.d.ts +17 -0
  290. package/dist/src/client/types/com/atproto/resolveName.d.ts +17 -0
  291. package/dist/src/client/types/com/atproto/server/getAccountsConfig.d.ts +24 -0
  292. package/dist/src/client/types/com/atproto/session/create.d.ts +26 -0
  293. package/dist/src/client/types/com/atproto/session/delete.d.ts +13 -0
  294. package/dist/src/client/types/com/atproto/session/get.d.ts +18 -0
  295. package/dist/src/client/types/com/atproto/session/refresh.d.ts +21 -0
  296. package/dist/src/client/types/com/atproto/sync/getRepo.d.ts +15 -0
  297. package/dist/src/client/types/com/atproto/sync/getRoot.d.ts +18 -0
  298. package/dist/src/client/types/com/atproto/sync/updateRepo.d.ts +15 -0
  299. package/dist/src/client/types/com/atproto/syncGetRepo.d.ts +15 -0
  300. package/dist/src/client/types/com/atproto/syncGetRoot.d.ts +17 -0
  301. package/dist/src/client/types/com/atproto/syncUpdateRepo.d.ts +15 -0
  302. package/dist/src/index.d.ts +4 -0
  303. package/dist/src/schemas.d.ts +19 -0
  304. package/dist/src/session.d.ts +42 -0
  305. package/dist/src/types/app/bsky/acceptedBadge.d.ts +10 -0
  306. package/dist/src/types/app/bsky/badge.d.ts +22 -0
  307. package/dist/src/types/app/bsky/badgeAccept.d.ts +11 -0
  308. package/dist/src/types/app/bsky/badgeOffer.d.ts +11 -0
  309. package/dist/src/types/app/bsky/declaration.d.ts +6 -0
  310. package/dist/src/types/app/bsky/follow.d.ts +9 -0
  311. package/dist/src/types/app/bsky/getAuthorFeed.d.ts +56 -0
  312. package/dist/src/types/app/bsky/getBadgeMembers.d.ts +29 -0
  313. package/dist/src/types/app/bsky/getHomeFeed.d.ts +56 -0
  314. package/dist/src/types/app/bsky/getLikedBy.d.ts +29 -0
  315. package/dist/src/types/app/bsky/getNotificationCount.d.ts +16 -0
  316. package/dist/src/types/app/bsky/getNotifications.d.ts +33 -0
  317. package/dist/src/types/app/bsky/getPostThread.d.ts +55 -0
  318. package/dist/src/types/app/bsky/getProfile.d.ts +42 -0
  319. package/dist/src/types/app/bsky/getRepostedBy.d.ts +29 -0
  320. package/dist/src/types/app/bsky/getUserFollowers.d.ts +31 -0
  321. package/dist/src/types/app/bsky/getUserFollows.d.ts +31 -0
  322. package/dist/src/types/app/bsky/getUsersSearch.d.ts +26 -0
  323. package/dist/src/types/app/bsky/getUsersTypeahead.d.ts +22 -0
  324. package/dist/src/types/app/bsky/invite.d.ts +10 -0
  325. package/dist/src/types/app/bsky/inviteAccept.d.ts +14 -0
  326. package/dist/src/types/app/bsky/like.d.ts +10 -0
  327. package/dist/src/types/app/bsky/mediaEmbed.d.ts +15 -0
  328. package/dist/src/types/app/bsky/post.d.ts +23 -0
  329. package/dist/src/types/app/bsky/postNotificationsSeen.d.ts +19 -0
  330. package/dist/src/types/app/bsky/profile.d.ts +11 -0
  331. package/dist/src/types/app/bsky/repost.d.ts +10 -0
  332. package/dist/src/types/app/bsky/updateProfile.d.ts +27 -0
  333. package/dist/src/types/com/atproto/createAccount.d.ts +39 -0
  334. package/dist/src/types/com/atproto/createInviteCode.d.ts +19 -0
  335. package/dist/src/types/com/atproto/createSession.d.ts +23 -0
  336. package/dist/src/types/com/atproto/deleteAccount.d.ts +19 -0
  337. package/dist/src/types/com/atproto/deleteSession.d.ts +16 -0
  338. package/dist/src/types/com/atproto/getAccount.d.ts +19 -0
  339. package/dist/src/types/com/atproto/getAccountsConfig.d.ts +17 -0
  340. package/dist/src/types/com/atproto/getSession.d.ts +17 -0
  341. package/dist/src/types/com/atproto/refreshSession.d.ts +19 -0
  342. package/dist/src/types/com/atproto/repoBatchWrite.d.ts +35 -0
  343. package/dist/src/types/com/atproto/repoCreateRecord.d.ts +23 -0
  344. package/dist/src/types/com/atproto/repoDeleteRecord.d.ts +15 -0
  345. package/dist/src/types/com/atproto/repoDescribe.d.ts +21 -0
  346. package/dist/src/types/com/atproto/repoGetRecord.d.ts +22 -0
  347. package/dist/src/types/com/atproto/repoListRecords.d.ts +27 -0
  348. package/dist/src/types/com/atproto/repoPutRecord.d.ts +24 -0
  349. package/dist/src/types/com/atproto/requestAccountPasswordReset.d.ts +18 -0
  350. package/dist/src/types/com/atproto/resetAccountPassword.d.ts +25 -0
  351. package/dist/src/types/com/atproto/resolveName.d.ts +17 -0
  352. package/dist/src/types/com/atproto/syncGetRepo.d.ts +15 -0
  353. package/dist/src/types/com/atproto/syncGetRoot.d.ts +17 -0
  354. package/dist/src/types/com/atproto/syncUpdateRepo.d.ts +14 -0
  355. package/dist/src/types/todo/adx/createAccount.d.ts +36 -0
  356. package/dist/src/types/todo/adx/createInviteCode.d.ts +19 -0
  357. package/dist/src/types/todo/adx/createSession.d.ts +22 -0
  358. package/dist/src/types/todo/adx/deleteAccount.d.ts +19 -0
  359. package/dist/src/types/todo/adx/deleteSession.d.ts +19 -0
  360. package/dist/src/types/todo/adx/getAccount.d.ts +19 -0
  361. package/dist/src/types/todo/adx/getAccountsConfig.d.ts +17 -0
  362. package/dist/src/types/todo/adx/getSession.d.ts +17 -0
  363. package/dist/src/types/todo/adx/repoBatchWrite.d.ts +34 -0
  364. package/dist/src/types/todo/adx/repoCreateRecord.d.ts +22 -0
  365. package/dist/src/types/todo/adx/repoDeleteRecord.d.ts +15 -0
  366. package/dist/src/types/todo/adx/repoDescribe.d.ts +21 -0
  367. package/dist/src/types/todo/adx/repoGetRecord.d.ts +20 -0
  368. package/dist/src/types/todo/adx/repoListRecords.d.ts +25 -0
  369. package/dist/src/types/todo/adx/repoPutRecord.d.ts +23 -0
  370. package/dist/src/types/todo/adx/requestAccountPasswordReset.d.ts +18 -0
  371. package/dist/src/types/todo/adx/resetAccountPassword.d.ts +25 -0
  372. package/dist/src/types/todo/adx/resolveName.d.ts +17 -0
  373. package/dist/src/types/todo/adx/syncGetRepo.d.ts +15 -0
  374. package/dist/src/types/todo/adx/syncGetRoot.d.ts +17 -0
  375. package/dist/src/types/todo/adx/syncUpdateRepo.d.ts +14 -0
  376. package/dist/src/types/todo/social/badge.d.ts +23 -0
  377. package/dist/src/types/todo/social/follow.d.ts +5 -0
  378. package/dist/src/types/todo/social/getAuthorFeed.d.ts +55 -0
  379. package/dist/src/types/todo/social/getFeed.d.ts +55 -0
  380. package/dist/src/types/todo/social/getHomeFeed.d.ts +55 -0
  381. package/dist/src/types/todo/social/getLikedBy.d.ts +26 -0
  382. package/dist/src/types/todo/social/getNotificationCount.d.ts +16 -0
  383. package/dist/src/types/todo/social/getNotifications.d.ts +31 -0
  384. package/dist/src/types/todo/social/getPostThread.d.ts +54 -0
  385. package/dist/src/types/todo/social/getProfile.d.ts +40 -0
  386. package/dist/src/types/todo/social/getRepostedBy.d.ts +26 -0
  387. package/dist/src/types/todo/social/getUserFollowers.d.ts +30 -0
  388. package/dist/src/types/todo/social/getUserFollows.d.ts +30 -0
  389. package/dist/src/types/todo/social/like.d.ts +5 -0
  390. package/dist/src/types/todo/social/mediaEmbed.d.ts +15 -0
  391. package/dist/src/types/todo/social/post.d.ts +18 -0
  392. package/dist/src/types/todo/social/postNotificationsSeen.d.ts +19 -0
  393. package/dist/src/types/todo/social/profile.d.ts +10 -0
  394. package/dist/src/types/todo/social/repost.d.ts +5 -0
  395. package/dist/types.d.ts +5 -5
  396. package/docs/moderation.md +3 -3
  397. package/package.json +6 -6
  398. package/src/agent.ts +26 -8
  399. package/src/client/index.ts +78 -64
  400. package/src/client/lexicons.ts +120 -49
  401. package/src/client/types/com/atproto/admin/defs.ts +29 -0
  402. package/src/client/types/{app/bsky/unspecced/getPopular.ts → com/atproto/admin/getAccountInfos.ts} +3 -6
  403. package/src/client/types/com/atproto/admin/queryModerationStatuses.ts +2 -0
  404. package/src/client/types/com/atproto/admin/sendEmail.ts +2 -0
  405. package/src/client/types/com/atproto/moderation/defs.ts +3 -0
  406. package/src/client/types/com/atproto/server/createAccount.ts +2 -0
  407. package/src/client/types/com/atproto/server/describeServer.ts +1 -0
  408. package/src/client/types/com/atproto/temp/requestPhoneVerification.ts +32 -0
  409. package/src/moderation/index.ts +4 -4
  410. package/src/types.ts +6 -1
  411. package/tests/agent.test.ts +2 -2
  412. package/tests/moderation.test.ts +1 -1
@@ -0,0 +1,31 @@
1
+ import { Headers } from '@adxp/xrpc';
2
+ export interface QueryParams {
3
+ limit?: number;
4
+ before?: string;
5
+ }
6
+ export interface CallOptions {
7
+ headers?: Headers;
8
+ }
9
+ export declare type InputSchema = undefined;
10
+ export interface OutputSchema {
11
+ notifications: Notification[];
12
+ }
13
+ export interface Notification {
14
+ uri: string;
15
+ author: {
16
+ did: string;
17
+ name: string;
18
+ displayName?: string;
19
+ };
20
+ reason: string;
21
+ reasonSubject?: string;
22
+ record: {};
23
+ isRead: boolean;
24
+ indexedAt: string;
25
+ }
26
+ export interface Response {
27
+ success: boolean;
28
+ headers: Headers;
29
+ data: OutputSchema;
30
+ }
31
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,54 @@
1
+ import { Headers } from '@adxp/xrpc';
2
+ export interface QueryParams {
3
+ uri: string;
4
+ depth?: number;
5
+ }
6
+ export interface CallOptions {
7
+ headers?: Headers;
8
+ }
9
+ export declare type InputSchema = undefined;
10
+ export interface OutputSchema {
11
+ thread: Post;
12
+ }
13
+ export interface Post {
14
+ uri: string;
15
+ author: User;
16
+ record: {};
17
+ embed?: RecordEmbed | ExternalEmbed | UnknownEmbed;
18
+ parent?: Post;
19
+ replyCount: number;
20
+ replies?: Post[];
21
+ likeCount: number;
22
+ repostCount: number;
23
+ indexedAt: string;
24
+ myState?: {
25
+ repost?: string;
26
+ like?: string;
27
+ };
28
+ }
29
+ export interface User {
30
+ did: string;
31
+ name: string;
32
+ displayName?: string;
33
+ }
34
+ export interface RecordEmbed {
35
+ type: 'record';
36
+ author: User;
37
+ record: {};
38
+ }
39
+ export interface ExternalEmbed {
40
+ type: 'external';
41
+ uri: string;
42
+ title: string;
43
+ description: string;
44
+ imageUri: string;
45
+ }
46
+ export interface UnknownEmbed {
47
+ type: string;
48
+ }
49
+ export interface Response {
50
+ success: boolean;
51
+ headers: Headers;
52
+ data: OutputSchema;
53
+ }
54
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,40 @@
1
+ import { Headers } from '@adxp/xrpc';
2
+ export interface QueryParams {
3
+ user: string;
4
+ }
5
+ export interface CallOptions {
6
+ headers?: Headers;
7
+ }
8
+ export declare type InputSchema = undefined;
9
+ export interface OutputSchema {
10
+ did: string;
11
+ name: string;
12
+ displayName?: string;
13
+ description?: string;
14
+ followersCount: number;
15
+ followsCount: number;
16
+ postsCount: number;
17
+ badges: Badge[];
18
+ myState?: {
19
+ follow?: string;
20
+ };
21
+ }
22
+ export interface Badge {
23
+ uri: string;
24
+ error?: string;
25
+ issuer?: {
26
+ did: string;
27
+ name: string;
28
+ displayName: string;
29
+ };
30
+ assertion?: {
31
+ type: string;
32
+ };
33
+ createdAt?: string;
34
+ }
35
+ export interface Response {
36
+ success: boolean;
37
+ headers: Headers;
38
+ data: OutputSchema;
39
+ }
40
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,26 @@
1
+ import { Headers } from '@adxp/xrpc';
2
+ export interface QueryParams {
3
+ uri: string;
4
+ limit?: number;
5
+ before?: string;
6
+ }
7
+ export interface CallOptions {
8
+ headers?: Headers;
9
+ }
10
+ export declare type InputSchema = undefined;
11
+ export interface OutputSchema {
12
+ uri: string;
13
+ repostedBy: {
14
+ did: string;
15
+ name: string;
16
+ displayName?: string;
17
+ createdAt?: string;
18
+ indexedAt: string;
19
+ }[];
20
+ }
21
+ export interface Response {
22
+ success: boolean;
23
+ headers: Headers;
24
+ data: OutputSchema;
25
+ }
26
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,30 @@
1
+ import { Headers } from '@adxp/xrpc';
2
+ export interface QueryParams {
3
+ user: string;
4
+ limit?: number;
5
+ before?: string;
6
+ }
7
+ export interface CallOptions {
8
+ headers?: Headers;
9
+ }
10
+ export declare type InputSchema = undefined;
11
+ export interface OutputSchema {
12
+ subject: {
13
+ did: string;
14
+ name: string;
15
+ displayName?: string;
16
+ };
17
+ followers: {
18
+ did: string;
19
+ name: string;
20
+ displayName?: string;
21
+ createdAt?: string;
22
+ indexedAt: string;
23
+ }[];
24
+ }
25
+ export interface Response {
26
+ success: boolean;
27
+ headers: Headers;
28
+ data: OutputSchema;
29
+ }
30
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,30 @@
1
+ import { Headers } from '@adxp/xrpc';
2
+ export interface QueryParams {
3
+ user: string;
4
+ limit?: number;
5
+ before?: string;
6
+ }
7
+ export interface CallOptions {
8
+ headers?: Headers;
9
+ }
10
+ export declare type InputSchema = undefined;
11
+ export interface OutputSchema {
12
+ subject: {
13
+ did: string;
14
+ name: string;
15
+ displayName?: string;
16
+ };
17
+ follows: {
18
+ did: string;
19
+ name: string;
20
+ displayName?: string;
21
+ createdAt?: string;
22
+ indexedAt: string;
23
+ }[];
24
+ }
25
+ export interface Response {
26
+ success: boolean;
27
+ headers: Headers;
28
+ data: OutputSchema;
29
+ }
30
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,5 @@
1
+ export interface Record {
2
+ subject: string;
3
+ createdAt: string;
4
+ [k: string]: unknown;
5
+ }
@@ -0,0 +1,15 @@
1
+ export interface Record {
2
+ media: MediaEmbed[];
3
+ [k: string]: unknown;
4
+ }
5
+ export interface MediaEmbed {
6
+ alt?: string;
7
+ thumb?: MediaEmbedBlob;
8
+ original: MediaEmbedBlob;
9
+ [k: string]: unknown;
10
+ }
11
+ export interface MediaEmbedBlob {
12
+ mimeType: string;
13
+ blobId: string;
14
+ [k: string]: unknown;
15
+ }
@@ -0,0 +1,18 @@
1
+ export declare type TextSlice = [number, number];
2
+ export declare type Entity = {
3
+ index: TextSlice;
4
+ type: string;
5
+ value: string;
6
+ [k: string]: unknown;
7
+ }[];
8
+ export interface Record {
9
+ text: string;
10
+ entities?: Entity;
11
+ reply?: {
12
+ root: string;
13
+ parent?: string;
14
+ [k: string]: unknown;
15
+ };
16
+ createdAt: string;
17
+ [k: string]: unknown;
18
+ }
@@ -0,0 +1,19 @@
1
+ import { Headers } from '@adxp/xrpc';
2
+ export interface QueryParams {
3
+ }
4
+ export interface CallOptions {
5
+ headers?: Headers;
6
+ encoding: 'application/json';
7
+ }
8
+ export interface InputSchema {
9
+ seenAt: string;
10
+ }
11
+ export interface OutputSchema {
12
+ [k: string]: unknown;
13
+ }
14
+ export interface Response {
15
+ success: boolean;
16
+ headers: Headers;
17
+ data: OutputSchema;
18
+ }
19
+ export declare function toKnownErr(e: any): any;
@@ -0,0 +1,10 @@
1
+ export interface Record {
2
+ displayName: string;
3
+ description?: string;
4
+ badges?: BadgeRef[];
5
+ [k: string]: unknown;
6
+ }
7
+ export interface BadgeRef {
8
+ uri: string;
9
+ [k: string]: unknown;
10
+ }
@@ -0,0 +1,5 @@
1
+ export interface Record {
2
+ subject: string;
3
+ createdAt: string;
4
+ [k: string]: unknown;
5
+ }
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LabelPreference } from './moderation/types';
2
- export declare type AtpSessionEvent = 'create' | 'create-failed' | 'update' | 'expired';
2
+ export type AtpSessionEvent = 'create' | 'create-failed' | 'update' | 'expired' | 'network-error';
3
3
  export interface AtpSessionData {
4
4
  refreshJwt: string;
5
5
  accessJwt: string;
@@ -8,7 +8,7 @@ export interface AtpSessionData {
8
8
  email?: string;
9
9
  emailConfirmed?: boolean;
10
10
  }
11
- export declare type AtpPersistSessionHandler = (evt: AtpSessionEvent, session: AtpSessionData | undefined) => void | Promise<void>;
11
+ export type AtpPersistSessionHandler = (evt: AtpSessionEvent, session: AtpSessionData | undefined) => void | Promise<void>;
12
12
  export interface AtpAgentOpts {
13
13
  service: string | URL;
14
14
  persistSession?: AtpPersistSessionHandler;
@@ -23,17 +23,17 @@ export interface AtpAgentLoginOpts {
23
23
  identifier: string;
24
24
  password: string;
25
25
  }
26
- declare type AtpAgentFetchHeaders = Record<string, string>;
26
+ type AtpAgentFetchHeaders = Record<string, string>;
27
27
  export interface AtpAgentFetchHandlerResponse {
28
28
  status: number;
29
29
  headers: Record<string, string>;
30
30
  body: any;
31
31
  }
32
- export declare type AtpAgentFetchHandler = (httpUri: string, httpMethod: string, httpHeaders: AtpAgentFetchHeaders, httpReqBody: any) => Promise<AtpAgentFetchHandlerResponse>;
32
+ export type AtpAgentFetchHandler = (httpUri: string, httpMethod: string, httpHeaders: AtpAgentFetchHeaders, httpReqBody: any) => Promise<AtpAgentFetchHandlerResponse>;
33
33
  export interface AtpAgentGlobalOpts {
34
34
  fetch: AtpAgentFetchHandler;
35
35
  }
36
- export declare type BskyLabelPreference = LabelPreference | 'show';
36
+ export type BskyLabelPreference = LabelPreference | 'show';
37
37
  export interface BskyFeedViewPreference {
38
38
  hideReplies: boolean;
39
39
  hideRepliesByUnfollowed: boolean;
@@ -85,7 +85,7 @@ import { moderatePost } from '@atproto/api'
85
85
  const postMod = moderatePost(postView, getOpts())
86
86
 
87
87
  if (postMod.content.filter) {
88
- // dont render in feeds or similar
88
+ // don't render in feeds or similar
89
89
  // in contexts where this is disruptive (eg threads) you should ignore this and instead check blur
90
90
  }
91
91
  if (postMod.content.blur) {
@@ -123,8 +123,8 @@ import { moderateProfile } from '@atproto/api'
123
123
 
124
124
  const profileMod = moderateProfile(profileView, getOpts())
125
125
 
126
- if (profileMod.acount.filter) {
127
- // dont render in discovery
126
+ if (profileMod.account.filter) {
127
+ // don't render in discovery
128
128
  }
129
129
  if (profileMod.account.blur) {
130
130
  // render the whole account behind a cover (use profileMod.account.cause to explain)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/api",
3
- "version": "0.7.4",
3
+ "version": "0.9.0",
4
4
  "license": "MIT",
5
5
  "description": "Client library for atproto and Bluesky",
6
6
  "keywords": [
@@ -20,15 +20,15 @@
20
20
  "tlds": "^1.234.0",
21
21
  "typed-emitter": "^2.1.0",
22
22
  "zod": "^3.21.4",
23
- "@atproto/common-web": "^0.2.3",
24
- "@atproto/lexicon": "^0.3.1",
23
+ "@atproto/xrpc": "^0.4.1",
25
24
  "@atproto/syntax": "^0.1.5",
26
- "@atproto/xrpc": "^0.4.1"
25
+ "@atproto/lexicon": "^0.3.1",
26
+ "@atproto/common-web": "^0.2.3"
27
27
  },
28
28
  "devDependencies": {
29
29
  "common-tags": "^1.8.2",
30
- "@atproto/lex-cli": "^0.2.5",
31
- "@atproto/dev-env": "^0.2.21"
30
+ "@atproto/lex-cli": "^0.3.0",
31
+ "@atproto/dev-env": "^0.2.23"
32
32
  },
33
33
  "scripts": {
34
34
  "codegen": "pnpm docgen && node ./scripts/generate-code.mjs && lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
package/src/agent.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ErrorResponseBody, errorResponseBody } from '@atproto/xrpc'
2
- import { defaultFetchHandler } from '@atproto/xrpc'
2
+ import { defaultFetchHandler, XRPCError, ResponseType } from '@atproto/xrpc'
3
3
  import { isValidDidDoc, getPdsEndpoint } from '@atproto/common-web'
4
4
  import {
5
5
  AtpBaseClient,
@@ -159,23 +159,41 @@ export class AtpAgent {
159
159
  try {
160
160
  this.session = session
161
161
  const res = await this.api.com.atproto.server.getSession()
162
- if (!res.success || res.data.did !== this.session.did) {
163
- throw new Error('Invalid session')
162
+ if (res.data.did !== this.session.did) {
163
+ throw new XRPCError(
164
+ ResponseType.InvalidRequest,
165
+ 'Invalid session',
166
+ 'InvalidDID',
167
+ )
164
168
  }
165
169
  this.session.email = res.data.email
166
170
  this.session.handle = res.data.handle
167
171
  this.session.emailConfirmed = res.data.emailConfirmed
168
172
  this._updateApiEndpoint(res.data.didDoc)
173
+ this._persistSession?.('update', this.session)
169
174
  return res
170
175
  } catch (e) {
171
176
  this.session = undefined
172
- throw e
173
- } finally {
174
- if (this.session) {
175
- this._persistSession?.('create', this.session)
177
+
178
+ if (e instanceof XRPCError) {
179
+ /*
180
+ * `ExpiredToken` and `InvalidToken` are handled in
181
+ * `this_refreshSession`, and emit an `expired` event there.
182
+ *
183
+ * Everything else is handled here.
184
+ */
185
+ if (
186
+ [1, 408, 425, 429, 500, 502, 503, 504, 522, 524].includes(e.status)
187
+ ) {
188
+ this._persistSession?.('network-error', undefined)
189
+ } else {
190
+ this._persistSession?.('expired', undefined)
191
+ }
176
192
  } else {
177
- this._persistSession?.('create-failed', undefined)
193
+ this._persistSession?.('network-error', undefined)
178
194
  }
195
+
196
+ throw e
179
197
  }
180
198
  }
181
199