@atproto/bsky 0.0.198 → 0.0.200

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 (279) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/api/age-assurance/const.d.ts +11 -0
  3. package/dist/api/age-assurance/const.d.ts.map +1 -0
  4. package/dist/api/age-assurance/const.js +142 -0
  5. package/dist/api/age-assurance/const.js.map +1 -0
  6. package/dist/api/age-assurance/index.d.ts +4 -0
  7. package/dist/api/age-assurance/index.d.ts.map +1 -0
  8. package/dist/api/age-assurance/index.js +24 -0
  9. package/dist/api/age-assurance/index.js.map +1 -0
  10. package/dist/api/age-assurance/kws/age-verified.d.ts +109 -0
  11. package/dist/api/age-assurance/kws/age-verified.d.ts.map +1 -0
  12. package/dist/api/age-assurance/kws/age-verified.js +63 -0
  13. package/dist/api/age-assurance/kws/age-verified.js.map +1 -0
  14. package/dist/api/age-assurance/kws/const.d.ts +13 -0
  15. package/dist/api/age-assurance/kws/const.d.ts.map +1 -0
  16. package/dist/api/age-assurance/kws/const.js +36 -0
  17. package/dist/api/age-assurance/kws/const.js.map +1 -0
  18. package/dist/api/age-assurance/kws/external-payload.d.ts +75 -0
  19. package/dist/api/age-assurance/kws/external-payload.d.ts.map +1 -0
  20. package/dist/api/age-assurance/kws/external-payload.js +124 -0
  21. package/dist/api/age-assurance/kws/external-payload.js.map +1 -0
  22. package/dist/api/age-assurance/kws/external-payload.test.d.ts +2 -0
  23. package/dist/api/age-assurance/kws/external-payload.test.d.ts.map +1 -0
  24. package/dist/api/age-assurance/kws/external-payload.test.js +65 -0
  25. package/dist/api/age-assurance/kws/external-payload.test.js.map +1 -0
  26. package/dist/api/age-assurance/redirects/kws-age-verified.d.ts +4 -0
  27. package/dist/api/age-assurance/redirects/kws-age-verified.d.ts.map +1 -0
  28. package/dist/api/age-assurance/redirects/kws-age-verified.js +76 -0
  29. package/dist/api/age-assurance/redirects/kws-age-verified.js.map +1 -0
  30. package/dist/api/age-assurance/stash.d.ts +4 -0
  31. package/dist/api/age-assurance/stash.d.ts.map +1 -0
  32. package/dist/api/age-assurance/stash.js +19 -0
  33. package/dist/api/age-assurance/stash.js.map +1 -0
  34. package/dist/api/age-assurance/types.d.ts +10 -0
  35. package/dist/api/age-assurance/types.d.ts.map +1 -0
  36. package/dist/api/age-assurance/types.js +3 -0
  37. package/dist/api/age-assurance/types.js.map +1 -0
  38. package/dist/api/age-assurance/util.d.ts +15 -0
  39. package/dist/api/age-assurance/util.d.ts.map +1 -0
  40. package/dist/api/age-assurance/util.js +54 -0
  41. package/dist/api/age-assurance/util.js.map +1 -0
  42. package/dist/api/age-assurance/webhooks/kws-age-verified.d.ts +4 -0
  43. package/dist/api/age-assurance/webhooks/kws-age-verified.d.ts.map +1 -0
  44. package/dist/api/age-assurance/webhooks/kws-age-verified.js +63 -0
  45. package/dist/api/age-assurance/webhooks/kws-age-verified.js.map +1 -0
  46. package/dist/api/app/bsky/ageassurance/begin.d.ts +4 -0
  47. package/dist/api/app/bsky/ageassurance/begin.d.ts.map +1 -0
  48. package/dist/api/app/bsky/ageassurance/begin.js +131 -0
  49. package/dist/api/app/bsky/ageassurance/begin.js.map +1 -0
  50. package/dist/api/app/bsky/ageassurance/getConfig.d.ts +4 -0
  51. package/dist/api/app/bsky/ageassurance/getConfig.d.ts.map +1 -0
  52. package/dist/api/app/bsky/ageassurance/getConfig.js +16 -0
  53. package/dist/api/app/bsky/ageassurance/getConfig.js.map +1 -0
  54. package/dist/api/app/bsky/ageassurance/getState.d.ts +4 -0
  55. package/dist/api/app/bsky/ageassurance/getState.d.ts.map +1 -0
  56. package/dist/api/app/bsky/ageassurance/getState.js +42 -0
  57. package/dist/api/app/bsky/ageassurance/getState.js.map +1 -0
  58. package/dist/api/app/bsky/contact/dismissMatch.d.ts +4 -0
  59. package/dist/api/app/bsky/contact/dismissMatch.d.ts.map +1 -0
  60. package/dist/api/app/bsky/contact/dismissMatch.js +23 -0
  61. package/dist/api/app/bsky/contact/dismissMatch.js.map +1 -0
  62. package/dist/api/app/bsky/contact/getMatches.d.ts +4 -0
  63. package/dist/api/app/bsky/contact/getMatches.d.ts.map +1 -0
  64. package/dist/api/app/bsky/contact/getMatches.js +59 -0
  65. package/dist/api/app/bsky/contact/getMatches.js.map +1 -0
  66. package/dist/api/app/bsky/contact/getSyncStatus.d.ts +4 -0
  67. package/dist/api/app/bsky/contact/getSyncStatus.d.ts.map +1 -0
  68. package/dist/api/app/bsky/contact/getSyncStatus.js +32 -0
  69. package/dist/api/app/bsky/contact/getSyncStatus.js.map +1 -0
  70. package/dist/api/app/bsky/contact/importContacts.d.ts +4 -0
  71. package/dist/api/app/bsky/contact/importContacts.d.ts.map +1 -0
  72. package/dist/api/app/bsky/contact/importContacts.js +62 -0
  73. package/dist/api/app/bsky/contact/importContacts.js.map +1 -0
  74. package/dist/api/app/bsky/contact/removeData.d.ts +4 -0
  75. package/dist/api/app/bsky/contact/removeData.d.ts.map +1 -0
  76. package/dist/api/app/bsky/contact/removeData.js +22 -0
  77. package/dist/api/app/bsky/contact/removeData.js.map +1 -0
  78. package/dist/api/app/bsky/contact/startPhoneVerification.d.ts +4 -0
  79. package/dist/api/app/bsky/contact/startPhoneVerification.d.ts.map +1 -0
  80. package/dist/api/app/bsky/contact/startPhoneVerification.js +23 -0
  81. package/dist/api/app/bsky/contact/startPhoneVerification.js.map +1 -0
  82. package/dist/api/app/bsky/contact/util.d.ts +6 -0
  83. package/dist/api/app/bsky/contact/util.d.ts.map +1 -0
  84. package/dist/api/app/bsky/contact/util.js +10 -0
  85. package/dist/api/app/bsky/contact/util.js.map +1 -0
  86. package/dist/api/app/bsky/contact/verifyPhone.d.ts +4 -0
  87. package/dist/api/app/bsky/contact/verifyPhone.d.ts.map +1 -0
  88. package/dist/api/app/bsky/contact/verifyPhone.js +26 -0
  89. package/dist/api/app/bsky/contact/verifyPhone.js.map +1 -0
  90. package/dist/api/app/bsky/graph/getRelationships.d.ts.map +1 -1
  91. package/dist/api/app/bsky/graph/getRelationships.js +4 -0
  92. package/dist/api/app/bsky/graph/getRelationships.js.map +1 -1
  93. package/dist/api/external.d.ts.map +1 -1
  94. package/dist/api/external.js +2 -0
  95. package/dist/api/external.js.map +1 -1
  96. package/dist/api/index.d.ts.map +1 -1
  97. package/dist/api/index.js +22 -2
  98. package/dist/api/index.js.map +1 -1
  99. package/dist/api/kws/api.d.ts.map +1 -1
  100. package/dist/api/kws/api.js +44 -26
  101. package/dist/api/kws/api.js.map +1 -1
  102. package/dist/api/kws/index.d.ts.map +1 -1
  103. package/dist/api/kws/index.js +3 -1
  104. package/dist/api/kws/index.js.map +1 -1
  105. package/dist/api/kws/webhook.d.ts +3 -1
  106. package/dist/api/kws/webhook.d.ts.map +1 -1
  107. package/dist/api/kws/webhook.js +48 -20
  108. package/dist/api/kws/webhook.js.map +1 -1
  109. package/dist/config.d.ts +22 -0
  110. package/dist/config.d.ts.map +1 -1
  111. package/dist/config.js +31 -2
  112. package/dist/config.js.map +1 -1
  113. package/dist/context.d.ts +3 -0
  114. package/dist/context.d.ts.map +1 -1
  115. package/dist/context.js +3 -0
  116. package/dist/context.js.map +1 -1
  117. package/dist/data-plane/bsync/index.d.ts.map +1 -1
  118. package/dist/data-plane/bsync/index.js +22 -0
  119. package/dist/data-plane/bsync/index.js.map +1 -1
  120. package/dist/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.d.ts +4 -0
  121. package/dist/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.d.ts.map +1 -0
  122. package/dist/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.js +30 -0
  123. package/dist/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.js.map +1 -0
  124. package/dist/data-plane/server/db/migrations/index.d.ts +1 -0
  125. package/dist/data-plane/server/db/migrations/index.d.ts.map +1 -1
  126. package/dist/data-plane/server/db/migrations/index.js +2 -1
  127. package/dist/data-plane/server/db/migrations/index.js.map +1 -1
  128. package/dist/data-plane/server/db/pagination.d.ts +3 -3
  129. package/dist/data-plane/server/db/tables/actor.d.ts +3 -0
  130. package/dist/data-plane/server/db/tables/actor.d.ts.map +1 -1
  131. package/dist/data-plane/server/db/tables/actor.js.map +1 -1
  132. package/dist/data-plane/server/routes/profile.d.ts.map +1 -1
  133. package/dist/data-plane/server/routes/profile.js +13 -1
  134. package/dist/data-plane/server/routes/profile.js.map +1 -1
  135. package/dist/hydration/actor.js +1 -1
  136. package/dist/hydration/actor.js.map +1 -1
  137. package/dist/hydration/hydrator.js +1 -1
  138. package/dist/hydration/hydrator.js.map +1 -1
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +12 -0
  141. package/dist/index.js.map +1 -1
  142. package/dist/kws.d.ts +35 -0
  143. package/dist/kws.d.ts.map +1 -1
  144. package/dist/kws.js +54 -0
  145. package/dist/kws.js.map +1 -1
  146. package/dist/lexicon/index.d.ts +19 -0
  147. package/dist/lexicon/index.d.ts.map +1 -1
  148. package/dist/lexicon/index.js +48 -1
  149. package/dist/lexicon/index.js.map +1 -1
  150. package/dist/lexicon/lexicons.d.ts +664 -0
  151. package/dist/lexicon/lexicons.d.ts.map +1 -1
  152. package/dist/lexicon/lexicons.js +354 -0
  153. package/dist/lexicon/lexicons.js.map +1 -1
  154. package/dist/lexicon/types/app/bsky/contact/defs.d.ts +24 -0
  155. package/dist/lexicon/types/app/bsky/contact/defs.d.ts.map +1 -0
  156. package/dist/lexicon/types/app/bsky/contact/defs.js +25 -0
  157. package/dist/lexicon/types/app/bsky/contact/defs.js.map +1 -0
  158. package/dist/lexicon/types/app/bsky/contact/dismissMatch.d.ts +25 -0
  159. package/dist/lexicon/types/app/bsky/contact/dismissMatch.d.ts.map +1 -0
  160. package/dist/lexicon/types/app/bsky/contact/dismissMatch.js +7 -0
  161. package/dist/lexicon/types/app/bsky/contact/dismissMatch.js.map +1 -0
  162. package/dist/lexicon/types/app/bsky/contact/getMatches.d.ts +25 -0
  163. package/dist/lexicon/types/app/bsky/contact/getMatches.d.ts.map +1 -0
  164. package/dist/lexicon/types/app/bsky/contact/getMatches.js +7 -0
  165. package/dist/lexicon/types/app/bsky/contact/getMatches.js.map +1 -0
  166. package/dist/lexicon/types/app/bsky/contact/getSyncStatus.d.ts +21 -0
  167. package/dist/lexicon/types/app/bsky/contact/getSyncStatus.d.ts.map +1 -0
  168. package/dist/lexicon/types/app/bsky/contact/getSyncStatus.js +7 -0
  169. package/dist/lexicon/types/app/bsky/contact/getSyncStatus.js.map +1 -0
  170. package/dist/lexicon/types/app/bsky/contact/importContacts.d.ts +30 -0
  171. package/dist/lexicon/types/app/bsky/contact/importContacts.d.ts.map +1 -0
  172. package/dist/lexicon/types/app/bsky/contact/importContacts.js +7 -0
  173. package/dist/lexicon/types/app/bsky/contact/importContacts.js.map +1 -0
  174. package/dist/lexicon/types/app/bsky/contact/removeData.d.ts +23 -0
  175. package/dist/lexicon/types/app/bsky/contact/removeData.d.ts.map +1 -0
  176. package/dist/lexicon/types/app/bsky/contact/removeData.js +7 -0
  177. package/dist/lexicon/types/app/bsky/contact/removeData.js.map +1 -0
  178. package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.d.ts +25 -0
  179. package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.d.ts.map +1 -0
  180. package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.js +7 -0
  181. package/dist/lexicon/types/app/bsky/contact/startPhoneVerification.js.map +1 -0
  182. package/dist/lexicon/types/app/bsky/contact/verifyPhone.d.ts +29 -0
  183. package/dist/lexicon/types/app/bsky/contact/verifyPhone.d.ts.map +1 -0
  184. package/dist/lexicon/types/app/bsky/contact/verifyPhone.js +7 -0
  185. package/dist/lexicon/types/app/bsky/contact/verifyPhone.js.map +1 -0
  186. package/dist/lexicon/types/app/bsky/graph/defs.d.ts +8 -0
  187. package/dist/lexicon/types/app/bsky/graph/defs.d.ts.map +1 -1
  188. package/dist/lexicon/types/app/bsky/graph/defs.js.map +1 -1
  189. package/dist/logger.d.ts +1 -0
  190. package/dist/logger.d.ts.map +1 -1
  191. package/dist/logger.js +2 -1
  192. package/dist/logger.js.map +1 -1
  193. package/dist/proto/bsky_pb.d.ts +4 -0
  194. package/dist/proto/bsky_pb.d.ts.map +1 -1
  195. package/dist/proto/bsky_pb.js +10 -0
  196. package/dist/proto/bsky_pb.js.map +1 -1
  197. package/dist/proto/rolodex_connect.d.ts +83 -0
  198. package/dist/proto/rolodex_connect.d.ts.map +1 -0
  199. package/dist/proto/rolodex_connect.js +90 -0
  200. package/dist/proto/rolodex_connect.js.map +1 -0
  201. package/dist/proto/rolodex_pb.d.ts +363 -0
  202. package/dist/proto/rolodex_pb.d.ts.map +1 -0
  203. package/dist/proto/rolodex_pb.js +1032 -0
  204. package/dist/proto/rolodex_pb.js.map +1 -0
  205. package/dist/rolodex.d.ts +9 -0
  206. package/dist/rolodex.d.ts.map +1 -0
  207. package/dist/rolodex.js +25 -0
  208. package/dist/rolodex.js.map +1 -0
  209. package/dist/stash.d.ts +1 -0
  210. package/dist/stash.d.ts.map +1 -1
  211. package/dist/stash.js +1 -0
  212. package/dist/stash.js.map +1 -1
  213. package/dist/util/uris.d.ts +2 -2
  214. package/dist/util/uris.d.ts.map +1 -1
  215. package/package.json +16 -15
  216. package/proto/bsky.proto +1 -0
  217. package/proto/rolodex.proto +116 -0
  218. package/src/api/age-assurance/const.ts +142 -0
  219. package/src/api/age-assurance/index.ts +34 -0
  220. package/src/api/age-assurance/kws/age-verified.ts +75 -0
  221. package/src/api/age-assurance/kws/const.ts +33 -0
  222. package/src/api/age-assurance/kws/external-payload.test.ts +72 -0
  223. package/src/api/age-assurance/kws/external-payload.ts +149 -0
  224. package/src/api/age-assurance/redirects/kws-age-verified.ts +107 -0
  225. package/src/api/age-assurance/stash.ts +22 -0
  226. package/src/api/age-assurance/types.ts +10 -0
  227. package/src/api/age-assurance/util.ts +66 -0
  228. package/src/api/age-assurance/webhooks/kws-age-verified.ts +75 -0
  229. package/src/api/app/bsky/ageassurance/begin.ts +167 -0
  230. package/src/api/app/bsky/ageassurance/getConfig.ts +15 -0
  231. package/src/api/app/bsky/ageassurance/getState.ts +53 -0
  232. package/src/api/app/bsky/contact/dismissMatch.ts +24 -0
  233. package/src/api/app/bsky/contact/getMatches.ts +111 -0
  234. package/src/api/app/bsky/contact/getSyncStatus.ts +35 -0
  235. package/src/api/app/bsky/contact/importContacts.ts +118 -0
  236. package/src/api/app/bsky/contact/removeData.ts +23 -0
  237. package/src/api/app/bsky/contact/startPhoneVerification.ts +24 -0
  238. package/src/api/app/bsky/contact/util.ts +13 -0
  239. package/src/api/app/bsky/contact/verifyPhone.ts +27 -0
  240. package/src/api/app/bsky/graph/getRelationships.ts +4 -0
  241. package/src/api/external.ts +2 -0
  242. package/src/api/index.ts +20 -0
  243. package/src/api/kws/api.ts +55 -34
  244. package/src/api/kws/index.ts +7 -1
  245. package/src/api/kws/webhook.ts +57 -34
  246. package/src/config.ts +53 -2
  247. package/src/context.ts +6 -0
  248. package/src/data-plane/bsync/index.ts +31 -0
  249. package/src/data-plane/server/db/migrations/20251120T004738098Z-update-actor-age-assurance-v2.ts +28 -0
  250. package/src/data-plane/server/db/migrations/index.ts +1 -0
  251. package/src/data-plane/server/db/tables/actor.ts +3 -0
  252. package/src/data-plane/server/routes/profile.ts +12 -1
  253. package/src/hydration/actor.ts +1 -1
  254. package/src/hydration/hydrator.ts +1 -1
  255. package/src/index.ts +13 -0
  256. package/src/kws.ts +81 -0
  257. package/src/lexicon/index.ts +101 -0
  258. package/src/lexicon/lexicons.ts +375 -0
  259. package/src/lexicon/types/app/bsky/contact/defs.ts +52 -0
  260. package/src/lexicon/types/app/bsky/contact/dismissMatch.ts +43 -0
  261. package/src/lexicon/types/app/bsky/contact/getMatches.ts +43 -0
  262. package/src/lexicon/types/app/bsky/contact/getSyncStatus.ts +39 -0
  263. package/src/lexicon/types/app/bsky/contact/importContacts.ts +49 -0
  264. package/src/lexicon/types/app/bsky/contact/removeData.ts +40 -0
  265. package/src/lexicon/types/app/bsky/contact/startPhoneVerification.ts +43 -0
  266. package/src/lexicon/types/app/bsky/contact/verifyPhone.ts +48 -0
  267. package/src/lexicon/types/app/bsky/graph/defs.ts +8 -0
  268. package/src/logger.ts +2 -0
  269. package/src/proto/bsky_pb.ts +6 -0
  270. package/src/proto/rolodex_connect.ts +89 -0
  271. package/src/proto/rolodex_pb.ts +746 -0
  272. package/src/rolodex.ts +42 -0
  273. package/src/stash.ts +3 -0
  274. package/tests/views/__snapshots__/profile.test.ts.snap +103 -0
  275. package/tests/views/age-assurance-v2.test.ts +745 -0
  276. package/tests/views/age-assurance.test.ts +2 -0
  277. package/tests/views/profile.test.ts +39 -0
  278. package/tsconfig.build.tsbuildinfo +1 -1
  279. package/tsconfig.tests.tsbuildinfo +1 -1
package/src/kws.ts CHANGED
@@ -15,8 +15,30 @@ const authResponseSchema = z.object({
15
15
  })
16
16
 
17
17
  const EXTERNAL_PAYLOAD_CHAR_LIMIT = 200
18
+ /**
19
+ * Thrown when the provided external payload exceeds KWS's character limit.
20
+ * This is most commonly caused by DIDs that are too long, such as for
21
+ * `did:web` DIDs. But it's very rare, and the client has special handling for
22
+ * this case.
23
+ */
18
24
  export class KwsExternalPayloadError extends Error {}
19
25
 
26
+ export type KWSSendEmailRequestCommon = {
27
+ email: string
28
+ location: string
29
+ language: string
30
+ externalPayload: string
31
+ }
32
+
33
+ export type KWSSendEmailRequest =
34
+ | (KWSSendEmailRequestCommon & {
35
+ userContext: 'adult'
36
+ })
37
+ | (KWSSendEmailRequestCommon & {
38
+ userContext: 'age'
39
+ minimumAge: number
40
+ })
41
+
20
42
  export class KwsClient {
21
43
  constructor(public cfg: KwsConfig) {}
22
44
 
@@ -68,6 +90,9 @@ export class KwsClient {
68
90
  })
69
91
  }
70
92
 
93
+ /**
94
+ * @deprecated Use `sendAdultVerifiedFlowEmail` or `sendAgeVerifiedFlowEmail` instead.
95
+ */
71
96
  async sendEmail({
72
97
  countryCode,
73
98
  email,
@@ -113,4 +138,60 @@ export class KwsClient {
113
138
 
114
139
  return res.json()
115
140
  }
141
+
142
+ /**
143
+ * Sends a KWS verification email with the given properties.
144
+ */
145
+ async email(props: KWSSendEmailRequest) {
146
+ const res = await this.fetchWithAuth(
147
+ `${this.cfg.apiOrigin}/v1/verifications/send-email`,
148
+ {
149
+ method: 'POST',
150
+ headers: {
151
+ 'Content-Type': 'application/json',
152
+ 'User-Agent': this.cfg.userAgent,
153
+ },
154
+ body: JSON.stringify(props),
155
+ },
156
+ )
157
+
158
+ if (!res.ok) {
159
+ const errorText = await res.text()
160
+ log.error(
161
+ {
162
+ status: res.status,
163
+ statusText: res.statusText,
164
+ errorText,
165
+ flow: props.userContext,
166
+ },
167
+ 'Failed to send KWS email',
168
+ )
169
+ throw new Error('Failed to send KWS email')
170
+ }
171
+
172
+ return res.json()
173
+ }
174
+
175
+ /**
176
+ * Sends an email to the user initiating an `adult` verification flow, which
177
+ * results in `adult-verified` events/webhooks.
178
+ */
179
+ async sendAdultVerifiedFlowEmail(props: KWSSendEmailRequestCommon) {
180
+ return this.email({
181
+ ...props,
182
+ userContext: 'adult',
183
+ })
184
+ }
185
+
186
+ /**
187
+ * Sends an email to the user initiating an `age` verification flow, which
188
+ * results in `age-verified` events/webhooks.
189
+ */
190
+ async sendAgeVerifiedFlowEmail(props: KWSSendEmailRequestCommon) {
191
+ return this.email({
192
+ ...props,
193
+ userContext: 'age',
194
+ minimumAge: 16, // KWS required value
195
+ })
196
+ }
116
197
  }
@@ -23,6 +23,13 @@ import * as AppBskyAgeassuranceGetState from './types/app/bsky/ageassurance/getS
23
23
  import * as AppBskyBookmarkCreateBookmark from './types/app/bsky/bookmark/createBookmark.js'
24
24
  import * as AppBskyBookmarkDeleteBookmark from './types/app/bsky/bookmark/deleteBookmark.js'
25
25
  import * as AppBskyBookmarkGetBookmarks from './types/app/bsky/bookmark/getBookmarks.js'
26
+ import * as AppBskyContactDismissMatch from './types/app/bsky/contact/dismissMatch.js'
27
+ import * as AppBskyContactGetMatches from './types/app/bsky/contact/getMatches.js'
28
+ import * as AppBskyContactGetSyncStatus from './types/app/bsky/contact/getSyncStatus.js'
29
+ import * as AppBskyContactImportContacts from './types/app/bsky/contact/importContacts.js'
30
+ import * as AppBskyContactRemoveData from './types/app/bsky/contact/removeData.js'
31
+ import * as AppBskyContactStartPhoneVerification from './types/app/bsky/contact/startPhoneVerification.js'
32
+ import * as AppBskyContactVerifyPhone from './types/app/bsky/contact/verifyPhone.js'
26
33
  import * as AppBskyFeedDescribeFeedGenerator from './types/app/bsky/feed/describeFeedGenerator.js'
27
34
  import * as AppBskyFeedGetActorFeeds from './types/app/bsky/feed/getActorFeeds.js'
28
35
  import * as AppBskyFeedGetActorLikes from './types/app/bsky/feed/getActorLikes.js'
@@ -276,6 +283,7 @@ export class AppBskyNS {
276
283
  actor: AppBskyActorNS
277
284
  ageassurance: AppBskyAgeassuranceNS
278
285
  bookmark: AppBskyBookmarkNS
286
+ contact: AppBskyContactNS
279
287
  embed: AppBskyEmbedNS
280
288
  feed: AppBskyFeedNS
281
289
  graph: AppBskyGraphNS
@@ -290,6 +298,7 @@ export class AppBskyNS {
290
298
  this.actor = new AppBskyActorNS(server)
291
299
  this.ageassurance = new AppBskyAgeassuranceNS(server)
292
300
  this.bookmark = new AppBskyBookmarkNS(server)
301
+ this.contact = new AppBskyContactNS(server)
293
302
  this.embed = new AppBskyEmbedNS(server)
294
303
  this.feed = new AppBskyFeedNS(server)
295
304
  this.graph = new AppBskyGraphNS(server)
@@ -481,6 +490,98 @@ export class AppBskyBookmarkNS {
481
490
  }
482
491
  }
483
492
 
493
+ export class AppBskyContactNS {
494
+ _server: Server
495
+
496
+ constructor(server: Server) {
497
+ this._server = server
498
+ }
499
+
500
+ dismissMatch<A extends Auth = void>(
501
+ cfg: MethodConfigOrHandler<
502
+ A,
503
+ AppBskyContactDismissMatch.QueryParams,
504
+ AppBskyContactDismissMatch.HandlerInput,
505
+ AppBskyContactDismissMatch.HandlerOutput
506
+ >,
507
+ ) {
508
+ const nsid = 'app.bsky.contact.dismissMatch' // @ts-ignore
509
+ return this._server.xrpc.method(nsid, cfg)
510
+ }
511
+
512
+ getMatches<A extends Auth = void>(
513
+ cfg: MethodConfigOrHandler<
514
+ A,
515
+ AppBskyContactGetMatches.QueryParams,
516
+ AppBskyContactGetMatches.HandlerInput,
517
+ AppBskyContactGetMatches.HandlerOutput
518
+ >,
519
+ ) {
520
+ const nsid = 'app.bsky.contact.getMatches' // @ts-ignore
521
+ return this._server.xrpc.method(nsid, cfg)
522
+ }
523
+
524
+ getSyncStatus<A extends Auth = void>(
525
+ cfg: MethodConfigOrHandler<
526
+ A,
527
+ AppBskyContactGetSyncStatus.QueryParams,
528
+ AppBskyContactGetSyncStatus.HandlerInput,
529
+ AppBskyContactGetSyncStatus.HandlerOutput
530
+ >,
531
+ ) {
532
+ const nsid = 'app.bsky.contact.getSyncStatus' // @ts-ignore
533
+ return this._server.xrpc.method(nsid, cfg)
534
+ }
535
+
536
+ importContacts<A extends Auth = void>(
537
+ cfg: MethodConfigOrHandler<
538
+ A,
539
+ AppBskyContactImportContacts.QueryParams,
540
+ AppBskyContactImportContacts.HandlerInput,
541
+ AppBskyContactImportContacts.HandlerOutput
542
+ >,
543
+ ) {
544
+ const nsid = 'app.bsky.contact.importContacts' // @ts-ignore
545
+ return this._server.xrpc.method(nsid, cfg)
546
+ }
547
+
548
+ removeData<A extends Auth = void>(
549
+ cfg: MethodConfigOrHandler<
550
+ A,
551
+ AppBskyContactRemoveData.QueryParams,
552
+ AppBskyContactRemoveData.HandlerInput,
553
+ AppBskyContactRemoveData.HandlerOutput
554
+ >,
555
+ ) {
556
+ const nsid = 'app.bsky.contact.removeData' // @ts-ignore
557
+ return this._server.xrpc.method(nsid, cfg)
558
+ }
559
+
560
+ startPhoneVerification<A extends Auth = void>(
561
+ cfg: MethodConfigOrHandler<
562
+ A,
563
+ AppBskyContactStartPhoneVerification.QueryParams,
564
+ AppBskyContactStartPhoneVerification.HandlerInput,
565
+ AppBskyContactStartPhoneVerification.HandlerOutput
566
+ >,
567
+ ) {
568
+ const nsid = 'app.bsky.contact.startPhoneVerification' // @ts-ignore
569
+ return this._server.xrpc.method(nsid, cfg)
570
+ }
571
+
572
+ verifyPhone<A extends Auth = void>(
573
+ cfg: MethodConfigOrHandler<
574
+ A,
575
+ AppBskyContactVerifyPhone.QueryParams,
576
+ AppBskyContactVerifyPhone.HandlerInput,
577
+ AppBskyContactVerifyPhone.HandlerOutput
578
+ >,
579
+ ) {
580
+ const nsid = 'app.bsky.contact.verifyPhone' // @ts-ignore
581
+ return this._server.xrpc.method(nsid, cfg)
582
+ }
583
+ }
584
+
484
585
  export class AppBskyEmbedNS {
485
586
  _server: Server
486
587
 
@@ -1736,6 +1736,348 @@ export const schemaDict = {
1736
1736
  },
1737
1737
  },
1738
1738
  },
1739
+ AppBskyContactDefs: {
1740
+ lexicon: 1,
1741
+ id: 'app.bsky.contact.defs',
1742
+ defs: {
1743
+ matchAndContactIndex: {
1744
+ description:
1745
+ 'Associates a profile with the positional index of the contact import input in the call to `app.bsky.contact.importContacts`, so clients can know which phone caused a particular match.',
1746
+ type: 'object',
1747
+ required: ['match', 'contactIndex'],
1748
+ properties: {
1749
+ match: {
1750
+ description: 'Profile of the matched user.',
1751
+ type: 'ref',
1752
+ ref: 'lex:app.bsky.actor.defs#profileView',
1753
+ },
1754
+ contactIndex: {
1755
+ description: 'The index of this match in the import contact input.',
1756
+ type: 'integer',
1757
+ minimum: 0,
1758
+ maximum: 999,
1759
+ },
1760
+ },
1761
+ },
1762
+ syncStatus: {
1763
+ type: 'object',
1764
+ required: ['syncedAt', 'matchesCount'],
1765
+ properties: {
1766
+ syncedAt: {
1767
+ description: 'Last date when contacts where imported.',
1768
+ type: 'string',
1769
+ format: 'datetime',
1770
+ },
1771
+ matchesCount: {
1772
+ description:
1773
+ 'Number of existing contact matches resulting of the user imports and of their imported contacts having imported the user. Matches stop being counted when the user either follows the matched contact or dismisses the match.',
1774
+ type: 'integer',
1775
+ minimum: 0,
1776
+ },
1777
+ },
1778
+ },
1779
+ },
1780
+ },
1781
+ AppBskyContactDismissMatch: {
1782
+ lexicon: 1,
1783
+ id: 'app.bsky.contact.dismissMatch',
1784
+ defs: {
1785
+ main: {
1786
+ type: 'procedure',
1787
+ description:
1788
+ "WARNING: This is unstable and under active development, don't use it while this warning is here. Removes a match that was found via contact import. It shouldn't appear again if the same contact is re-imported. Requires authentication.",
1789
+ input: {
1790
+ encoding: 'application/json',
1791
+ schema: {
1792
+ type: 'object',
1793
+ required: ['subject'],
1794
+ properties: {
1795
+ subject: {
1796
+ description: "The subject's DID to dismiss the match with.",
1797
+ type: 'string',
1798
+ format: 'did',
1799
+ },
1800
+ },
1801
+ },
1802
+ },
1803
+ output: {
1804
+ encoding: 'application/json',
1805
+ schema: {
1806
+ type: 'object',
1807
+ properties: {},
1808
+ },
1809
+ },
1810
+ errors: [
1811
+ {
1812
+ name: 'TODO',
1813
+ description: 'TODO',
1814
+ },
1815
+ ],
1816
+ },
1817
+ },
1818
+ },
1819
+ AppBskyContactGetMatches: {
1820
+ lexicon: 1,
1821
+ id: 'app.bsky.contact.getMatches',
1822
+ defs: {
1823
+ main: {
1824
+ type: 'query',
1825
+ description:
1826
+ "WARNING: This is unstable and under active development, don't use it while this warning is here. Returns the matched contacts (contacts that were mutually imported). Excludes dismissed matches. Requires authentication.",
1827
+ parameters: {
1828
+ type: 'params',
1829
+ properties: {
1830
+ limit: {
1831
+ type: 'integer',
1832
+ minimum: 1,
1833
+ maximum: 100,
1834
+ default: 50,
1835
+ },
1836
+ cursor: {
1837
+ type: 'string',
1838
+ },
1839
+ },
1840
+ },
1841
+ output: {
1842
+ encoding: 'application/json',
1843
+ schema: {
1844
+ type: 'object',
1845
+ required: ['matches'],
1846
+ properties: {
1847
+ cursor: {
1848
+ type: 'string',
1849
+ },
1850
+ matches: {
1851
+ type: 'array',
1852
+ items: {
1853
+ type: 'ref',
1854
+ ref: 'lex:app.bsky.actor.defs#profileView',
1855
+ },
1856
+ },
1857
+ },
1858
+ },
1859
+ },
1860
+ errors: [
1861
+ {
1862
+ name: 'TODO',
1863
+ description: 'TODO',
1864
+ },
1865
+ ],
1866
+ },
1867
+ },
1868
+ },
1869
+ AppBskyContactGetSyncStatus: {
1870
+ lexicon: 1,
1871
+ id: 'app.bsky.contact.getSyncStatus',
1872
+ defs: {
1873
+ main: {
1874
+ type: 'query',
1875
+ description:
1876
+ "WARNING: This is unstable and under active development, don't use it while this warning is here. Gets the user's current contact import status. Requires authentication.",
1877
+ parameters: {
1878
+ type: 'params',
1879
+ properties: {},
1880
+ },
1881
+ output: {
1882
+ encoding: 'application/json',
1883
+ schema: {
1884
+ type: 'object',
1885
+ properties: {
1886
+ syncStatus: {
1887
+ description:
1888
+ "If present, indicates the user has imported their contacts. If not present, indicates the user never used the feature or called `app.bsky.contact.removeData` and didn't import again since.",
1889
+ type: 'ref',
1890
+ ref: 'lex:app.bsky.contact.defs#syncStatus',
1891
+ },
1892
+ },
1893
+ },
1894
+ },
1895
+ errors: [
1896
+ {
1897
+ name: 'TODO',
1898
+ description: 'TODO',
1899
+ },
1900
+ ],
1901
+ },
1902
+ },
1903
+ },
1904
+ AppBskyContactImportContacts: {
1905
+ lexicon: 1,
1906
+ id: 'app.bsky.contact.importContacts',
1907
+ defs: {
1908
+ main: {
1909
+ type: 'procedure',
1910
+ description:
1911
+ "WARNING: This is unstable and under active development, don't use it while this warning is here. Import contacts for securely matching with other users. This follows the protocol explained in https://docs.bsky.app/blog/contact-import-rfc. Requires authentication.",
1912
+ input: {
1913
+ encoding: 'application/json',
1914
+ schema: {
1915
+ type: 'object',
1916
+ required: ['token', 'contacts'],
1917
+ properties: {
1918
+ token: {
1919
+ description:
1920
+ 'JWT to authenticate the call. Use the JWT received as a response to the call to `app.bsky.contact.verifyPhone`.',
1921
+ type: 'string',
1922
+ },
1923
+ contacts: {
1924
+ description:
1925
+ "List of phone numbers in global E.164 format (e.g., '+12125550123'). Phone numbers that cannot be normalized into a valid phone number will be discarded. Should not repeat the 'phone' input used in `app.bsky.contact.verifyPhone`.",
1926
+ type: 'array',
1927
+ items: {
1928
+ type: 'string',
1929
+ },
1930
+ minLength: 1,
1931
+ maxLength: 1000,
1932
+ },
1933
+ },
1934
+ },
1935
+ },
1936
+ output: {
1937
+ encoding: 'application/json',
1938
+ schema: {
1939
+ type: 'object',
1940
+ required: ['matchesAndContactIndexes'],
1941
+ properties: {
1942
+ matchesAndContactIndexes: {
1943
+ description:
1944
+ 'The users that matched during import and their indexes on the input contacts, so the client can correlate with its local list.',
1945
+ type: 'array',
1946
+ items: {
1947
+ type: 'ref',
1948
+ ref: 'lex:app.bsky.contact.defs#matchAndContactIndex',
1949
+ },
1950
+ },
1951
+ },
1952
+ },
1953
+ },
1954
+ errors: [
1955
+ {
1956
+ name: 'TODO',
1957
+ description: 'TODO',
1958
+ },
1959
+ ],
1960
+ },
1961
+ },
1962
+ },
1963
+ AppBskyContactRemoveData: {
1964
+ lexicon: 1,
1965
+ id: 'app.bsky.contact.removeData',
1966
+ defs: {
1967
+ main: {
1968
+ type: 'procedure',
1969
+ description:
1970
+ "WARNING: This is unstable and under active development, don't use it while this warning is here. Removes all stored hashes used for contact matching, existing matches, and sync status. Requires authentication.",
1971
+ input: {
1972
+ encoding: 'application/json',
1973
+ schema: {
1974
+ type: 'object',
1975
+ properties: {},
1976
+ },
1977
+ },
1978
+ output: {
1979
+ encoding: 'application/json',
1980
+ schema: {
1981
+ type: 'object',
1982
+ properties: {},
1983
+ },
1984
+ },
1985
+ errors: [
1986
+ {
1987
+ name: 'TODO',
1988
+ description: 'TODO',
1989
+ },
1990
+ ],
1991
+ },
1992
+ },
1993
+ },
1994
+ AppBskyContactStartPhoneVerification: {
1995
+ lexicon: 1,
1996
+ id: 'app.bsky.contact.startPhoneVerification',
1997
+ defs: {
1998
+ main: {
1999
+ type: 'procedure',
2000
+ description:
2001
+ "WARNING: This is unstable and under active development, don't use it while this warning is here. Starts a phone verification flow. The phone passed will receive a code via SMS that should be passed to `app.bsky.contact.verifyPhone`. Requires authentication.",
2002
+ input: {
2003
+ encoding: 'application/json',
2004
+ schema: {
2005
+ type: 'object',
2006
+ required: ['phone'],
2007
+ properties: {
2008
+ phone: {
2009
+ description: 'The phone number to receive the code via SMS.',
2010
+ type: 'string',
2011
+ },
2012
+ },
2013
+ },
2014
+ },
2015
+ output: {
2016
+ encoding: 'application/json',
2017
+ schema: {
2018
+ type: 'object',
2019
+ properties: {},
2020
+ },
2021
+ },
2022
+ errors: [
2023
+ {
2024
+ name: 'TODO',
2025
+ description: 'TODO',
2026
+ },
2027
+ ],
2028
+ },
2029
+ },
2030
+ },
2031
+ AppBskyContactVerifyPhone: {
2032
+ lexicon: 1,
2033
+ id: 'app.bsky.contact.verifyPhone',
2034
+ defs: {
2035
+ main: {
2036
+ type: 'procedure',
2037
+ description:
2038
+ "WARNING: This is unstable and under active development, don't use it while this warning is here. Verifies control over a phone number with a code received via SMS and starts a contact import session. Requires authentication.",
2039
+ input: {
2040
+ encoding: 'application/json',
2041
+ schema: {
2042
+ type: 'object',
2043
+ required: ['phone', 'code'],
2044
+ properties: {
2045
+ phone: {
2046
+ description:
2047
+ 'The phone number to verify. Should be the same as the one passed to `app.bsky.contact.startPhoneVerification`.',
2048
+ type: 'string',
2049
+ },
2050
+ code: {
2051
+ description:
2052
+ 'The code received via SMS as a result of the call to `app.bsky.contact.startPhoneVerification`.',
2053
+ type: 'string',
2054
+ },
2055
+ },
2056
+ },
2057
+ },
2058
+ output: {
2059
+ encoding: 'application/json',
2060
+ schema: {
2061
+ type: 'object',
2062
+ required: ['token'],
2063
+ properties: {
2064
+ token: {
2065
+ description:
2066
+ 'JWT to be used in a call to `app.bsky.contact.importContacts`. It is only valid for a single call.',
2067
+ type: 'string',
2068
+ },
2069
+ },
2070
+ },
2071
+ },
2072
+ errors: [
2073
+ {
2074
+ name: 'TODO',
2075
+ description: 'TODO',
2076
+ },
2077
+ ],
2078
+ },
2079
+ },
2080
+ },
1739
2081
  AppBskyEmbedDefs: {
1740
2082
  lexicon: 1,
1741
2083
  id: 'app.bsky.embed.defs',
@@ -4461,6 +4803,30 @@ export const schemaDict = {
4461
4803
  description:
4462
4804
  'if the actor is followed by this DID, contains the AT-URI of the follow record',
4463
4805
  },
4806
+ blocking: {
4807
+ type: 'string',
4808
+ format: 'at-uri',
4809
+ description:
4810
+ 'if the actor blocks this DID, this is the AT-URI of the block record',
4811
+ },
4812
+ blockedBy: {
4813
+ type: 'string',
4814
+ format: 'at-uri',
4815
+ description:
4816
+ 'if the actor is blocked by this DID, contains the AT-URI of the block record',
4817
+ },
4818
+ blockingByList: {
4819
+ type: 'string',
4820
+ format: 'at-uri',
4821
+ description:
4822
+ 'if the actor blocks this DID via a block list, this is the AT-URI of the listblock record',
4823
+ },
4824
+ blockedByList: {
4825
+ type: 'string',
4826
+ format: 'at-uri',
4827
+ description:
4828
+ 'if the actor is blocked by this DID via a block list, contains the AT-URI of the listblock record',
4829
+ },
4464
4830
  },
4465
4831
  },
4466
4832
  },
@@ -14421,6 +14787,15 @@ export const ids = {
14421
14787
  AppBskyBookmarkDefs: 'app.bsky.bookmark.defs',
14422
14788
  AppBskyBookmarkDeleteBookmark: 'app.bsky.bookmark.deleteBookmark',
14423
14789
  AppBskyBookmarkGetBookmarks: 'app.bsky.bookmark.getBookmarks',
14790
+ AppBskyContactDefs: 'app.bsky.contact.defs',
14791
+ AppBskyContactDismissMatch: 'app.bsky.contact.dismissMatch',
14792
+ AppBskyContactGetMatches: 'app.bsky.contact.getMatches',
14793
+ AppBskyContactGetSyncStatus: 'app.bsky.contact.getSyncStatus',
14794
+ AppBskyContactImportContacts: 'app.bsky.contact.importContacts',
14795
+ AppBskyContactRemoveData: 'app.bsky.contact.removeData',
14796
+ AppBskyContactStartPhoneVerification:
14797
+ 'app.bsky.contact.startPhoneVerification',
14798
+ AppBskyContactVerifyPhone: 'app.bsky.contact.verifyPhone',
14424
14799
  AppBskyEmbedDefs: 'app.bsky.embed.defs',
14425
14800
  AppBskyEmbedExternal: 'app.bsky.embed.external',
14426
14801
  AppBskyEmbedImages: 'app.bsky.embed.images',
@@ -0,0 +1,52 @@
1
+ /**
2
+ * GENERATED CODE - DO NOT MODIFY
3
+ */
4
+ import { type ValidationResult, BlobRef } from '@atproto/lexicon'
5
+ import { CID } from 'multiformats/cid'
6
+ import { validate as _validate } from '../../../../lexicons'
7
+ import {
8
+ type $Typed,
9
+ is$typed as _is$typed,
10
+ type OmitKey,
11
+ } from '../../../../util'
12
+ import type * as AppBskyActorDefs from '../actor/defs.js'
13
+
14
+ const is$typed = _is$typed,
15
+ validate = _validate
16
+ const id = 'app.bsky.contact.defs'
17
+
18
+ /** Associates a profile with the positional index of the contact import input in the call to `app.bsky.contact.importContacts`, so clients can know which phone caused a particular match. */
19
+ export interface MatchAndContactIndex {
20
+ $type?: 'app.bsky.contact.defs#matchAndContactIndex'
21
+ match: AppBskyActorDefs.ProfileView
22
+ /** The index of this match in the import contact input. */
23
+ contactIndex: number
24
+ }
25
+
26
+ const hashMatchAndContactIndex = 'matchAndContactIndex'
27
+
28
+ export function isMatchAndContactIndex<V>(v: V) {
29
+ return is$typed(v, id, hashMatchAndContactIndex)
30
+ }
31
+
32
+ export function validateMatchAndContactIndex<V>(v: V) {
33
+ return validate<MatchAndContactIndex & V>(v, id, hashMatchAndContactIndex)
34
+ }
35
+
36
+ export interface SyncStatus {
37
+ $type?: 'app.bsky.contact.defs#syncStatus'
38
+ /** Last date when contacts where imported. */
39
+ syncedAt: string
40
+ /** Number of existing contact matches resulting of the user imports and of their imported contacts having imported the user. Matches stop being counted when the user either follows the matched contact or dismisses the match. */
41
+ matchesCount: number
42
+ }
43
+
44
+ const hashSyncStatus = 'syncStatus'
45
+
46
+ export function isSyncStatus<V>(v: V) {
47
+ return is$typed(v, id, hashSyncStatus)
48
+ }
49
+
50
+ export function validateSyncStatus<V>(v: V) {
51
+ return validate<SyncStatus & V>(v, id, hashSyncStatus)
52
+ }