@atproto/api 0.1.3 → 0.2.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 (205) hide show
  1. package/README.md +179 -25
  2. package/build.js +2 -1
  3. package/dist/agent.d.ts +11 -6
  4. package/dist/bsky-agent.d.ts +43 -0
  5. package/dist/client/index.d.ts +117 -215
  6. package/dist/client/lexicons.d.ts +1440 -1401
  7. package/dist/client/types/app/bsky/actor/defs.d.ts +47 -0
  8. package/dist/client/types/app/bsky/actor/getProfile.d.ts +2 -2
  9. package/dist/client/types/app/bsky/actor/getProfiles.d.ts +2 -2
  10. package/dist/client/types/app/bsky/actor/getSuggestions.d.ts +2 -2
  11. package/dist/client/types/app/bsky/actor/profile.d.ts +4 -60
  12. package/dist/client/types/app/bsky/actor/searchActors.d.ts +22 -0
  13. package/dist/client/types/app/bsky/actor/searchActorsTypeahead.d.ts +20 -0
  14. package/dist/client/types/app/bsky/actor/updateProfile.d.ts +3 -10
  15. package/dist/client/types/app/bsky/embed/external.d.ts +9 -13
  16. package/dist/client/types/app/bsky/embed/images.d.ts +9 -13
  17. package/dist/client/types/app/bsky/embed/record.d.ts +21 -13
  18. package/dist/client/types/app/bsky/embed/recordWithMedia.d.ts +24 -0
  19. package/dist/client/types/app/bsky/feed/defs.d.ts +77 -0
  20. package/dist/client/types/app/bsky/feed/getAuthorFeed.d.ts +4 -4
  21. package/dist/client/types/app/bsky/feed/getLikes.d.ts +34 -0
  22. package/dist/client/types/app/bsky/feed/getPostThread.d.ts +2 -24
  23. package/dist/client/types/app/bsky/feed/getRepostedBy.d.ts +3 -3
  24. package/dist/client/types/app/bsky/feed/getTimeline.d.ts +3 -3
  25. package/dist/client/types/app/bsky/feed/like.d.ts +9 -0
  26. package/dist/client/types/app/bsky/feed/post.d.ts +4 -29
  27. package/dist/client/types/app/bsky/graph/follow.d.ts +1 -2
  28. package/dist/client/types/app/bsky/graph/getFollowers.d.ts +5 -5
  29. package/dist/client/types/app/bsky/graph/getFollows.d.ts +5 -5
  30. package/dist/client/types/app/bsky/graph/getMutes.d.ts +3 -3
  31. package/dist/client/types/app/bsky/graph/muteActor.d.ts +17 -0
  32. package/dist/client/types/app/bsky/graph/unmuteActor.d.ts +17 -0
  33. package/dist/client/types/app/bsky/notification/getUnreadCount.d.ts +17 -0
  34. package/dist/client/types/app/bsky/notification/listNotifications.d.ts +35 -0
  35. package/dist/client/types/app/bsky/richtext/facet.d.ts +30 -0
  36. package/dist/client/types/app/bsky/unspecced/getPopular.d.ts +21 -0
  37. package/dist/client/types/com/atproto/admin/defs.d.ts +181 -0
  38. package/dist/client/types/com/atproto/admin/getModerationAction.d.ts +2 -2
  39. package/dist/client/types/com/atproto/admin/getModerationActions.d.ts +3 -3
  40. package/dist/client/types/com/atproto/admin/getModerationReport.d.ts +2 -2
  41. package/dist/client/types/com/atproto/admin/getModerationReports.d.ts +3 -3
  42. package/dist/client/types/com/atproto/admin/getRecord.d.ts +2 -2
  43. package/dist/client/types/com/atproto/admin/getRepo.d.ts +2 -2
  44. package/dist/client/types/com/atproto/admin/resolveModerationReports.d.ts +2 -2
  45. package/dist/client/types/com/atproto/admin/reverseModerationAction.d.ts +2 -2
  46. package/dist/client/types/com/atproto/admin/searchRepos.d.ts +3 -3
  47. package/dist/client/types/com/atproto/admin/takeModerationAction.d.ts +5 -6
  48. package/dist/client/types/com/atproto/identity/resolveHandle.d.ts +18 -0
  49. package/dist/client/types/com/atproto/identity/updateHandle.d.ts +17 -0
  50. package/dist/client/types/com/atproto/moderation/createReport.d.ts +38 -0
  51. package/dist/client/types/com/atproto/moderation/defs.d.ts +3 -0
  52. package/dist/client/types/com/atproto/repo/applyWrites.d.ts +47 -0
  53. package/dist/client/types/com/atproto/repo/createRecord.d.ts +7 -2
  54. package/dist/client/types/com/atproto/repo/deleteRecord.d.ts +7 -2
  55. package/dist/client/types/com/atproto/repo/describeRepo.d.ts +22 -0
  56. package/dist/client/types/com/atproto/repo/getRecord.d.ts +1 -1
  57. package/dist/client/types/com/atproto/repo/listRecords.d.ts +3 -3
  58. package/dist/client/types/com/atproto/repo/putRecord.d.ts +7 -2
  59. package/dist/client/types/com/atproto/repo/uploadBlob.d.ts +20 -0
  60. package/dist/client/types/com/atproto/server/createAccount.d.ts +44 -0
  61. package/dist/client/types/com/atproto/server/createInviteCode.d.ts +22 -0
  62. package/dist/client/types/com/atproto/server/createSession.d.ts +29 -0
  63. package/dist/client/types/com/atproto/server/deleteAccount.d.ts +25 -0
  64. package/dist/client/types/com/atproto/server/deleteSession.d.ts +13 -0
  65. package/dist/client/types/com/atproto/server/describeServer.d.ts +27 -0
  66. package/dist/client/types/com/atproto/server/getSession.d.ts +18 -0
  67. package/dist/client/types/com/atproto/server/refreshSession.d.ts +24 -0
  68. package/dist/client/types/com/atproto/server/requestAccountDelete.d.ts +13 -0
  69. package/dist/client/types/com/atproto/server/requestPasswordReset.d.ts +17 -0
  70. package/dist/client/types/com/atproto/server/resetPassword.d.ts +24 -0
  71. package/dist/client/types/com/atproto/sync/getBlob.d.ts +15 -0
  72. package/dist/client/types/com/atproto/sync/listBlobs.d.ts +20 -0
  73. package/dist/client/types/com/atproto/sync/notifyOfUpdate.d.ts +1 -0
  74. package/dist/client/types/com/atproto/sync/requestCrawl.d.ts +1 -1
  75. package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +9 -1
  76. package/dist/client/types/com/atproto/sync/subscribeRepos.d.ts +58 -0
  77. package/dist/helpers/bsky.d.ts +20 -0
  78. package/dist/index.d.ts +6 -0
  79. package/dist/index.js +8046 -3649
  80. package/dist/index.js.map +4 -4
  81. package/dist/mixins/bsky.d.ts +23 -0
  82. package/dist/rich-text/detection.d.ts +4 -0
  83. package/dist/rich-text/rich-text.d.ts +39 -0
  84. package/dist/rich-text/sanitization.d.ts +4 -0
  85. package/dist/rich-text/sanitize.d.ts +4 -0
  86. package/dist/rich-text/unicode.d.ts +11 -0
  87. package/dist/types.d.ts +2 -2
  88. package/docs/rn-fetch-handler.ts +88 -0
  89. package/package.json +4 -1
  90. package/src/agent.ts +51 -15
  91. package/src/bsky-agent.ts +228 -0
  92. package/src/client/index.ts +330 -581
  93. package/src/client/lexicons.ts +1824 -1777
  94. package/src/client/types/app/bsky/actor/defs.ts +97 -0
  95. package/src/client/types/app/bsky/actor/getProfile.ts +4 -3
  96. package/src/client/types/app/bsky/actor/getProfiles.ts +4 -3
  97. package/src/client/types/app/bsky/actor/getSuggestions.ts +4 -3
  98. package/src/client/types/app/bsky/actor/profile.ts +5 -95
  99. package/src/client/types/app/bsky/actor/{searchTypeahead.ts → searchActors.ts} +6 -3
  100. package/src/client/types/app/bsky/actor/{search.ts → searchActorsTypeahead.ts} +4 -5
  101. package/src/client/types/app/bsky/embed/external.ts +14 -13
  102. package/src/client/types/app/bsky/embed/images.ts +14 -15
  103. package/src/client/types/app/bsky/embed/record.ts +32 -25
  104. package/src/client/types/app/bsky/embed/recordWithMedia.ts +53 -0
  105. package/src/client/types/app/bsky/feed/defs.ts +156 -0
  106. package/src/client/types/app/bsky/feed/getAuthorFeed.ts +6 -5
  107. package/src/client/types/app/bsky/feed/{getVotes.ts → getLikes.ts} +11 -12
  108. package/src/client/types/app/bsky/feed/getPostThread.ts +5 -48
  109. package/src/client/types/app/bsky/feed/getRepostedBy.ts +5 -4
  110. package/src/client/types/app/bsky/feed/getTimeline.ts +5 -4
  111. package/src/client/types/app/bsky/feed/{vote.ts → like.ts} +4 -4
  112. package/src/client/types/app/bsky/feed/post.ts +10 -52
  113. package/src/client/types/app/bsky/feed/repost.ts +2 -1
  114. package/src/client/types/app/bsky/graph/follow.ts +3 -3
  115. package/src/client/types/app/bsky/graph/getFollowers.ts +7 -6
  116. package/src/client/types/app/bsky/graph/getFollows.ts +7 -6
  117. package/src/client/types/app/bsky/graph/getMutes.ts +5 -4
  118. package/src/client/types/app/bsky/graph/{mute.ts → muteActor.ts} +3 -2
  119. package/src/client/types/app/bsky/graph/{unmute.ts → unmuteActor.ts} +3 -2
  120. package/src/client/types/app/bsky/notification/{getCount.ts → getUnreadCount.ts} +2 -1
  121. package/src/client/types/app/bsky/notification/{list.ts → listNotifications.ts} +13 -9
  122. package/src/client/types/app/bsky/notification/updateSeen.ts +2 -1
  123. package/src/client/types/app/bsky/richtext/facet.ts +81 -0
  124. package/src/client/types/app/bsky/unspecced/getPopular.ts +38 -0
  125. package/src/client/types/com/atproto/admin/defs.ts +366 -0
  126. package/src/client/types/com/atproto/admin/getModerationAction.ts +4 -3
  127. package/src/client/types/com/atproto/admin/getModerationActions.ts +5 -4
  128. package/src/client/types/com/atproto/admin/getModerationReport.ts +4 -3
  129. package/src/client/types/com/atproto/admin/getModerationReports.ts +5 -4
  130. package/src/client/types/com/atproto/admin/getRecord.ts +4 -3
  131. package/src/client/types/com/atproto/admin/getRepo.ts +4 -3
  132. package/src/client/types/com/atproto/admin/resolveModerationReports.ts +4 -3
  133. package/src/client/types/com/atproto/admin/reverseModerationAction.ts +4 -3
  134. package/src/client/types/com/atproto/admin/searchRepos.ts +5 -4
  135. package/src/client/types/com/atproto/admin/takeModerationAction.ts +10 -10
  136. package/src/client/types/com/atproto/{handle/resolve.ts → identity/resolveHandle.ts} +2 -1
  137. package/src/client/types/com/atproto/{handle/update.ts → identity/updateHandle.ts} +2 -1
  138. package/src/client/types/com/atproto/{report/create.ts → moderation/createReport.ts} +10 -10
  139. package/src/client/types/com/atproto/moderation/defs.ts +17 -0
  140. package/src/client/types/com/atproto/repo/{batchWrite.ts → applyWrites.ts} +21 -12
  141. package/src/client/types/com/atproto/repo/createRecord.ts +15 -3
  142. package/src/client/types/com/atproto/repo/deleteRecord.ts +15 -3
  143. package/src/client/types/com/atproto/repo/{describe.ts → describeRepo.ts} +3 -2
  144. package/src/client/types/com/atproto/repo/getRecord.ts +4 -3
  145. package/src/client/types/com/atproto/repo/listRecords.ts +7 -6
  146. package/src/client/types/com/atproto/repo/putRecord.ts +18 -6
  147. package/src/client/types/com/atproto/repo/strongRef.ts +2 -1
  148. package/src/client/types/com/atproto/{blob/upload.ts → repo/uploadBlob.ts} +3 -2
  149. package/src/client/types/com/atproto/{account/create.ts → server/createAccount.ts} +9 -1
  150. package/src/client/types/com/atproto/{account → server}/createInviteCode.ts +2 -1
  151. package/src/client/types/com/atproto/{session/create.ts → server/createSession.ts} +2 -1
  152. package/src/client/types/com/atproto/{account/delete.ts → server/deleteAccount.ts} +2 -1
  153. package/src/client/types/com/atproto/{account/requestDelete.ts → server/deleteSession.ts} +2 -1
  154. package/src/client/types/com/atproto/server/{getAccountsConfig.ts → describeServer.ts} +4 -3
  155. package/src/client/types/com/atproto/{session/get.ts → server/getSession.ts} +2 -1
  156. package/src/client/types/com/atproto/{session/refresh.ts → server/refreshSession.ts} +2 -1
  157. package/src/client/types/com/atproto/{session/delete.ts → server/requestAccountDelete.ts} +2 -1
  158. package/src/client/types/com/atproto/{account → server}/requestPasswordReset.ts +2 -1
  159. package/src/client/types/com/atproto/{account → server}/resetPassword.ts +2 -1
  160. package/src/client/types/com/atproto/sync/getBlob.ts +33 -0
  161. package/src/client/types/com/atproto/sync/getBlocks.ts +2 -1
  162. package/src/client/types/com/atproto/sync/getCheckout.ts +2 -1
  163. package/src/client/types/com/atproto/sync/getCommitPath.ts +2 -1
  164. package/src/client/types/com/atproto/sync/getHead.ts +2 -1
  165. package/src/client/types/com/atproto/sync/getRecord.ts +2 -1
  166. package/src/client/types/com/atproto/sync/getRepo.ts +2 -1
  167. package/src/client/types/com/atproto/sync/listBlobs.ts +40 -0
  168. package/src/client/types/com/atproto/sync/notifyOfUpdate.ts +6 -2
  169. package/src/client/types/com/atproto/sync/requestCrawl.ts +3 -2
  170. package/src/client/types/com/atproto/sync/subscribeRepos.ts +131 -0
  171. package/src/index.ts +12 -0
  172. package/src/rich-text/detection.ts +83 -0
  173. package/src/rich-text/rich-text.ts +401 -0
  174. package/src/rich-text/sanitization.ts +40 -0
  175. package/src/rich-text/unicode.ts +47 -0
  176. package/src/types.ts +2 -2
  177. package/tests/agent.test.ts +10 -6
  178. package/tests/bsky-agent.test.ts +140 -0
  179. package/tests/errors.test.ts +4 -4
  180. package/tests/rich-text-detection.test.ts +229 -0
  181. package/tests/rich-text-sanitization.test.ts +211 -0
  182. package/tests/rich-text.test.ts +661 -0
  183. package/tsconfig.build.tsbuildinfo +1 -1
  184. package/src/client/types/app/bsky/actor/ref.ts +0 -64
  185. package/src/client/types/app/bsky/actor/updateProfile.ts +0 -71
  186. package/src/client/types/app/bsky/feed/feedViewPost.ts +0 -64
  187. package/src/client/types/app/bsky/feed/setVote.ts +0 -40
  188. package/src/client/types/app/bsky/graph/assertCreator.ts +0 -9
  189. package/src/client/types/app/bsky/graph/assertMember.ts +0 -9
  190. package/src/client/types/app/bsky/graph/assertion.ts +0 -27
  191. package/src/client/types/app/bsky/graph/confirmation.ts +0 -28
  192. package/src/client/types/app/bsky/system/actorUser.ts +0 -9
  193. package/src/client/types/app/bsky/system/declRef.ts +0 -26
  194. package/src/client/types/app/bsky/system/declaration.ts +0 -24
  195. package/src/client/types/com/atproto/account/get.ts +0 -26
  196. package/src/client/types/com/atproto/admin/blob.ts +0 -84
  197. package/src/client/types/com/atproto/admin/moderationAction.ts +0 -118
  198. package/src/client/types/com/atproto/admin/moderationReport.ts +0 -64
  199. package/src/client/types/com/atproto/admin/record.ts +0 -92
  200. package/src/client/types/com/atproto/admin/repo.ts +0 -103
  201. package/src/client/types/com/atproto/repo/recordRef.ts +0 -25
  202. package/src/client/types/com/atproto/repo/repoRef.ts +0 -24
  203. package/src/client/types/com/atproto/report/reasonType.ts +0 -16
  204. package/src/client/types/com/atproto/report/subject.ts +0 -66
  205. package/src/client/types/com/atproto/sync/subscribeAllRepos.ts +0 -7
@@ -2,17 +2,18 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as ComAtprotoAdminRepo from './repo'
8
+ import { CID } from 'multiformats/cid'
9
+ import * as ComAtprotoAdminDefs from './defs'
9
10
 
10
11
  export interface QueryParams {
11
12
  did: string
12
13
  }
13
14
 
14
15
  export type InputSchema = undefined
15
- export type OutputSchema = ComAtprotoAdminRepo.ViewDetail
16
+ export type OutputSchema = ComAtprotoAdminDefs.RepoViewDetail
16
17
 
17
18
  export interface CallOptions {
18
19
  headers?: Headers
@@ -2,10 +2,11 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as ComAtprotoAdminModerationAction from './moderationAction'
8
+ import { CID } from 'multiformats/cid'
9
+ import * as ComAtprotoAdminDefs from './defs'
9
10
 
10
11
  export interface QueryParams {}
11
12
 
@@ -16,7 +17,7 @@ export interface InputSchema {
16
17
  [k: string]: unknown
17
18
  }
18
19
 
19
- export type OutputSchema = ComAtprotoAdminModerationAction.View
20
+ export type OutputSchema = ComAtprotoAdminDefs.ActionView
20
21
 
21
22
  export interface CallOptions {
22
23
  headers?: Headers
@@ -2,10 +2,11 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as ComAtprotoAdminModerationAction from './moderationAction'
8
+ import { CID } from 'multiformats/cid'
9
+ import * as ComAtprotoAdminDefs from './defs'
9
10
 
10
11
  export interface QueryParams {}
11
12
 
@@ -16,7 +17,7 @@ export interface InputSchema {
16
17
  [k: string]: unknown
17
18
  }
18
19
 
19
- export type OutputSchema = ComAtprotoAdminModerationAction.View
20
+ export type OutputSchema = ComAtprotoAdminDefs.ActionView
20
21
 
21
22
  export interface CallOptions {
22
23
  headers?: Headers
@@ -2,22 +2,23 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as ComAtprotoAdminRepo from './repo'
8
+ import { CID } from 'multiformats/cid'
9
+ import * as ComAtprotoAdminDefs from './defs'
9
10
 
10
11
  export interface QueryParams {
11
12
  term?: string
12
13
  limit?: number
13
- before?: string
14
+ cursor?: string
14
15
  }
15
16
 
16
17
  export type InputSchema = undefined
17
18
 
18
19
  export interface OutputSchema {
19
20
  cursor?: string
20
- repos: ComAtprotoAdminRepo.View[]
21
+ repos: ComAtprotoAdminDefs.RepoView[]
21
22
  [k: string]: unknown
22
23
  }
23
24
 
@@ -2,24 +2,24 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as ComAtprotoRepoRepoRef from '../repo/repoRef'
9
- import * as ComAtprotoRepoRecordRef from '../repo/recordRef'
10
- import * as ComAtprotoAdminModerationAction from './moderationAction'
8
+ import { CID } from 'multiformats/cid'
9
+ import * as ComAtprotoAdminDefs from './defs'
10
+ import * as ComAtprotoRepoStrongRef from '../repo/strongRef'
11
11
 
12
12
  export interface QueryParams {}
13
13
 
14
14
  export interface InputSchema {
15
15
  action:
16
- | 'com.atproto.admin.moderationAction#takedown'
17
- | 'com.atproto.admin.moderationAction#flag'
18
- | 'com.atproto.admin.moderationAction#acknowledge'
16
+ | 'com.atproto.admin.defs#takedown'
17
+ | 'com.atproto.admin.defs#flag'
18
+ | 'com.atproto.admin.defs#acknowledge'
19
19
  | (string & {})
20
20
  subject:
21
- | ComAtprotoRepoRepoRef.Main
22
- | ComAtprotoRepoRecordRef.Main
21
+ | ComAtprotoAdminDefs.RepoRef
22
+ | ComAtprotoRepoStrongRef.Main
23
23
  | { $type: string; [k: string]: unknown }
24
24
  subjectBlobCids?: string[]
25
25
  reason: string
@@ -27,7 +27,7 @@ export interface InputSchema {
27
27
  [k: string]: unknown
28
28
  }
29
29
 
30
- export type OutputSchema = ComAtprotoAdminModerationAction.View
30
+ export type OutputSchema = ComAtprotoAdminDefs.ActionView
31
31
 
32
32
  export interface CallOptions {
33
33
  headers?: Headers
@@ -2,9 +2,10 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {
10
11
  /** The handle to resolve. If not supplied, will resolve the host's own handle. */
@@ -2,9 +2,10 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
@@ -2,35 +2,35 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
- import * as ComAtprotoReportReasonType from './reasonType'
9
- import * as ComAtprotoRepoRepoRef from '../repo/repoRef'
10
- import * as ComAtprotoRepoRecordRef from '../repo/recordRef'
8
+ import { CID } from 'multiformats/cid'
9
+ import * as ComAtprotoModerationDefs from './defs'
10
+ import * as ComAtprotoAdminDefs from '../admin/defs'
11
11
  import * as ComAtprotoRepoStrongRef from '../repo/strongRef'
12
12
 
13
13
  export interface QueryParams {}
14
14
 
15
15
  export interface InputSchema {
16
- reasonType: ComAtprotoReportReasonType.Main
16
+ reasonType: ComAtprotoModerationDefs.ReasonType
17
17
  reason?: string
18
18
  subject:
19
- | ComAtprotoRepoRepoRef.Main
20
- | ComAtprotoRepoRecordRef.Main
19
+ | ComAtprotoAdminDefs.RepoRef
20
+ | ComAtprotoRepoStrongRef.Main
21
21
  | { $type: string; [k: string]: unknown }
22
22
  [k: string]: unknown
23
23
  }
24
24
 
25
25
  export interface OutputSchema {
26
26
  id: number
27
- reasonType: ComAtprotoReportReasonType.Main
27
+ reasonType: ComAtprotoModerationDefs.ReasonType
28
28
  reason?: string
29
29
  subject:
30
- | ComAtprotoRepoRepoRef.Main
30
+ | ComAtprotoAdminDefs.RepoRef
31
31
  | ComAtprotoRepoStrongRef.Main
32
32
  | { $type: string; [k: string]: unknown }
33
- reportedByDid: string
33
+ reportedBy: string
34
34
  createdAt: string
35
35
  [k: string]: unknown
36
36
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { isObj, hasProp } from '../../../../util'
6
+ import { lexicons } from '../../../../lexicons'
7
+ import { CID } from 'multiformats/cid'
8
+
9
+ export type ReasonType =
10
+ | 'com.atproto.moderation.defs#reasonSpam'
11
+ | 'com.atproto.moderation.defs#reasonOther'
12
+ | (string & {})
13
+
14
+ /** Moderation report reason: Spam. */
15
+ export const REASONSPAM = 'com.atproto.moderation.defs#reasonSpam'
16
+ /** Moderation report reason: Other. */
17
+ export const REASONOTHER = 'com.atproto.moderation.defs#reasonOther'
@@ -2,18 +2,20 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
11
12
  export interface InputSchema {
12
- /** The DID of the repo. */
13
- did: string
13
+ /** The handle or DID of the repo. */
14
+ repo: string
14
15
  /** Validate the records? */
15
16
  validate?: boolean
16
17
  writes: (Create | Update | Delete)[]
18
+ swapCommit?: string
17
19
  [k: string]: unknown
18
20
  }
19
21
 
@@ -28,14 +30,21 @@ export interface Response {
28
30
  headers: Headers
29
31
  }
30
32
 
33
+ export class InvalidSwapError extends XRPCError {
34
+ constructor(src: XRPCError) {
35
+ super(src.status, src.error, src.message)
36
+ }
37
+ }
38
+
31
39
  export function toKnownErr(e: any) {
32
40
  if (e instanceof XRPCError) {
41
+ if (e.error === 'InvalidSwap') return new InvalidSwapError(e)
33
42
  }
34
43
  return e
35
44
  }
36
45
 
46
+ /** Create a new record. */
37
47
  export interface Create {
38
- action: 'create'
39
48
  collection: string
40
49
  rkey?: string
41
50
  value: {}
@@ -46,16 +55,16 @@ export function isCreate(v: unknown): v is Create {
46
55
  return (
47
56
  isObj(v) &&
48
57
  hasProp(v, '$type') &&
49
- v.$type === 'com.atproto.repo.batchWrite#create'
58
+ v.$type === 'com.atproto.repo.applyWrites#create'
50
59
  )
51
60
  }
52
61
 
53
62
  export function validateCreate(v: unknown): ValidationResult {
54
- return lexicons.validate('com.atproto.repo.batchWrite#create', v)
63
+ return lexicons.validate('com.atproto.repo.applyWrites#create', v)
55
64
  }
56
65
 
66
+ /** Update an existing record. */
57
67
  export interface Update {
58
- action: 'update'
59
68
  collection: string
60
69
  rkey: string
61
70
  value: {}
@@ -66,16 +75,16 @@ export function isUpdate(v: unknown): v is Update {
66
75
  return (
67
76
  isObj(v) &&
68
77
  hasProp(v, '$type') &&
69
- v.$type === 'com.atproto.repo.batchWrite#update'
78
+ v.$type === 'com.atproto.repo.applyWrites#update'
70
79
  )
71
80
  }
72
81
 
73
82
  export function validateUpdate(v: unknown): ValidationResult {
74
- return lexicons.validate('com.atproto.repo.batchWrite#update', v)
83
+ return lexicons.validate('com.atproto.repo.applyWrites#update', v)
75
84
  }
76
85
 
86
+ /** Delete an existing record. */
77
87
  export interface Delete {
78
- action: 'delete'
79
88
  collection: string
80
89
  rkey: string
81
90
  [k: string]: unknown
@@ -85,10 +94,10 @@ export function isDelete(v: unknown): v is Delete {
85
94
  return (
86
95
  isObj(v) &&
87
96
  hasProp(v, '$type') &&
88
- v.$type === 'com.atproto.repo.batchWrite#delete'
97
+ v.$type === 'com.atproto.repo.applyWrites#delete'
89
98
  )
90
99
  }
91
100
 
92
101
  export function validateDelete(v: unknown): ValidationResult {
93
- return lexicons.validate('com.atproto.repo.batchWrite#delete', v)
102
+ return lexicons.validate('com.atproto.repo.applyWrites#delete', v)
94
103
  }
@@ -2,21 +2,26 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
11
12
  export interface InputSchema {
12
- /** The DID of the repo. */
13
- did: string
13
+ /** The handle or DID of the repo. */
14
+ repo: string
14
15
  /** The NSID of the record collection. */
15
16
  collection: string
17
+ /** The key of the record. */
18
+ rkey?: string
16
19
  /** Validate the record? */
17
20
  validate?: boolean
18
21
  /** The record to create. */
19
22
  record: {}
23
+ /** Compare and swap with the previous commit by cid. */
24
+ swapCommit?: string
20
25
  [k: string]: unknown
21
26
  }
22
27
 
@@ -38,8 +43,15 @@ export interface Response {
38
43
  data: OutputSchema
39
44
  }
40
45
 
46
+ export class InvalidSwapError extends XRPCError {
47
+ constructor(src: XRPCError) {
48
+ super(src.status, src.error, src.message)
49
+ }
50
+ }
51
+
41
52
  export function toKnownErr(e: any) {
42
53
  if (e instanceof XRPCError) {
54
+ if (e.error === 'InvalidSwap') return new InvalidSwapError(e)
43
55
  }
44
56
  return e
45
57
  }
@@ -2,19 +2,24 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
11
12
  export interface InputSchema {
12
- /** The DID of the repo. */
13
- did: string
13
+ /** The handle or DID of the repo. */
14
+ repo: string
14
15
  /** The NSID of the record collection. */
15
16
  collection: string
16
17
  /** The key of the record. */
17
18
  rkey: string
19
+ /** Compare and swap with the previous record by cid. */
20
+ swapRecord?: string
21
+ /** Compare and swap with the previous commit by cid. */
22
+ swapCommit?: string
18
23
  [k: string]: unknown
19
24
  }
20
25
 
@@ -29,8 +34,15 @@ export interface Response {
29
34
  headers: Headers
30
35
  }
31
36
 
37
+ export class InvalidSwapError extends XRPCError {
38
+ constructor(src: XRPCError) {
39
+ super(src.status, src.error, src.message)
40
+ }
41
+ }
42
+
32
43
  export function toKnownErr(e: any) {
33
44
  if (e instanceof XRPCError) {
45
+ if (e.error === 'InvalidSwap') return new InvalidSwapError(e)
34
46
  }
35
47
  return e
36
48
  }
@@ -2,13 +2,14 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {
10
11
  /** The handle or DID of the repo. */
11
- user: string
12
+ repo: string
12
13
  }
13
14
 
14
15
  export type InputSchema = undefined
@@ -2,14 +2,15 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {
10
11
  /** The handle or DID of the repo. */
11
- user: string
12
- /** The NSID of the collection. */
12
+ repo: string
13
+ /** The NSID of the record collection. */
13
14
  collection: string
14
15
  /** The key of the record. */
15
16
  rkey: string
@@ -2,21 +2,22 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {
10
11
  /** The handle or DID of the repo. */
11
- user: string
12
+ repo: string
12
13
  /** The NSID of the record type. */
13
14
  collection: string
14
15
  /** The number of records to return. */
15
16
  limit?: number
16
- /** A TID to filter the range of records returned. */
17
- before?: string
18
- /** A TID to filter the range of records returned. */
19
- after?: string
17
+ /** The lowest sort-ordered rkey to start from (exclusive) */
18
+ rkeyStart?: string
19
+ /** The highest sort-ordered rkey to stop at (exclusive) */
20
+ rkeyEnd?: string
20
21
  /** Reverse the order of the returned records? */
21
22
  reverse?: boolean
22
23
  }
@@ -2,23 +2,28 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
11
12
  export interface InputSchema {
12
- /** The DID of the repo. */
13
- did: string
14
- /** The NSID of the record type. */
13
+ /** The handle or DID of the repo. */
14
+ repo: string
15
+ /** The NSID of the record collection. */
15
16
  collection: string
16
- /** The TID of the record. */
17
+ /** The key of the record. */
17
18
  rkey: string
18
19
  /** Validate the record? */
19
20
  validate?: boolean
20
- /** The record to create. */
21
+ /** The record to write. */
21
22
  record: {}
23
+ /** Compare and swap with the previous record by cid. */
24
+ swapRecord?: string | null
25
+ /** Compare and swap with the previous commit by cid. */
26
+ swapCommit?: string
22
27
  [k: string]: unknown
23
28
  }
24
29
 
@@ -40,8 +45,15 @@ export interface Response {
40
45
  data: OutputSchema
41
46
  }
42
47
 
48
+ export class InvalidSwapError extends XRPCError {
49
+ constructor(src: XRPCError) {
50
+ super(src.status, src.error, src.message)
51
+ }
52
+ }
53
+
43
54
  export function toKnownErr(e: any) {
44
55
  if (e instanceof XRPCError) {
56
+ if (e.error === 'InvalidSwap') return new InvalidSwapError(e)
45
57
  }
46
58
  return e
47
59
  }
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
- import { ValidationResult } from '@atproto/lexicon'
4
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
5
5
  import { isObj, hasProp } from '../../../../util'
6
6
  import { lexicons } from '../../../../lexicons'
7
+ import { CID } from 'multiformats/cid'
7
8
 
8
9
  export interface Main {
9
10
  uri: string
@@ -2,16 +2,17 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
11
12
  export type InputSchema = string | Uint8Array
12
13
 
13
14
  export interface OutputSchema {
14
- cid: string
15
+ blob: BlobRef
15
16
  [k: string]: unknown
16
17
  }
17
18
 
@@ -2,9 +2,10 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
@@ -61,12 +62,19 @@ export class HandleNotAvailableError extends XRPCError {
61
62
  }
62
63
  }
63
64
 
65
+ export class UnsupportedDomainError extends XRPCError {
66
+ constructor(src: XRPCError) {
67
+ super(src.status, src.error, src.message)
68
+ }
69
+ }
70
+
64
71
  export function toKnownErr(e: any) {
65
72
  if (e instanceof XRPCError) {
66
73
  if (e.error === 'InvalidHandle') return new InvalidHandleError(e)
67
74
  if (e.error === 'InvalidPassword') return new InvalidPasswordError(e)
68
75
  if (e.error === 'InvalidInviteCode') return new InvalidInviteCodeError(e)
69
76
  if (e.error === 'HandleNotAvailable') return new HandleNotAvailableError(e)
77
+ if (e.error === 'UnsupportedDomain') return new UnsupportedDomainError(e)
70
78
  }
71
79
  return e
72
80
  }
@@ -2,9 +2,10 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
@@ -2,9 +2,10 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
@@ -2,9 +2,10 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11
 
@@ -2,9 +2,10 @@
2
2
  * GENERATED CODE - DO NOT MODIFY
3
3
  */
4
4
  import { Headers, XRPCError } from '@atproto/xrpc'
5
- import { ValidationResult } from '@atproto/lexicon'
5
+ import { ValidationResult, BlobRef } from '@atproto/lexicon'
6
6
  import { isObj, hasProp } from '../../../../util'
7
7
  import { lexicons } from '../../../../lexicons'
8
+ import { CID } from 'multiformats/cid'
8
9
 
9
10
  export interface QueryParams {}
10
11