@clioplaylists/clio 0.1.4 → 0.1.6

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 (293) hide show
  1. package/dist/api/com/clioplaylists/alpha/actor/getProfile.d.ts +0 -0
  2. package/dist/api/com/clioplaylists/alpha/actor/getProfile.js +37 -0
  3. package/dist/api/com/clioplaylists/alpha/feed/getSongs.d.ts +0 -0
  4. package/dist/api/com/clioplaylists/alpha/feed/getSongs.js +37 -0
  5. package/dist/api/health.d.ts +3 -0
  6. package/dist/api/health.js +32 -0
  7. package/dist/api/index.d.ts +4 -0
  8. package/dist/api/index.js +43 -0
  9. package/dist/api/util.d.ts +9 -0
  10. package/dist/api/util.js +17 -0
  11. package/dist/auth-verifier.d.ts +92 -0
  12. package/dist/auth-verifier.js +473 -0
  13. package/dist/client.d.ts +9 -0
  14. package/dist/client.js +40 -0
  15. package/dist/config.d.ts +21 -0
  16. package/dist/config.js +65 -0
  17. package/dist/context.d.ts +11 -0
  18. package/dist/context.js +19 -0
  19. package/dist/dataplane/client.d.ts +27 -0
  20. package/dist/dataplane/client.js +165 -0
  21. package/dist/dataplane/index.d.ts +2 -0
  22. package/dist/dataplane/index.js +18 -0
  23. package/dist/dataplane/server/background.d.ts +13 -0
  24. package/dist/dataplane/server/background.js +51 -0
  25. package/dist/dataplane/server/db/database-schema.d.ts +13 -0
  26. package/dist/dataplane/server/db/database-schema.js +2 -0
  27. package/dist/dataplane/server/db/db.d.ts +32 -0
  28. package/dist/dataplane/server/db/db.js +228 -0
  29. package/dist/dataplane/server/db/index.d.ts +1 -0
  30. package/dist/dataplane/server/db/index.js +17 -0
  31. package/dist/dataplane/server/db/migrations/20230309T045948368Z-init.d.ts +3 -0
  32. package/dist/dataplane/server/db/migrations/20230309T045948368Z-init.js +117 -0
  33. package/dist/dataplane/server/db/migrations/20230420T211446071Z-did-cache.d.ts +3 -0
  34. package/dist/dataplane/server/db/migrations/20230420T211446071Z-did-cache.js +15 -0
  35. package/dist/dataplane/server/db/migrations/index.d.ts +2 -0
  36. package/dist/dataplane/server/db/migrations/index.js +41 -0
  37. package/dist/dataplane/server/db/migrations/provider.d.ts +11 -0
  38. package/dist/dataplane/server/db/migrations/provider.js +31 -0
  39. package/dist/dataplane/server/db/pagination.d.ts +86 -0
  40. package/dist/dataplane/server/db/pagination.js +144 -0
  41. package/dist/dataplane/server/db/tables/actor-sync.d.ts +9 -0
  42. package/dist/dataplane/server/db/tables/actor-sync.js +4 -0
  43. package/dist/dataplane/server/db/tables/actor.d.ts +11 -0
  44. package/dist/dataplane/server/db/tables/actor.js +4 -0
  45. package/dist/dataplane/server/db/tables/artist-list-item.d.ts +11 -0
  46. package/dist/dataplane/server/db/tables/artist-list-item.js +4 -0
  47. package/dist/dataplane/server/db/tables/artist.d.ts +10 -0
  48. package/dist/dataplane/server/db/tables/artist.js +4 -0
  49. package/dist/dataplane/server/db/tables/playlist-idea.d.ts +14 -0
  50. package/dist/dataplane/server/db/tables/playlist-idea.js +4 -0
  51. package/dist/dataplane/server/db/tables/playlist-item.d.ts +11 -0
  52. package/dist/dataplane/server/db/tables/playlist-item.js +4 -0
  53. package/dist/dataplane/server/db/tables/playlist.d.ts +10 -0
  54. package/dist/dataplane/server/db/tables/playlist.js +4 -0
  55. package/dist/dataplane/server/db/tables/profile.d.ts +15 -0
  56. package/dist/dataplane/server/db/tables/profile.js +4 -0
  57. package/dist/dataplane/server/db/tables/record.d.ts +12 -0
  58. package/dist/dataplane/server/db/tables/record.js +4 -0
  59. package/dist/dataplane/server/db/tables/song.d.ts +12 -0
  60. package/dist/dataplane/server/db/tables/song.js +4 -0
  61. package/dist/dataplane/server/db/types.d.ts +9 -0
  62. package/dist/dataplane/server/db/types.js +2 -0
  63. package/dist/dataplane/server/db/util.d.ts +20 -0
  64. package/dist/dataplane/server/db/util.js +48 -0
  65. package/dist/dataplane/server/index.d.ts +11 -0
  66. package/dist/dataplane/server/index.js +52 -0
  67. package/dist/dataplane/server/indexing/index.d.ts +32 -0
  68. package/dist/dataplane/server/indexing/index.js +321 -0
  69. package/dist/dataplane/server/indexing/plugins/playlist-idea.d.ts +14 -0
  70. package/dist/dataplane/server/indexing/plugins/playlist-idea.js +163 -0
  71. package/dist/dataplane/server/indexing/plugins/profile.d.ts +8 -0
  72. package/dist/dataplane/server/indexing/plugins/profile.js +81 -0
  73. package/dist/dataplane/server/indexing/processor.d.ts +22 -0
  74. package/dist/dataplane/server/indexing/processor.js +90 -0
  75. package/dist/dataplane/server/routes/identity.d.ts +6 -0
  76. package/dist/dataplane/server/routes/identity.js +56 -0
  77. package/dist/dataplane/server/routes/index.d.ts +5 -0
  78. package/dist/dataplane/server/routes/index.js +19 -0
  79. package/dist/dataplane/server/routes/profile.d.ts +5 -0
  80. package/dist/dataplane/server/routes/profile.js +61 -0
  81. package/dist/dataplane/server/routes/records.d.ts +11 -0
  82. package/dist/dataplane/server/routes/records.js +88 -0
  83. package/dist/dataplane/server/routes/sync.d.ts +5 -0
  84. package/dist/dataplane/server/routes/sync.js +14 -0
  85. package/dist/dataplane/server/subscription.d.ts +25 -0
  86. package/dist/dataplane/server/subscription.js +114 -0
  87. package/dist/error.d.ts +2 -0
  88. package/dist/error.js +14 -0
  89. package/dist/index.d.ts +20 -0
  90. package/dist/index.js +115 -0
  91. package/dist/lexicons/index.d.ts +278 -0
  92. package/dist/lexicons/index.js +638 -0
  93. package/dist/lexicons/lexicons.d.ts +8466 -0
  94. package/dist/lexicons/lexicons.js +4551 -0
  95. package/dist/lexicons/types/com/atproto/admin/defs.d.ts +50 -0
  96. package/dist/lexicons/types/com/atproto/admin/defs.js +54 -0
  97. package/dist/lexicons/types/com/atproto/admin/deleteAccount.d.ts +29 -0
  98. package/dist/lexicons/types/com/atproto/admin/deleteAccount.js +2 -0
  99. package/dist/lexicons/types/com/atproto/admin/disableAccountInvites.d.ts +31 -0
  100. package/dist/lexicons/types/com/atproto/admin/disableAccountInvites.js +2 -0
  101. package/dist/lexicons/types/com/atproto/admin/disableInviteCodes.d.ts +30 -0
  102. package/dist/lexicons/types/com/atproto/admin/disableInviteCodes.js +2 -0
  103. package/dist/lexicons/types/com/atproto/admin/enableAccountInvites.d.ts +31 -0
  104. package/dist/lexicons/types/com/atproto/admin/enableAccountInvites.js +2 -0
  105. package/dist/lexicons/types/com/atproto/admin/getAccountInfo.d.ts +33 -0
  106. package/dist/lexicons/types/com/atproto/admin/getAccountInfo.js +2 -0
  107. package/dist/lexicons/types/com/atproto/admin/getAccountInfos.d.ts +36 -0
  108. package/dist/lexicons/types/com/atproto/admin/getAccountInfos.js +2 -0
  109. package/dist/lexicons/types/com/atproto/admin/getInviteCodes.d.ts +39 -0
  110. package/dist/lexicons/types/com/atproto/admin/getInviteCodes.js +2 -0
  111. package/dist/lexicons/types/com/atproto/admin/getSubjectStatus.d.ts +44 -0
  112. package/dist/lexicons/types/com/atproto/admin/getSubjectStatus.js +2 -0
  113. package/dist/lexicons/types/com/atproto/admin/searchAccounts.d.ts +39 -0
  114. package/dist/lexicons/types/com/atproto/admin/searchAccounts.js +2 -0
  115. package/dist/lexicons/types/com/atproto/admin/sendEmail.d.ts +45 -0
  116. package/dist/lexicons/types/com/atproto/admin/sendEmail.js +2 -0
  117. package/dist/lexicons/types/com/atproto/admin/updateAccountEmail.d.ts +31 -0
  118. package/dist/lexicons/types/com/atproto/admin/updateAccountEmail.js +2 -0
  119. package/dist/lexicons/types/com/atproto/admin/updateAccountHandle.d.ts +30 -0
  120. package/dist/lexicons/types/com/atproto/admin/updateAccountHandle.js +2 -0
  121. package/dist/lexicons/types/com/atproto/admin/updateAccountPassword.d.ts +30 -0
  122. package/dist/lexicons/types/com/atproto/admin/updateAccountPassword.js +2 -0
  123. package/dist/lexicons/types/com/atproto/admin/updateSubjectStatus.d.ts +51 -0
  124. package/dist/lexicons/types/com/atproto/admin/updateSubjectStatus.js +2 -0
  125. package/dist/lexicons/types/com/atproto/identity/defs.d.ts +14 -0
  126. package/dist/lexicons/types/com/atproto/identity/defs.js +14 -0
  127. package/dist/lexicons/types/com/atproto/identity/getRecommendedDidCredentials.d.ts +38 -0
  128. package/dist/lexicons/types/com/atproto/identity/getRecommendedDidCredentials.js +2 -0
  129. package/dist/lexicons/types/com/atproto/identity/refreshIdentity.d.ts +39 -0
  130. package/dist/lexicons/types/com/atproto/identity/refreshIdentity.js +2 -0
  131. package/dist/lexicons/types/com/atproto/identity/requestPlcOperationSignature.d.ts +23 -0
  132. package/dist/lexicons/types/com/atproto/identity/requestPlcOperationSignature.js +2 -0
  133. package/dist/lexicons/types/com/atproto/identity/resolveDid.d.ts +38 -0
  134. package/dist/lexicons/types/com/atproto/identity/resolveDid.js +2 -0
  135. package/dist/lexicons/types/com/atproto/identity/resolveHandle.d.ts +37 -0
  136. package/dist/lexicons/types/com/atproto/identity/resolveHandle.js +2 -0
  137. package/dist/lexicons/types/com/atproto/identity/resolveIdentity.d.ts +35 -0
  138. package/dist/lexicons/types/com/atproto/identity/resolveIdentity.js +2 -0
  139. package/dist/lexicons/types/com/atproto/identity/signPlcOperation.d.ts +46 -0
  140. package/dist/lexicons/types/com/atproto/identity/signPlcOperation.js +2 -0
  141. package/dist/lexicons/types/com/atproto/identity/submitPlcOperation.d.ts +29 -0
  142. package/dist/lexicons/types/com/atproto/identity/submitPlcOperation.js +2 -0
  143. package/dist/lexicons/types/com/atproto/identity/updateHandle.d.ts +30 -0
  144. package/dist/lexicons/types/com/atproto/identity/updateHandle.js +2 -0
  145. package/dist/lexicons/types/com/atproto/label/defs.d.ts +73 -0
  146. package/dist/lexicons/types/com/atproto/label/defs.js +54 -0
  147. package/dist/lexicons/types/com/atproto/label/queryLabels.d.ts +42 -0
  148. package/dist/lexicons/types/com/atproto/label/queryLabels.js +2 -0
  149. package/dist/lexicons/types/com/atproto/label/subscribeLabels.d.ts +38 -0
  150. package/dist/lexicons/types/com/atproto/label/subscribeLabels.js +24 -0
  151. package/dist/lexicons/types/com/atproto/lexicon/schema.d.ts +11 -0
  152. package/dist/lexicons/types/com/atproto/lexicon/schema.js +15 -0
  153. package/dist/lexicons/types/com/atproto/moderation/createReport.d.ts +57 -0
  154. package/dist/lexicons/types/com/atproto/moderation/createReport.js +2 -0
  155. package/dist/lexicons/types/com/atproto/moderation/defs.d.ts +20 -0
  156. package/dist/lexicons/types/com/atproto/moderation/defs.js +20 -0
  157. package/dist/lexicons/types/com/atproto/repo/applyWrites.d.ts +98 -0
  158. package/dist/lexicons/types/com/atproto/repo/applyWrites.js +64 -0
  159. package/dist/lexicons/types/com/atproto/repo/createRecord.d.ts +56 -0
  160. package/dist/lexicons/types/com/atproto/repo/createRecord.js +2 -0
  161. package/dist/lexicons/types/com/atproto/repo/defs.d.ts +11 -0
  162. package/dist/lexicons/types/com/atproto/repo/defs.js +14 -0
  163. package/dist/lexicons/types/com/atproto/repo/deleteRecord.d.ts +51 -0
  164. package/dist/lexicons/types/com/atproto/repo/deleteRecord.js +2 -0
  165. package/dist/lexicons/types/com/atproto/repo/describeRepo.d.ts +43 -0
  166. package/dist/lexicons/types/com/atproto/repo/describeRepo.js +2 -0
  167. package/dist/lexicons/types/com/atproto/repo/getRecord.d.ts +45 -0
  168. package/dist/lexicons/types/com/atproto/repo/getRecord.js +2 -0
  169. package/dist/lexicons/types/com/atproto/repo/importRepo.d.ts +27 -0
  170. package/dist/lexicons/types/com/atproto/repo/importRepo.js +2 -0
  171. package/dist/lexicons/types/com/atproto/repo/listMissingBlobs.d.ts +45 -0
  172. package/dist/lexicons/types/com/atproto/repo/listMissingBlobs.js +14 -0
  173. package/dist/lexicons/types/com/atproto/repo/listRecords.d.ts +53 -0
  174. package/dist/lexicons/types/com/atproto/repo/listRecords.js +14 -0
  175. package/dist/lexicons/types/com/atproto/repo/putRecord.d.ts +58 -0
  176. package/dist/lexicons/types/com/atproto/repo/putRecord.js +2 -0
  177. package/dist/lexicons/types/com/atproto/repo/strongRef.d.ts +11 -0
  178. package/dist/lexicons/types/com/atproto/repo/strongRef.js +15 -0
  179. package/dist/lexicons/types/com/atproto/repo/uploadBlob.d.ts +39 -0
  180. package/dist/lexicons/types/com/atproto/repo/uploadBlob.js +2 -0
  181. package/dist/lexicons/types/com/atproto/server/activateAccount.d.ts +23 -0
  182. package/dist/lexicons/types/com/atproto/server/activateAccount.js +2 -0
  183. package/dist/lexicons/types/com/atproto/server/checkAccountStatus.d.ts +42 -0
  184. package/dist/lexicons/types/com/atproto/server/checkAccountStatus.js +2 -0
  185. package/dist/lexicons/types/com/atproto/server/confirmEmail.d.ts +31 -0
  186. package/dist/lexicons/types/com/atproto/server/confirmEmail.js +2 -0
  187. package/dist/lexicons/types/com/atproto/server/createAccount.d.ts +61 -0
  188. package/dist/lexicons/types/com/atproto/server/createAccount.js +2 -0
  189. package/dist/lexicons/types/com/atproto/server/createAppPassword.d.ts +51 -0
  190. package/dist/lexicons/types/com/atproto/server/createAppPassword.js +14 -0
  191. package/dist/lexicons/types/com/atproto/server/createInviteCode.d.ts +41 -0
  192. package/dist/lexicons/types/com/atproto/server/createInviteCode.js +2 -0
  193. package/dist/lexicons/types/com/atproto/server/createInviteCodes.d.ts +50 -0
  194. package/dist/lexicons/types/com/atproto/server/createInviteCodes.js +14 -0
  195. package/dist/lexicons/types/com/atproto/server/createSession.d.ts +56 -0
  196. package/dist/lexicons/types/com/atproto/server/createSession.js +2 -0
  197. package/dist/lexicons/types/com/atproto/server/deactivateAccount.d.ts +30 -0
  198. package/dist/lexicons/types/com/atproto/server/deactivateAccount.js +2 -0
  199. package/dist/lexicons/types/com/atproto/server/defs.d.ts +23 -0
  200. package/dist/lexicons/types/com/atproto/server/defs.js +24 -0
  201. package/dist/lexicons/types/com/atproto/server/deleteAccount.d.ts +32 -0
  202. package/dist/lexicons/types/com/atproto/server/deleteAccount.js +2 -0
  203. package/dist/lexicons/types/com/atproto/server/deleteSession.d.ts +23 -0
  204. package/dist/lexicons/types/com/atproto/server/deleteSession.js +2 -0
  205. package/dist/lexicons/types/com/atproto/server/describeServer.d.ts +56 -0
  206. package/dist/lexicons/types/com/atproto/server/describeServer.js +24 -0
  207. package/dist/lexicons/types/com/atproto/server/getAccountInviteCodes.d.ts +39 -0
  208. package/dist/lexicons/types/com/atproto/server/getAccountInviteCodes.js +2 -0
  209. package/dist/lexicons/types/com/atproto/server/getServiceAuth.d.ts +41 -0
  210. package/dist/lexicons/types/com/atproto/server/getServiceAuth.js +2 -0
  211. package/dist/lexicons/types/com/atproto/server/getSession.d.ts +42 -0
  212. package/dist/lexicons/types/com/atproto/server/getSession.js +2 -0
  213. package/dist/lexicons/types/com/atproto/server/listAppPasswords.d.ts +44 -0
  214. package/dist/lexicons/types/com/atproto/server/listAppPasswords.js +14 -0
  215. package/dist/lexicons/types/com/atproto/server/refreshSession.d.ts +42 -0
  216. package/dist/lexicons/types/com/atproto/server/refreshSession.js +2 -0
  217. package/dist/lexicons/types/com/atproto/server/requestAccountDelete.d.ts +23 -0
  218. package/dist/lexicons/types/com/atproto/server/requestAccountDelete.js +2 -0
  219. package/dist/lexicons/types/com/atproto/server/requestEmailConfirmation.d.ts +23 -0
  220. package/dist/lexicons/types/com/atproto/server/requestEmailConfirmation.js +2 -0
  221. package/dist/lexicons/types/com/atproto/server/requestEmailUpdate.d.ts +34 -0
  222. package/dist/lexicons/types/com/atproto/server/requestEmailUpdate.js +2 -0
  223. package/dist/lexicons/types/com/atproto/server/requestPasswordReset.d.ts +29 -0
  224. package/dist/lexicons/types/com/atproto/server/requestPasswordReset.js +2 -0
  225. package/dist/lexicons/types/com/atproto/server/reserveSigningKey.d.ts +42 -0
  226. package/dist/lexicons/types/com/atproto/server/reserveSigningKey.js +2 -0
  227. package/dist/lexicons/types/com/atproto/server/resetPassword.d.ts +31 -0
  228. package/dist/lexicons/types/com/atproto/server/resetPassword.js +2 -0
  229. package/dist/lexicons/types/com/atproto/server/revokeAppPassword.d.ts +29 -0
  230. package/dist/lexicons/types/com/atproto/server/revokeAppPassword.js +2 -0
  231. package/dist/lexicons/types/com/atproto/server/updateEmail.d.ts +33 -0
  232. package/dist/lexicons/types/com/atproto/server/updateEmail.js +2 -0
  233. package/dist/lexicons/types/com/atproto/sync/getBlob.d.ts +36 -0
  234. package/dist/lexicons/types/com/atproto/sync/getBlob.js +2 -0
  235. package/dist/lexicons/types/com/atproto/sync/getBlocks.d.ts +35 -0
  236. package/dist/lexicons/types/com/atproto/sync/getBlocks.js +2 -0
  237. package/dist/lexicons/types/com/atproto/sync/getCheckout.d.ts +33 -0
  238. package/dist/lexicons/types/com/atproto/sync/getCheckout.js +2 -0
  239. package/dist/lexicons/types/com/atproto/sync/getHead.d.ts +37 -0
  240. package/dist/lexicons/types/com/atproto/sync/getHead.js +2 -0
  241. package/dist/lexicons/types/com/atproto/sync/getLatestCommit.d.ts +38 -0
  242. package/dist/lexicons/types/com/atproto/sync/getLatestCommit.js +2 -0
  243. package/dist/lexicons/types/com/atproto/sync/getRecord.d.ts +37 -0
  244. package/dist/lexicons/types/com/atproto/sync/getRecord.js +2 -0
  245. package/dist/lexicons/types/com/atproto/sync/getRepo.d.ts +36 -0
  246. package/dist/lexicons/types/com/atproto/sync/getRepo.js +2 -0
  247. package/dist/lexicons/types/com/atproto/sync/getRepoStatus.d.ts +42 -0
  248. package/dist/lexicons/types/com/atproto/sync/getRepoStatus.js +2 -0
  249. package/dist/lexicons/types/com/atproto/sync/listBlobs.d.ts +42 -0
  250. package/dist/lexicons/types/com/atproto/sync/listBlobs.js +2 -0
  251. package/dist/lexicons/types/com/atproto/sync/listRepos.d.ts +50 -0
  252. package/dist/lexicons/types/com/atproto/sync/listRepos.js +14 -0
  253. package/dist/lexicons/types/com/atproto/sync/listReposByCollection.d.ts +46 -0
  254. package/dist/lexicons/types/com/atproto/sync/listReposByCollection.js +14 -0
  255. package/dist/lexicons/types/com/atproto/sync/notifyOfUpdate.d.ts +30 -0
  256. package/dist/lexicons/types/com/atproto/sync/notifyOfUpdate.js +2 -0
  257. package/dist/lexicons/types/com/atproto/sync/requestCrawl.d.ts +30 -0
  258. package/dist/lexicons/types/com/atproto/sync/requestCrawl.js +2 -0
  259. package/dist/lexicons/types/com/atproto/sync/subscribeRepos.d.ts +111 -0
  260. package/dist/lexicons/types/com/atproto/sync/subscribeRepos.js +64 -0
  261. package/dist/lexicons/types/com/atproto/temp/addReservedHandle.d.ts +39 -0
  262. package/dist/lexicons/types/com/atproto/temp/addReservedHandle.js +2 -0
  263. package/dist/lexicons/types/com/atproto/temp/checkSignupQueue.d.ts +36 -0
  264. package/dist/lexicons/types/com/atproto/temp/checkSignupQueue.js +2 -0
  265. package/dist/lexicons/types/com/atproto/temp/fetchLabels.d.ts +37 -0
  266. package/dist/lexicons/types/com/atproto/temp/fetchLabels.js +2 -0
  267. package/dist/lexicons/types/com/atproto/temp/requestPhoneVerification.d.ts +29 -0
  268. package/dist/lexicons/types/com/atproto/temp/requestPhoneVerification.js +2 -0
  269. package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.d.ts +19 -0
  270. package/dist/lexicons/types/com/clioplaylists/alpha/actor/profile.js +15 -0
  271. package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.d.ts +32 -0
  272. package/dist/lexicons/types/com/clioplaylists/alpha/feed/defs.js +24 -0
  273. package/dist/lexicons/types/com/clioplaylists/alpha/feed/getSongs.d.ts +37 -0
  274. package/dist/lexicons/types/com/clioplaylists/alpha/feed/getSongs.js +2 -0
  275. package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.d.ts +32 -0
  276. package/dist/lexicons/types/com/clioplaylists/alpha/feed/playlistIdea.js +35 -0
  277. package/dist/lexicons/util.d.ts +5 -0
  278. package/dist/lexicons/util.js +13 -0
  279. package/dist/logger.d.ts +6 -0
  280. package/dist/logger.js +26 -0
  281. package/dist/rpc/clio_connect.d.ts +103 -0
  282. package/dist/rpc/clio_connect.js +110 -0
  283. package/dist/rpc/clio_pb.d.ts +457 -0
  284. package/dist/rpc/clio_pb.js +1365 -0
  285. package/dist/start.d.ts +1 -0
  286. package/dist/util/retry.d.ts +2 -0
  287. package/dist/util/retry.js +16 -0
  288. package/dist/util/uris.d.ts +1 -0
  289. package/dist/util/uris.js +7 -0
  290. package/dist/util.d.ts +23 -0
  291. package/dist/util.js +119 -0
  292. package/package.json +7 -7
  293. /package/{start.js → dist/start.js} +0 -0
@@ -0,0 +1,22 @@
1
+ import { AtUri } from '@atproto/syntax';
2
+ import { CID } from 'multiformats/cid';
3
+ import { Database } from '../db';
4
+ import { DatabaseSchema } from '../db/database-schema';
5
+ type RecordProcessorParams<T, S> = {
6
+ lexId: string;
7
+ insertFn: (db: DatabaseSchema, uri: AtUri, cid: CID, obj: T, timestamp: string) => Promise<S | null>;
8
+ findDuplicate: (db: DatabaseSchema, uri: AtUri, obj: T) => Promise<AtUri | null>;
9
+ deleteFn: (db: DatabaseSchema, uri: AtUri) => Promise<S | null>;
10
+ };
11
+ export declare class RecordProcessor<T, S> {
12
+ private params;
13
+ collection: string;
14
+ db: DatabaseSchema;
15
+ constructor(appDb: Database, params: RecordProcessorParams<T, S>);
16
+ matchesSchema(obj: unknown): obj is T;
17
+ assertValidRecord(obj: unknown): asserts obj is T;
18
+ insertRecord(uri: AtUri, cid: CID, obj: unknown, timestamp: string): Promise<void>;
19
+ updateRecord(uri: AtUri, cid: CID, obj: unknown, timestamp: string): Promise<void>;
20
+ deleteRecord(uri: AtUri, cascading?: boolean): Promise<void>;
21
+ }
22
+ export default RecordProcessor;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordProcessor = void 0;
4
+ const lexicon_1 = require("@atproto/lexicon");
5
+ const lexicons_1 = require("../../../lexicons/lexicons");
6
+ class RecordProcessor {
7
+ constructor(appDb, params) {
8
+ Object.defineProperty(this, "params", {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value: params
13
+ });
14
+ Object.defineProperty(this, "collection", {
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true,
18
+ value: void 0
19
+ });
20
+ Object.defineProperty(this, "db", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: void 0
25
+ });
26
+ this.db = appDb.db;
27
+ this.collection = this.params.lexId;
28
+ }
29
+ matchesSchema(obj) {
30
+ try {
31
+ this.assertValidRecord(obj);
32
+ return true;
33
+ }
34
+ catch {
35
+ return false;
36
+ }
37
+ }
38
+ assertValidRecord(obj) {
39
+ lexicons_1.lexicons.assertValidRecord(this.params.lexId, obj);
40
+ }
41
+ async insertRecord(uri, cid, obj, timestamp) {
42
+ this.assertValidRecord(obj);
43
+ await this.db
44
+ .insertInto('record')
45
+ .values({
46
+ uri: uri.toString(),
47
+ cid: cid.toString(),
48
+ did: uri.host,
49
+ json: (0, lexicon_1.stringifyLex)(obj),
50
+ indexed_at: timestamp,
51
+ })
52
+ .onConflict((oc) => oc.doNothing())
53
+ .execute();
54
+ await this.params.insertFn(this.db, uri, cid, obj, timestamp);
55
+ }
56
+ // Currently using a very simple strategy for updates: purge the existing index
57
+ // for the uri then replace it. The main upside is that this allows the indexer
58
+ // for each collection to avoid bespoke logic for in-place updates, which isn't
59
+ // straightforward in the general case. We still get nice control over notifications.
60
+ async updateRecord(uri, cid, obj, timestamp) {
61
+ this.assertValidRecord(obj);
62
+ await this.db
63
+ .updateTable('record')
64
+ .where('uri', '=', uri.toString())
65
+ .set({
66
+ cid: cid.toString(),
67
+ json: (0, lexicon_1.stringifyLex)(obj),
68
+ indexed_at: timestamp,
69
+ })
70
+ .execute();
71
+ const deleted = await this.params.deleteFn(this.db, uri);
72
+ if (!deleted) {
73
+ // If a record was updated but hadn't been indexed yet, treat it like a plain insert.
74
+ return this.insertRecord(uri, cid, obj, timestamp);
75
+ }
76
+ const inserted = await this.params.insertFn(this.db, uri, cid, obj, timestamp);
77
+ if (!inserted) {
78
+ throw new Error('Record update failed: removed from index but could not be replaced');
79
+ }
80
+ }
81
+ async deleteRecord(uri, cascading = false) {
82
+ await this.db
83
+ .deleteFrom('record')
84
+ .where('uri', '=', uri.toString())
85
+ .execute();
86
+ await this.params.deleteFn(this.db, uri);
87
+ }
88
+ }
89
+ exports.RecordProcessor = RecordProcessor;
90
+ exports.default = RecordProcessor;
@@ -0,0 +1,6 @@
1
+ import { IdResolver } from '@atproto/identity';
2
+ import { ServiceImpl } from '@connectrpc/connect';
3
+ import { ClioService } from '../../../rpc/clio_connect';
4
+ import { Database } from '../db';
5
+ declare const _default: (_db: Database, idResolver: IdResolver) => Partial<ServiceImpl<typeof ClioService>>;
6
+ export default _default;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const identity_1 = require("@atproto/identity");
4
+ const protobuf_1 = require("@bufbuild/protobuf");
5
+ const connect_1 = require("@connectrpc/connect");
6
+ exports.default = (_db, idResolver) => ({
7
+ async getIdentityByDid(req) {
8
+ const doc = await idResolver.did.resolve(req.did);
9
+ if (!doc) {
10
+ throw new connect_1.ConnectError('identity not found', connect_1.Code.NotFound);
11
+ }
12
+ return getResultFromDoc(doc);
13
+ },
14
+ async getIdentityByHandle(req) {
15
+ const did = await idResolver.handle.resolve(req.handle);
16
+ if (!did) {
17
+ throw new connect_1.ConnectError('identity not found', connect_1.Code.NotFound);
18
+ }
19
+ const doc = await idResolver.did.resolve(did);
20
+ if (!doc || did !== (0, identity_1.getDid)(doc)) {
21
+ throw new connect_1.ConnectError('identity not found', connect_1.Code.NotFound);
22
+ }
23
+ return getResultFromDoc(doc);
24
+ },
25
+ });
26
+ const getResultFromDoc = (doc) => {
27
+ const keys = {};
28
+ doc.verificationMethod?.forEach((method) => {
29
+ const id = method.id.split('#').at(1);
30
+ if (!id)
31
+ return;
32
+ keys[id] = {
33
+ Type: method.type,
34
+ PublicKeyMultibase: method.publicKeyMultibase || '',
35
+ };
36
+ });
37
+ const services = {};
38
+ doc.service?.forEach((service) => {
39
+ const id = service.id.split('#').at(1);
40
+ if (!id)
41
+ return;
42
+ if (typeof service.serviceEndpoint !== 'string')
43
+ return;
44
+ services[id] = {
45
+ Type: service.type,
46
+ URL: service.serviceEndpoint,
47
+ };
48
+ });
49
+ return {
50
+ did: (0, identity_1.getDid)(doc),
51
+ handle: (0, identity_1.getHandle)(doc),
52
+ keys: Buffer.from(JSON.stringify(keys)),
53
+ services: Buffer.from(JSON.stringify(services)),
54
+ updated: protobuf_1.Timestamp.fromDate(new Date()),
55
+ };
56
+ };
@@ -0,0 +1,5 @@
1
+ import { IdResolver } from '@atproto/identity';
2
+ import { ConnectRouter } from '@connectrpc/connect';
3
+ import { Database } from '../db';
4
+ declare const _default: (db: Database, idResolver: IdResolver) => (router: ConnectRouter) => ConnectRouter;
5
+ export default _default;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const clio_connect_1 = require("../../../rpc/clio_connect");
7
+ const identity_1 = __importDefault(require("./identity"));
8
+ const profile_1 = __importDefault(require("./profile"));
9
+ const records_1 = __importDefault(require("./records"));
10
+ const sync_1 = __importDefault(require("./sync"));
11
+ exports.default = (db, idResolver) => (router) => router.service(clio_connect_1.ClioService, {
12
+ ...(0, identity_1.default)(db, idResolver),
13
+ ...(0, profile_1.default)(db),
14
+ ...(0, records_1.default)(db),
15
+ ...(0, sync_1.default)(db),
16
+ async healthCheck() {
17
+ return {};
18
+ },
19
+ });
@@ -0,0 +1,5 @@
1
+ import { ServiceImpl } from '@connectrpc/connect';
2
+ import { ClioService } from '../../../rpc/clio_connect';
3
+ import { Database } from '../db';
4
+ declare const _default: (db: Database) => Partial<ServiceImpl<typeof ClioService>>;
5
+ export default _default;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const common_1 = require("@atproto/common");
4
+ const util_1 = require("../../../util");
5
+ const records_1 = require("./records");
6
+ exports.default = (db) => ({
7
+ async getActors(req) {
8
+ const { dids } = req;
9
+ if (dids.length === 0) {
10
+ return { actors: [] };
11
+ }
12
+ const profileUris = dids.map((did) => `at://${did}/app.bsky.actor.profile/self`);
13
+ const chatDeclarationUris = dids.map((did) => `at://${did}/chat.bsky.actor.declaration/self`);
14
+ const [handlesRes, profiles, chatDeclarations] = await Promise.all([
15
+ db.db.selectFrom('actor').selectAll().execute(),
16
+ (0, records_1.getRecords)(db)({ uris: profileUris }),
17
+ (0, records_1.getRecords)(db)({ uris: chatDeclarationUris }),
18
+ ]);
19
+ const byDid = (0, common_1.keyBy)(handlesRes, 'did');
20
+ const actors = dids.map((did, i) => {
21
+ const row = byDid.get(did);
22
+ const chatDeclaration = (0, util_1.parseRecordBytes)(chatDeclarations.records[i].record);
23
+ return {
24
+ exists: !!row,
25
+ handle: row?.handle ?? undefined,
26
+ profile: profiles.records[i],
27
+ takenDown: !!row?.takedownRef,
28
+ takedownRef: row?.takedownRef || undefined,
29
+ tombstonedAt: undefined, // in current implementation, tombstoned actors are deleted
30
+ allowIncomingChatsFrom: typeof chatDeclaration?.['allowIncoming'] === 'string'
31
+ ? chatDeclaration['allowIncoming']
32
+ : undefined,
33
+ upstreamStatus: row?.upstreamStatus ?? '',
34
+ createdAt: profiles.records[i].createdAt, // @NOTE profile creation date not trusted in production
35
+ };
36
+ });
37
+ return { actors };
38
+ },
39
+ async getDidsByHandles(req) {
40
+ const { handles } = req;
41
+ if (handles.length === 0) {
42
+ return { dids: [] };
43
+ }
44
+ const res = await db.db
45
+ .selectFrom('actor')
46
+ .where('handle', 'in', handles)
47
+ .selectAll()
48
+ .execute();
49
+ const byHandle = (0, common_1.keyBy)(res, 'handle');
50
+ const dids = handles.map((handle) => byHandle.get(handle)?.did ?? '');
51
+ return { dids };
52
+ },
53
+ async updateActorUpstreamStatus(req) {
54
+ const { actorDid, upstreamStatus } = req;
55
+ await db.db
56
+ .updateTable('actor')
57
+ .set({ upstreamStatus })
58
+ .where('did', '=', actorDid)
59
+ .execute();
60
+ },
61
+ });
@@ -0,0 +1,11 @@
1
+ import { ServiceImpl } from '@connectrpc/connect';
2
+ import { ClioService } from '../../../rpc/clio_connect';
3
+ import { Record } from '../../../rpc/clio_pb';
4
+ import { Database } from '../db';
5
+ declare const _default: (db: Database) => Partial<ServiceImpl<typeof ClioService>>;
6
+ export default _default;
7
+ export declare const getRecords: (db: Database, collection?: string) => (req: {
8
+ uris: string[];
9
+ }) => Promise<{
10
+ records: Record[];
11
+ }>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getRecords = void 0;
37
+ const common_1 = require("@atproto/common");
38
+ const syntax_1 = require("@atproto/syntax");
39
+ const protobuf_1 = require("@bufbuild/protobuf");
40
+ const ui8 = __importStar(require("uint8arrays"));
41
+ const lexicons_1 = require("../../../lexicons/lexicons");
42
+ const clio_pb_1 = require("../../../rpc/clio_pb");
43
+ exports.default = (db) => ({
44
+ getProfileRecords: (0, exports.getRecords)(db, lexicons_1.ids.ComClioplaylistsAlphaActorProfile),
45
+ });
46
+ const getRecords = (db, collection) => async (req) => {
47
+ const validUris = collection
48
+ ? req.uris.filter((uri) => new syntax_1.AtUri(uri).collection === collection)
49
+ : req.uris;
50
+ const res = validUris.length
51
+ ? await db.db
52
+ .selectFrom('record')
53
+ .selectAll()
54
+ .where('uri', 'in', validUris)
55
+ .execute()
56
+ : [];
57
+ const byUri = (0, common_1.keyBy)(res, 'uri');
58
+ const records = req.uris.map((uri) => {
59
+ const row = byUri.get(uri);
60
+ const json = row ? row.json : JSON.stringify(null);
61
+ const createdAtRaw = new Date(JSON.parse(json)?.['createdAt']);
62
+ const createdAt = !isNaN(createdAtRaw.getTime())
63
+ ? protobuf_1.Timestamp.fromDate(createdAtRaw)
64
+ : undefined;
65
+ const indexedAt = row?.indexed_at
66
+ ? protobuf_1.Timestamp.fromDate(new Date(row?.indexed_at))
67
+ : undefined;
68
+ const recordBytes = ui8.fromString(json, 'utf8');
69
+ return new clio_pb_1.Record({
70
+ record: recordBytes,
71
+ cid: row?.cid,
72
+ createdAt,
73
+ indexedAt,
74
+ sortedAt: compositeTime(createdAt, indexedAt),
75
+ takenDown: !!row?.takedown_ref,
76
+ takedownRef: row?.takedown_ref ?? undefined,
77
+ });
78
+ });
79
+ return { records };
80
+ };
81
+ exports.getRecords = getRecords;
82
+ const compositeTime = (ts1, ts2) => {
83
+ if (!ts1)
84
+ return ts2;
85
+ if (!ts2)
86
+ return ts1;
87
+ return ts1.toDate() < ts2.toDate() ? ts1 : ts2;
88
+ };
@@ -0,0 +1,5 @@
1
+ import { ServiceImpl } from '@connectrpc/connect';
2
+ import { ClioService } from '../../../rpc/clio_connect';
3
+ import { Database } from '../db';
4
+ declare const _default: (db: Database) => Partial<ServiceImpl<typeof ClioService>>;
5
+ export default _default;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (db) => ({
4
+ async getLatestRev(req) {
5
+ const res = await db.db
6
+ .selectFrom('actor_sync')
7
+ .where('did', '=', req.actorDid)
8
+ .select('repoRev')
9
+ .executeTakeFirst();
10
+ return {
11
+ rev: res?.repoRev ?? undefined,
12
+ };
13
+ },
14
+ });
@@ -0,0 +1,25 @@
1
+ import { IdResolver } from '@atproto/identity';
2
+ import { Firehose, MemoryRunner } from '@atproto/sync';
3
+ import { BackgroundQueue } from './background';
4
+ import { Database } from './db';
5
+ import { IndexingService } from './indexing';
6
+ export declare class RepoSubscription {
7
+ opts: {
8
+ service: string;
9
+ db: Database;
10
+ idResolver: IdResolver;
11
+ };
12
+ firehose: Firehose;
13
+ runner: MemoryRunner;
14
+ background: BackgroundQueue;
15
+ indexingSvc: IndexingService;
16
+ constructor(opts: {
17
+ service: string;
18
+ db: Database;
19
+ idResolver: IdResolver;
20
+ });
21
+ start(): void;
22
+ restart(): Promise<void>;
23
+ processAll(): Promise<void>;
24
+ destroy(): Promise<void>;
25
+ }
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RepoSubscription = void 0;
4
+ const repo_1 = require("@atproto/repo");
5
+ const sync_1 = require("@atproto/sync");
6
+ const logger_1 = require("../../logger");
7
+ const background_1 = require("./background");
8
+ const indexing_1 = require("./indexing");
9
+ class RepoSubscription {
10
+ constructor(opts) {
11
+ Object.defineProperty(this, "opts", {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value: opts
16
+ });
17
+ Object.defineProperty(this, "firehose", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: void 0
22
+ });
23
+ Object.defineProperty(this, "runner", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: void 0
28
+ });
29
+ Object.defineProperty(this, "background", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: void 0
34
+ });
35
+ Object.defineProperty(this, "indexingSvc", {
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true,
39
+ value: void 0
40
+ });
41
+ const { service, db, idResolver } = opts;
42
+ this.background = new background_1.BackgroundQueue(db);
43
+ this.indexingSvc = new indexing_1.IndexingService(db, idResolver);
44
+ const { runner, firehose } = createFirehose({
45
+ idResolver,
46
+ service,
47
+ indexingSvc: this.indexingSvc,
48
+ });
49
+ this.runner = runner;
50
+ this.firehose = firehose;
51
+ }
52
+ start() {
53
+ this.firehose.start();
54
+ }
55
+ async restart() {
56
+ await this.destroy();
57
+ const { runner, firehose } = createFirehose({
58
+ idResolver: this.opts.idResolver,
59
+ service: this.opts.service,
60
+ indexingSvc: this.indexingSvc,
61
+ });
62
+ this.runner = runner;
63
+ this.firehose = firehose;
64
+ this.start();
65
+ }
66
+ async processAll() {
67
+ await this.runner.processAll();
68
+ await this.background.processAll();
69
+ }
70
+ async destroy() {
71
+ await this.firehose.destroy();
72
+ await this.runner.destroy();
73
+ await this.background.processAll();
74
+ }
75
+ }
76
+ exports.RepoSubscription = RepoSubscription;
77
+ const createFirehose = (opts) => {
78
+ const { idResolver, service, indexingSvc } = opts;
79
+ const runner = new sync_1.MemoryRunner({ startCursor: 0 });
80
+ const firehose = new sync_1.Firehose({
81
+ idResolver,
82
+ runner,
83
+ service,
84
+ unauthenticatedHandles: true, // indexing service handles these
85
+ unauthenticatedCommits: true, // @TODO there seems to be a very rare issue where the authenticator thinks a block is missing in deletion ops
86
+ onError: (err) => logger_1.subLogger.error({ err }, 'error in subscription'),
87
+ handleEvent: async (evt) => {
88
+ if (evt.event === 'identity') {
89
+ await indexingSvc.indexHandle(evt.did, evt.time, true);
90
+ }
91
+ else if (evt.event === 'account') {
92
+ if (evt.active === false && evt.status === 'deleted') {
93
+ await indexingSvc.deleteActor(evt.did);
94
+ }
95
+ else {
96
+ await indexingSvc.updateActorStatus(evt.did, evt.active, evt.status);
97
+ }
98
+ }
99
+ else {
100
+ const indexFn = evt.event === 'delete'
101
+ ? indexingSvc.deleteRecord(evt.uri)
102
+ : indexingSvc.indexRecord(evt.uri, evt.cid, evt.record, evt.event === 'create'
103
+ ? repo_1.WriteOpAction.Create
104
+ : repo_1.WriteOpAction.Update, evt.time);
105
+ await Promise.all([
106
+ indexFn,
107
+ indexingSvc.setCommitLastSeen(evt.did, evt.commit, evt.rev),
108
+ indexingSvc.indexHandle(evt.did, evt.time),
109
+ ]);
110
+ }
111
+ },
112
+ });
113
+ return { firehose, runner };
114
+ };
@@ -0,0 +1,2 @@
1
+ import { ErrorRequestHandler } from 'express';
2
+ export declare const handler: ErrorRequestHandler;
package/dist/error.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handler = void 0;
4
+ const xrpc_server_1 = require("@atproto/xrpc-server");
5
+ const logger_1 = require("./logger");
6
+ const handler = (err, _req, res, next) => {
7
+ logger_1.httpLogger.error(err, 'unexpected internal server error');
8
+ if (res.headersSent) {
9
+ return next(err);
10
+ }
11
+ const serverError = xrpc_server_1.XRPCError.fromError(err);
12
+ res.status(serverError.type).json(serverError.payload);
13
+ };
14
+ exports.handler = handler;
@@ -0,0 +1,20 @@
1
+ import express from 'express';
2
+ import { Server } from 'http';
3
+ import { ServerConfig } from './config';
4
+ import AppContext from './context';
5
+ export declare class ClioAppView {
6
+ ctx: AppContext;
7
+ app: express.Application;
8
+ server?: Server;
9
+ private terminator?;
10
+ constructor(opts: {
11
+ ctx: AppContext;
12
+ app: express.Application;
13
+ });
14
+ static create(opts: {
15
+ config: ServerConfig;
16
+ }): ClioAppView;
17
+ start(): Promise<Server>;
18
+ destroy(): Promise<void>;
19
+ }
20
+ export default ClioAppView;