@atproto/api 0.11.0-next โ†’ 0.11.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 (377) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +41 -58
  3. package/definitions/labels.json +3 -60
  4. package/dist/agent.d.ts +11 -5
  5. package/dist/bsky-agent.d.ts +5 -3
  6. package/dist/client/lexicons.d.ts +34 -3
  7. package/dist/client/types/app/bsky/actor/defs.d.ts +7 -7
  8. package/dist/client/types/app/bsky/feed/defs.d.ts +1 -0
  9. package/dist/client/types/app/bsky/graph/defs.d.ts +3 -0
  10. package/dist/client/types/com/atproto/label/defs.d.ts +2 -0
  11. package/dist/const.d.ts +1 -1
  12. package/dist/index.js +581 -204
  13. package/dist/index.js.map +3 -3
  14. package/dist/mocker.d.ts +2 -1
  15. package/dist/moderation/const/labels.d.ts +3 -3
  16. package/dist/moderation/decision.d.ts +2 -0
  17. package/dist/moderation/index.d.ts +1 -0
  18. package/dist/moderation/mutewords.d.ts +8 -0
  19. package/dist/moderation/subjects/feed-generator.d.ts +1 -1
  20. package/dist/moderation/subjects/user-list.d.ts +1 -1
  21. package/dist/moderation/types.d.ts +22 -6
  22. package/dist/moderation/util.d.ts +3 -3
  23. package/dist/types.d.ts +3 -4
  24. package/docs/moderation.md +204 -95
  25. package/package.json +9 -9
  26. package/scripts/code/labels.mjs +2 -2
  27. package/src/agent.ts +61 -16
  28. package/src/bsky-agent.ts +190 -71
  29. package/src/client/lexicons.ts +37 -5
  30. package/src/client/types/app/bsky/actor/defs.ts +11 -11
  31. package/src/client/types/app/bsky/feed/defs.ts +1 -0
  32. package/src/client/types/app/bsky/graph/defs.ts +3 -0
  33. package/src/client/types/com/atproto/label/defs.ts +4 -0
  34. package/src/const.ts +1 -1
  35. package/src/mocker.ts +4 -0
  36. package/src/moderation/const/labels.ts +9 -72
  37. package/src/moderation/decision.ts +82 -36
  38. package/src/moderation/index.ts +5 -24
  39. package/src/moderation/mutewords.ts +125 -0
  40. package/src/moderation/subjects/feed-generator.ts +18 -4
  41. package/src/moderation/subjects/notification.ts +7 -1
  42. package/src/moderation/subjects/post.ts +260 -1
  43. package/src/moderation/subjects/user-list.ts +38 -4
  44. package/src/moderation/types.ts +51 -12
  45. package/src/moderation/util.ts +33 -16
  46. package/src/types.ts +7 -3
  47. package/tests/agent.test.ts +71 -5
  48. package/tests/bsky-agent.test.ts +150 -217
  49. package/tests/moderation-behaviors.test.ts +5 -60
  50. package/tests/moderation-custom-labels.test.ts +46 -71
  51. package/tests/moderation-mutewords.test.ts +691 -0
  52. package/tests/moderation-prefs.test.ts +157 -92
  53. package/tests/moderation-quoteposts.test.ts +277 -0
  54. package/tests/moderation.test.ts +302 -38
  55. package/tests/util/moderation-behavior.ts +3 -1
  56. package/dist/client/types/app/bsky/actor/createScene.d.ts +0 -32
  57. package/dist/client/types/app/bsky/actor/ref.d.ts +0 -28
  58. package/dist/client/types/app/bsky/actor/search.d.ts +0 -22
  59. package/dist/client/types/app/bsky/actor/searchActor.d.ts +0 -22
  60. package/dist/client/types/app/bsky/actor/searchActorTypeahead.d.ts +0 -20
  61. package/dist/client/types/app/bsky/actor/searchTypeahead.d.ts +0 -20
  62. package/dist/client/types/app/bsky/actor/updateProfile.d.ts +0 -47
  63. package/dist/client/types/app/bsky/feed/bookmarkFeed.d.ts +0 -17
  64. package/dist/client/types/app/bsky/feed/feedViewPost.d.ts +0 -28
  65. package/dist/client/types/app/bsky/feed/getBookmarkedFeeds.d.ts +0 -21
  66. package/dist/client/types/app/bsky/feed/getSavedFeeds.d.ts +0 -21
  67. package/dist/client/types/app/bsky/feed/getVotes.d.ts +0 -36
  68. package/dist/client/types/app/bsky/feed/saveFeed.d.ts +0 -17
  69. package/dist/client/types/app/bsky/feed/setVote.d.ts +0 -25
  70. package/dist/client/types/app/bsky/feed/trend.d.ts +0 -9
  71. package/dist/client/types/app/bsky/feed/unbookmarkFeed.d.ts +0 -17
  72. package/dist/client/types/app/bsky/feed/unsaveFeed.d.ts +0 -17
  73. package/dist/client/types/app/bsky/feed/vote.d.ts +0 -10
  74. package/dist/client/types/app/bsky/graph/assertCreator.d.ts +0 -1
  75. package/dist/client/types/app/bsky/graph/assertMember.d.ts +0 -1
  76. package/dist/client/types/app/bsky/graph/assertion.d.ts +0 -10
  77. package/dist/client/types/app/bsky/graph/confirmation.d.ts +0 -11
  78. package/dist/client/types/app/bsky/graph/getAssertions.d.ts +0 -48
  79. package/dist/client/types/app/bsky/graph/getMembers.d.ts +0 -36
  80. package/dist/client/types/app/bsky/graph/getMemberships.d.ts +0 -36
  81. package/dist/client/types/app/bsky/graph/mute.d.ts +0 -17
  82. package/dist/client/types/app/bsky/graph/unmute.d.ts +0 -17
  83. package/dist/client/types/app/bsky/moderation/defs.d.ts +0 -41
  84. package/dist/client/types/app/bsky/moderation/getService.d.ts +0 -16
  85. package/dist/client/types/app/bsky/moderation/getServices.d.ts +0 -23
  86. package/dist/client/types/app/bsky/moderation/service.d.ts +0 -14
  87. package/dist/client/types/app/bsky/notification/getCount.d.ts +0 -17
  88. package/dist/client/types/app/bsky/notification/list.d.ts +0 -35
  89. package/dist/client/types/app/bsky/system/actorScene.d.ts +0 -1
  90. package/dist/client/types/app/bsky/system/actorUser.d.ts +0 -1
  91. package/dist/client/types/app/bsky/system/declRef.d.ts +0 -8
  92. package/dist/client/types/app/bsky/system/declaration.d.ts +0 -7
  93. package/dist/client/types/app/bsky/unspecced/applyLabels.d.ts +0 -18
  94. package/dist/client/types/app/bsky/unspecced/getPopular.d.ts +0 -22
  95. package/dist/client/types/app/bsky/unspecced/getTimelineSkeleton.d.ts +0 -24
  96. package/dist/client/types/com/atproto/account/create.d.ts +0 -41
  97. package/dist/client/types/com/atproto/account/createInviteCode.d.ts +0 -22
  98. package/dist/client/types/com/atproto/account/delete.d.ts +0 -25
  99. package/dist/client/types/com/atproto/account/get.d.ts +0 -12
  100. package/dist/client/types/com/atproto/account/requestDelete.d.ts +0 -13
  101. package/dist/client/types/com/atproto/account/requestPasswordReset.d.ts +0 -17
  102. package/dist/client/types/com/atproto/account/resetPassword.d.ts +0 -24
  103. package/dist/client/types/com/atproto/admin/blob.d.ts +0 -37
  104. package/dist/client/types/com/atproto/admin/createCommunicationTemplate.d.ts +0 -23
  105. package/dist/client/types/com/atproto/admin/deleteCommunicationTemplate.d.ts +0 -17
  106. package/dist/client/types/com/atproto/admin/emitModerationEvent.d.ts +0 -33
  107. package/dist/client/types/com/atproto/admin/getInviteCodeUsage.d.ts +0 -29
  108. package/dist/client/types/com/atproto/admin/getModerationAction.d.ts +0 -16
  109. package/dist/client/types/com/atproto/admin/getModerationActions.d.ts +0 -22
  110. package/dist/client/types/com/atproto/admin/getModerationEvent.d.ts +0 -16
  111. package/dist/client/types/com/atproto/admin/getModerationReport.d.ts +0 -16
  112. package/dist/client/types/com/atproto/admin/getModerationReports.d.ts +0 -28
  113. package/dist/client/types/com/atproto/admin/getRecord.d.ts +0 -20
  114. package/dist/client/types/com/atproto/admin/getRepo.d.ts +0 -19
  115. package/dist/client/types/com/atproto/admin/getSubjectState.d.ts +0 -26
  116. package/dist/client/types/com/atproto/admin/getUserAccountInfo.d.ts +0 -16
  117. package/dist/client/types/com/atproto/admin/listCommunicationTemplates.d.ts +0 -18
  118. package/dist/client/types/com/atproto/admin/moderationAction.d.ts +0 -60
  119. package/dist/client/types/com/atproto/admin/moderationReport.d.ts +0 -37
  120. package/dist/client/types/com/atproto/admin/queryModerationEvents.d.ts +0 -35
  121. package/dist/client/types/com/atproto/admin/queryModerationStatuses.d.ts +0 -37
  122. package/dist/client/types/com/atproto/admin/rebaseRepo.d.ts +0 -24
  123. package/dist/client/types/com/atproto/admin/record.d.ts +0 -43
  124. package/dist/client/types/com/atproto/admin/repo.d.ts +0 -45
  125. package/dist/client/types/com/atproto/admin/resolveModerationReports.d.ts +0 -22
  126. package/dist/client/types/com/atproto/admin/reverseModerationAction.d.ts +0 -22
  127. package/dist/client/types/com/atproto/admin/searchRepos.d.ts +0 -23
  128. package/dist/client/types/com/atproto/admin/takeModerationAction.d.ts +0 -34
  129. package/dist/client/types/com/atproto/admin/updateCommunicationTemplate.d.ts +0 -25
  130. package/dist/client/types/com/atproto/admin/updateSubjectState.d.ts +0 -32
  131. package/dist/client/types/com/atproto/blob/upload.d.ts +0 -19
  132. package/dist/client/types/com/atproto/handle/resolve.d.ts +0 -18
  133. package/dist/client/types/com/atproto/handle/update.d.ts +0 -17
  134. package/dist/client/types/com/atproto/repo/batchWrite.d.ts +0 -46
  135. package/dist/client/types/com/atproto/repo/describe.d.ts +0 -22
  136. package/dist/client/types/com/atproto/repo/rebaseRepo.d.ts +0 -24
  137. package/dist/client/types/com/atproto/repo/recordRef.d.ts +0 -8
  138. package/dist/client/types/com/atproto/repo/repoRef.d.ts +0 -7
  139. package/dist/client/types/com/atproto/repo/uploadRepo.d.ts +0 -19
  140. package/dist/client/types/com/atproto/report/create.d.ts +0 -39
  141. package/dist/client/types/com/atproto/report/reasonType.d.ts +0 -3
  142. package/dist/client/types/com/atproto/report/subject.d.ts +0 -23
  143. package/dist/client/types/com/atproto/server/getAccountsConfig.d.ts +0 -27
  144. package/dist/client/types/com/atproto/server/getUserInviteCodes.d.ts +0 -31
  145. package/dist/client/types/com/atproto/session/create.d.ts +0 -29
  146. package/dist/client/types/com/atproto/session/delete.d.ts +0 -13
  147. package/dist/client/types/com/atproto/session/get.d.ts +0 -18
  148. package/dist/client/types/com/atproto/session/refresh.d.ts +0 -24
  149. package/dist/client/types/com/atproto/sync/getCommitPath.d.ts +0 -20
  150. package/dist/client/types/com/atproto/sync/getCurrent.d.ts +0 -22
  151. package/dist/client/types/com/atproto/sync/getRoot.d.ts +0 -21
  152. package/dist/client/types/com/atproto/sync/importRepo.d.ts +0 -16
  153. package/dist/client/types/com/atproto/sync/subscribeAllRepos.d.ts +0 -9
  154. package/dist/client/types/com/atproto/sync/updateRepo.d.ts +0 -15
  155. package/dist/client/types/com/atproto/temp/importRepo.d.ts +0 -16
  156. package/dist/client/types/com/atproto/temp/pushBlob.d.ts +0 -15
  157. package/dist/client/types/com/atproto/temp/transferAccount.d.ts +0 -48
  158. package/dist/client/types/com/atproto/temp/upgradeRepoVersion.d.ts +0 -18
  159. package/dist/moderation/accumulator.d.ts +0 -16
  160. package/dist/moderation/const/label-groups.d.ts +0 -2
  161. package/dist/moderation/subjects/quoted-post.d.ts +0 -6
  162. package/dist/session.d.ts +0 -42
  163. package/dist/src/client/index.d.ts +0 -462
  164. package/dist/src/client/lexicons.d.ts +0 -2910
  165. package/dist/src/client/schemas.d.ts +0 -17
  166. package/dist/src/client/types/app/bsky/actor/createScene.d.ts +0 -32
  167. package/dist/src/client/types/app/bsky/actor/getProfile.d.ts +0 -36
  168. package/dist/src/client/types/app/bsky/actor/getSuggestions.d.ts +0 -36
  169. package/dist/src/client/types/app/bsky/actor/profile.d.ts +0 -15
  170. package/dist/src/client/types/app/bsky/actor/ref.d.ts +0 -14
  171. package/dist/src/client/types/app/bsky/actor/search.d.ts +0 -32
  172. package/dist/src/client/types/app/bsky/actor/searchTypeahead.d.ts +0 -28
  173. package/dist/src/client/types/app/bsky/actor/updateProfile.d.ts +0 -48
  174. package/dist/src/client/types/app/bsky/badge.d.ts +0 -22
  175. package/dist/src/client/types/app/bsky/badgeAccept.d.ts +0 -11
  176. package/dist/src/client/types/app/bsky/badgeOffer.d.ts +0 -11
  177. package/dist/src/client/types/app/bsky/declaration.d.ts +0 -6
  178. package/dist/src/client/types/app/bsky/embed/external.d.ts +0 -26
  179. package/dist/src/client/types/app/bsky/embed/images.d.ts +0 -23
  180. package/dist/src/client/types/app/bsky/feed/embed.d.ts +0 -36
  181. package/dist/src/client/types/app/bsky/feed/feedViewPost.d.ts +0 -26
  182. package/dist/src/client/types/app/bsky/feed/getAuthorFeed.d.ts +0 -22
  183. package/dist/src/client/types/app/bsky/feed/getPostThread.d.ts +0 -43
  184. package/dist/src/client/types/app/bsky/feed/getRepostedBy.d.ts +0 -35
  185. package/dist/src/client/types/app/bsky/feed/getTimeline.d.ts +0 -22
  186. package/dist/src/client/types/app/bsky/feed/getVotes.d.ts +0 -33
  187. package/dist/src/client/types/app/bsky/feed/mediaEmbed.d.ts +0 -18
  188. package/dist/src/client/types/app/bsky/feed/post.d.ts +0 -54
  189. package/dist/src/client/types/app/bsky/feed/repost.d.ts +0 -6
  190. package/dist/src/client/types/app/bsky/feed/setVote.d.ts +0 -25
  191. package/dist/src/client/types/app/bsky/feed/trend.d.ts +0 -6
  192. package/dist/src/client/types/app/bsky/feed/vote.d.ts +0 -7
  193. package/dist/src/client/types/app/bsky/follow.d.ts +0 -9
  194. package/dist/src/client/types/app/bsky/getAuthorFeed.d.ts +0 -56
  195. package/dist/src/client/types/app/bsky/getBadgeMembers.d.ts +0 -29
  196. package/dist/src/client/types/app/bsky/getHomeFeed.d.ts +0 -56
  197. package/dist/src/client/types/app/bsky/getLikedBy.d.ts +0 -29
  198. package/dist/src/client/types/app/bsky/getNotificationCount.d.ts +0 -16
  199. package/dist/src/client/types/app/bsky/getNotifications.d.ts +0 -33
  200. package/dist/src/client/types/app/bsky/getPostThread.d.ts +0 -55
  201. package/dist/src/client/types/app/bsky/getProfile.d.ts +0 -26
  202. package/dist/src/client/types/app/bsky/getRepostedBy.d.ts +0 -29
  203. package/dist/src/client/types/app/bsky/getTimeline.d.ts +0 -56
  204. package/dist/src/client/types/app/bsky/getUserFollowers.d.ts +0 -31
  205. package/dist/src/client/types/app/bsky/getUserFollows.d.ts +0 -31
  206. package/dist/src/client/types/app/bsky/getUsersSearch.d.ts +0 -26
  207. package/dist/src/client/types/app/bsky/getUsersTypeahead.d.ts +0 -22
  208. package/dist/src/client/types/app/bsky/graph/assertCreator.d.ts +0 -1
  209. package/dist/src/client/types/app/bsky/graph/assertMember.d.ts +0 -1
  210. package/dist/src/client/types/app/bsky/graph/assertion.d.ts +0 -7
  211. package/dist/src/client/types/app/bsky/graph/confirmation.d.ts +0 -8
  212. package/dist/src/client/types/app/bsky/graph/follow.d.ts +0 -6
  213. package/dist/src/client/types/app/bsky/graph/getAssertions.d.ts +0 -43
  214. package/dist/src/client/types/app/bsky/graph/getFollowers.d.ts +0 -34
  215. package/dist/src/client/types/app/bsky/graph/getFollows.d.ts +0 -33
  216. package/dist/src/client/types/app/bsky/graph/getMembers.d.ts +0 -33
  217. package/dist/src/client/types/app/bsky/graph/getMemberships.d.ts +0 -33
  218. package/dist/src/client/types/app/bsky/invite.d.ts +0 -10
  219. package/dist/src/client/types/app/bsky/inviteAccept.d.ts +0 -14
  220. package/dist/src/client/types/app/bsky/like.d.ts +0 -10
  221. package/dist/src/client/types/app/bsky/mediaEmbed.d.ts +0 -15
  222. package/dist/src/client/types/app/bsky/notification/getCount.d.ts +0 -17
  223. package/dist/src/client/types/app/bsky/notification/list.d.ts +0 -32
  224. package/dist/src/client/types/app/bsky/notification/updateSeen.d.ts +0 -17
  225. package/dist/src/client/types/app/bsky/post.d.ts +0 -23
  226. package/dist/src/client/types/app/bsky/postNotificationsSeen.d.ts +0 -20
  227. package/dist/src/client/types/app/bsky/profile.d.ts +0 -5
  228. package/dist/src/client/types/app/bsky/repost.d.ts +0 -10
  229. package/dist/src/client/types/app/bsky/system/actorScene.d.ts +0 -1
  230. package/dist/src/client/types/app/bsky/system/actorUser.d.ts +0 -1
  231. package/dist/src/client/types/app/bsky/system/declRef.d.ts +0 -5
  232. package/dist/src/client/types/app/bsky/system/declaration.d.ts +0 -4
  233. package/dist/src/client/types/app/bsky/updateProfile.d.ts +0 -23
  234. package/dist/src/client/types/com/atproto/account/create.d.ts +0 -41
  235. package/dist/src/client/types/com/atproto/account/createInviteCode.d.ts +0 -22
  236. package/dist/src/client/types/com/atproto/account/delete.d.ts +0 -13
  237. package/dist/src/client/types/com/atproto/account/get.d.ts +0 -12
  238. package/dist/src/client/types/com/atproto/account/requestPasswordReset.d.ts +0 -17
  239. package/dist/src/client/types/com/atproto/account/resetPassword.d.ts +0 -24
  240. package/dist/src/client/types/com/atproto/blob/upload.d.ts +0 -19
  241. package/dist/src/client/types/com/atproto/createAccount.d.ts +0 -40
  242. package/dist/src/client/types/com/atproto/createInviteCode.d.ts +0 -20
  243. package/dist/src/client/types/com/atproto/createSession.d.ts +0 -24
  244. package/dist/src/client/types/com/atproto/data/uploadFile.d.ts +0 -19
  245. package/dist/src/client/types/com/atproto/deleteAccount.d.ts +0 -20
  246. package/dist/src/client/types/com/atproto/deleteSession.d.ts +0 -17
  247. package/dist/src/client/types/com/atproto/getAccount.d.ts +0 -16
  248. package/dist/src/client/types/com/atproto/getAccountsConfig.d.ts +0 -17
  249. package/dist/src/client/types/com/atproto/getSession.d.ts +0 -17
  250. package/dist/src/client/types/com/atproto/handle/resolve.d.ts +0 -18
  251. package/dist/src/client/types/com/atproto/refreshSession.d.ts +0 -20
  252. package/dist/src/client/types/com/atproto/repo/batchWrite.d.ts +0 -39
  253. package/dist/src/client/types/com/atproto/repo/createRecord.d.ts +0 -26
  254. package/dist/src/client/types/com/atproto/repo/deleteRecord.d.ts +0 -19
  255. package/dist/src/client/types/com/atproto/repo/describe.d.ts +0 -22
  256. package/dist/src/client/types/com/atproto/repo/getRecord.d.ts +0 -23
  257. package/dist/src/client/types/com/atproto/repo/listRecords.d.ts +0 -30
  258. package/dist/src/client/types/com/atproto/repo/putRecord.d.ts +0 -27
  259. package/dist/src/client/types/com/atproto/repo/strongRef.d.ts +0 -5
  260. package/dist/src/client/types/com/atproto/repoBatchWrite.d.ts +0 -36
  261. package/dist/src/client/types/com/atproto/repoCreateRecord.d.ts +0 -24
  262. package/dist/src/client/types/com/atproto/repoDeleteRecord.d.ts +0 -18
  263. package/dist/src/client/types/com/atproto/repoDescribe.d.ts +0 -21
  264. package/dist/src/client/types/com/atproto/repoGetRecord.d.ts +0 -22
  265. package/dist/src/client/types/com/atproto/repoListRecords.d.ts +0 -27
  266. package/dist/src/client/types/com/atproto/repoPutRecord.d.ts +0 -25
  267. package/dist/src/client/types/com/atproto/requestAccountPasswordReset.d.ts +0 -19
  268. package/dist/src/client/types/com/atproto/resetAccountPassword.d.ts +0 -26
  269. package/dist/src/client/types/com/atproto/resolveHandle.d.ts +0 -17
  270. package/dist/src/client/types/com/atproto/resolveName.d.ts +0 -17
  271. package/dist/src/client/types/com/atproto/server/getAccountsConfig.d.ts +0 -24
  272. package/dist/src/client/types/com/atproto/session/create.d.ts +0 -26
  273. package/dist/src/client/types/com/atproto/session/delete.d.ts +0 -13
  274. package/dist/src/client/types/com/atproto/session/get.d.ts +0 -18
  275. package/dist/src/client/types/com/atproto/session/refresh.d.ts +0 -21
  276. package/dist/src/client/types/com/atproto/sync/getRepo.d.ts +0 -15
  277. package/dist/src/client/types/com/atproto/sync/getRoot.d.ts +0 -18
  278. package/dist/src/client/types/com/atproto/sync/updateRepo.d.ts +0 -15
  279. package/dist/src/client/types/com/atproto/syncGetRepo.d.ts +0 -15
  280. package/dist/src/client/types/com/atproto/syncGetRoot.d.ts +0 -17
  281. package/dist/src/client/types/com/atproto/syncUpdateRepo.d.ts +0 -15
  282. package/dist/src/index.d.ts +0 -4
  283. package/dist/src/schemas.d.ts +0 -19
  284. package/dist/src/session.d.ts +0 -42
  285. package/dist/src/types/app/bsky/acceptedBadge.d.ts +0 -10
  286. package/dist/src/types/app/bsky/badge.d.ts +0 -22
  287. package/dist/src/types/app/bsky/badgeAccept.d.ts +0 -11
  288. package/dist/src/types/app/bsky/badgeOffer.d.ts +0 -11
  289. package/dist/src/types/app/bsky/declaration.d.ts +0 -6
  290. package/dist/src/types/app/bsky/follow.d.ts +0 -9
  291. package/dist/src/types/app/bsky/getAuthorFeed.d.ts +0 -56
  292. package/dist/src/types/app/bsky/getBadgeMembers.d.ts +0 -29
  293. package/dist/src/types/app/bsky/getHomeFeed.d.ts +0 -56
  294. package/dist/src/types/app/bsky/getLikedBy.d.ts +0 -29
  295. package/dist/src/types/app/bsky/getNotificationCount.d.ts +0 -16
  296. package/dist/src/types/app/bsky/getNotifications.d.ts +0 -33
  297. package/dist/src/types/app/bsky/getPostThread.d.ts +0 -55
  298. package/dist/src/types/app/bsky/getProfile.d.ts +0 -42
  299. package/dist/src/types/app/bsky/getRepostedBy.d.ts +0 -29
  300. package/dist/src/types/app/bsky/getUserFollowers.d.ts +0 -31
  301. package/dist/src/types/app/bsky/getUserFollows.d.ts +0 -31
  302. package/dist/src/types/app/bsky/getUsersSearch.d.ts +0 -26
  303. package/dist/src/types/app/bsky/getUsersTypeahead.d.ts +0 -22
  304. package/dist/src/types/app/bsky/invite.d.ts +0 -10
  305. package/dist/src/types/app/bsky/inviteAccept.d.ts +0 -14
  306. package/dist/src/types/app/bsky/like.d.ts +0 -10
  307. package/dist/src/types/app/bsky/mediaEmbed.d.ts +0 -15
  308. package/dist/src/types/app/bsky/post.d.ts +0 -23
  309. package/dist/src/types/app/bsky/postNotificationsSeen.d.ts +0 -19
  310. package/dist/src/types/app/bsky/profile.d.ts +0 -11
  311. package/dist/src/types/app/bsky/repost.d.ts +0 -10
  312. package/dist/src/types/app/bsky/updateProfile.d.ts +0 -27
  313. package/dist/src/types/com/atproto/createAccount.d.ts +0 -39
  314. package/dist/src/types/com/atproto/createInviteCode.d.ts +0 -19
  315. package/dist/src/types/com/atproto/createSession.d.ts +0 -23
  316. package/dist/src/types/com/atproto/deleteAccount.d.ts +0 -19
  317. package/dist/src/types/com/atproto/deleteSession.d.ts +0 -16
  318. package/dist/src/types/com/atproto/getAccount.d.ts +0 -19
  319. package/dist/src/types/com/atproto/getAccountsConfig.d.ts +0 -17
  320. package/dist/src/types/com/atproto/getSession.d.ts +0 -17
  321. package/dist/src/types/com/atproto/refreshSession.d.ts +0 -19
  322. package/dist/src/types/com/atproto/repoBatchWrite.d.ts +0 -35
  323. package/dist/src/types/com/atproto/repoCreateRecord.d.ts +0 -23
  324. package/dist/src/types/com/atproto/repoDeleteRecord.d.ts +0 -15
  325. package/dist/src/types/com/atproto/repoDescribe.d.ts +0 -21
  326. package/dist/src/types/com/atproto/repoGetRecord.d.ts +0 -22
  327. package/dist/src/types/com/atproto/repoListRecords.d.ts +0 -27
  328. package/dist/src/types/com/atproto/repoPutRecord.d.ts +0 -24
  329. package/dist/src/types/com/atproto/requestAccountPasswordReset.d.ts +0 -18
  330. package/dist/src/types/com/atproto/resetAccountPassword.d.ts +0 -25
  331. package/dist/src/types/com/atproto/resolveName.d.ts +0 -17
  332. package/dist/src/types/com/atproto/syncGetRepo.d.ts +0 -15
  333. package/dist/src/types/com/atproto/syncGetRoot.d.ts +0 -17
  334. package/dist/src/types/com/atproto/syncUpdateRepo.d.ts +0 -14
  335. package/dist/src/types/todo/adx/createAccount.d.ts +0 -36
  336. package/dist/src/types/todo/adx/createInviteCode.d.ts +0 -19
  337. package/dist/src/types/todo/adx/createSession.d.ts +0 -22
  338. package/dist/src/types/todo/adx/deleteAccount.d.ts +0 -19
  339. package/dist/src/types/todo/adx/deleteSession.d.ts +0 -19
  340. package/dist/src/types/todo/adx/getAccount.d.ts +0 -19
  341. package/dist/src/types/todo/adx/getAccountsConfig.d.ts +0 -17
  342. package/dist/src/types/todo/adx/getSession.d.ts +0 -17
  343. package/dist/src/types/todo/adx/repoBatchWrite.d.ts +0 -34
  344. package/dist/src/types/todo/adx/repoCreateRecord.d.ts +0 -22
  345. package/dist/src/types/todo/adx/repoDeleteRecord.d.ts +0 -15
  346. package/dist/src/types/todo/adx/repoDescribe.d.ts +0 -21
  347. package/dist/src/types/todo/adx/repoGetRecord.d.ts +0 -20
  348. package/dist/src/types/todo/adx/repoListRecords.d.ts +0 -25
  349. package/dist/src/types/todo/adx/repoPutRecord.d.ts +0 -23
  350. package/dist/src/types/todo/adx/requestAccountPasswordReset.d.ts +0 -18
  351. package/dist/src/types/todo/adx/resetAccountPassword.d.ts +0 -25
  352. package/dist/src/types/todo/adx/resolveName.d.ts +0 -17
  353. package/dist/src/types/todo/adx/syncGetRepo.d.ts +0 -15
  354. package/dist/src/types/todo/adx/syncGetRoot.d.ts +0 -17
  355. package/dist/src/types/todo/adx/syncUpdateRepo.d.ts +0 -14
  356. package/dist/src/types/todo/social/badge.d.ts +0 -23
  357. package/dist/src/types/todo/social/follow.d.ts +0 -5
  358. package/dist/src/types/todo/social/getAuthorFeed.d.ts +0 -55
  359. package/dist/src/types/todo/social/getFeed.d.ts +0 -55
  360. package/dist/src/types/todo/social/getHomeFeed.d.ts +0 -55
  361. package/dist/src/types/todo/social/getLikedBy.d.ts +0 -26
  362. package/dist/src/types/todo/social/getNotificationCount.d.ts +0 -16
  363. package/dist/src/types/todo/social/getNotifications.d.ts +0 -31
  364. package/dist/src/types/todo/social/getPostThread.d.ts +0 -54
  365. package/dist/src/types/todo/social/getProfile.d.ts +0 -40
  366. package/dist/src/types/todo/social/getRepostedBy.d.ts +0 -26
  367. package/dist/src/types/todo/social/getUserFollowers.d.ts +0 -30
  368. package/dist/src/types/todo/social/getUserFollows.d.ts +0 -30
  369. package/dist/src/types/todo/social/like.d.ts +0 -5
  370. package/dist/src/types/todo/social/mediaEmbed.d.ts +0 -15
  371. package/dist/src/types/todo/social/post.d.ts +0 -18
  372. package/dist/src/types/todo/social/postNotificationsSeen.d.ts +0 -19
  373. package/dist/src/types/todo/social/profile.d.ts +0 -10
  374. package/dist/src/types/todo/social/repost.d.ts +0 -5
  375. package/docs/labels.md +0 -108
  376. package/scripts/docs/labels.mjs +0 -87
  377. package/scripts/generate-docs.mjs +0 -3
@@ -0,0 +1,691 @@
1
+ import { RichText, mock, moderatePost } from '../src/'
2
+
3
+ import { hasMutedWord } from '../src/moderation/mutewords'
4
+
5
+ describe(`hasMutedWord`, () => {
6
+ describe(`tags`, () => {
7
+ it(`match: outline tag`, () => {
8
+ const rt = new RichText({
9
+ text: `This is a post #inlineTag`,
10
+ })
11
+ rt.detectFacetsWithoutResolution()
12
+
13
+ const match = hasMutedWord({
14
+ mutedWords: [{ value: 'outlineTag', targets: ['tag'] }],
15
+ text: rt.text,
16
+ facets: rt.facets,
17
+ outlineTags: ['outlineTag'],
18
+ })
19
+
20
+ expect(match).toBe(true)
21
+ })
22
+
23
+ it(`match: inline tag`, () => {
24
+ const rt = new RichText({
25
+ text: `This is a post #inlineTag`,
26
+ })
27
+ rt.detectFacetsWithoutResolution()
28
+
29
+ const match = hasMutedWord({
30
+ mutedWords: [{ value: 'inlineTag', targets: ['tag'] }],
31
+ text: rt.text,
32
+ facets: rt.facets,
33
+ outlineTags: ['outlineTag'],
34
+ })
35
+
36
+ expect(match).toBe(true)
37
+ })
38
+
39
+ it(`match: content target matches inline tag`, () => {
40
+ const rt = new RichText({
41
+ text: `This is a post #inlineTag`,
42
+ })
43
+ rt.detectFacetsWithoutResolution()
44
+
45
+ const match = hasMutedWord({
46
+ mutedWords: [{ value: 'inlineTag', targets: ['content'] }],
47
+ text: rt.text,
48
+ facets: rt.facets,
49
+ outlineTags: ['outlineTag'],
50
+ })
51
+
52
+ expect(match).toBe(true)
53
+ })
54
+
55
+ it(`no match: only tag targets`, () => {
56
+ const rt = new RichText({
57
+ text: `This is a post`,
58
+ })
59
+ rt.detectFacetsWithoutResolution()
60
+
61
+ const match = hasMutedWord({
62
+ mutedWords: [{ value: 'inlineTag', targets: ['tag'] }],
63
+ text: rt.text,
64
+ facets: rt.facets,
65
+ outlineTags: [],
66
+ })
67
+
68
+ expect(match).toBe(false)
69
+ })
70
+ })
71
+
72
+ describe(`early exits`, () => {
73
+ it(`match: single character ๅธŒ`, () => {
74
+ /**
75
+ * @see https://bsky.app/profile/mukuuji.bsky.social/post/3klji4fvsdk2c
76
+ */
77
+ const rt = new RichText({
78
+ text: `ๆ”นๅ–„ๅธŒๆœ›ใงใ™`,
79
+ })
80
+ rt.detectFacetsWithoutResolution()
81
+
82
+ const match = hasMutedWord({
83
+ mutedWords: [{ value: 'ๅธŒ', targets: ['content'] }],
84
+ text: rt.text,
85
+ facets: rt.facets,
86
+ outlineTags: [],
87
+ })
88
+
89
+ expect(match).toBe(true)
90
+ })
91
+
92
+ it(`no match: long muted word, short post`, () => {
93
+ const rt = new RichText({
94
+ text: `hey`,
95
+ })
96
+ rt.detectFacetsWithoutResolution()
97
+
98
+ const match = hasMutedWord({
99
+ mutedWords: [{ value: 'politics', targets: ['content'] }],
100
+ text: rt.text,
101
+ facets: rt.facets,
102
+ outlineTags: [],
103
+ })
104
+
105
+ expect(match).toBe(false)
106
+ })
107
+
108
+ it(`match: exact text`, () => {
109
+ const rt = new RichText({
110
+ text: `javascript`,
111
+ })
112
+ rt.detectFacetsWithoutResolution()
113
+
114
+ const match = hasMutedWord({
115
+ mutedWords: [{ value: 'javascript', targets: ['content'] }],
116
+ text: rt.text,
117
+ facets: rt.facets,
118
+ outlineTags: [],
119
+ })
120
+
121
+ expect(match).toBe(true)
122
+ })
123
+ })
124
+
125
+ describe(`general content`, () => {
126
+ it(`match: word within post`, () => {
127
+ const rt = new RichText({
128
+ text: `This is a post about javascript`,
129
+ })
130
+ rt.detectFacetsWithoutResolution()
131
+
132
+ const match = hasMutedWord({
133
+ mutedWords: [{ value: 'javascript', targets: ['content'] }],
134
+ text: rt.text,
135
+ facets: rt.facets,
136
+ outlineTags: [],
137
+ })
138
+
139
+ expect(match).toBe(true)
140
+ })
141
+
142
+ it(`no match: partial word`, () => {
143
+ const rt = new RichText({
144
+ text: `Use your brain, Eric`,
145
+ })
146
+ rt.detectFacetsWithoutResolution()
147
+
148
+ const match = hasMutedWord({
149
+ mutedWords: [{ value: 'ai', targets: ['content'] }],
150
+ text: rt.text,
151
+ facets: rt.facets,
152
+ outlineTags: [],
153
+ })
154
+
155
+ expect(match).toBe(false)
156
+ })
157
+
158
+ it(`match: multiline`, () => {
159
+ const rt = new RichText({
160
+ text: `Use your\n\tbrain, Eric`,
161
+ })
162
+ rt.detectFacetsWithoutResolution()
163
+
164
+ const match = hasMutedWord({
165
+ mutedWords: [{ value: 'brain', targets: ['content'] }],
166
+ text: rt.text,
167
+ facets: rt.facets,
168
+ outlineTags: [],
169
+ })
170
+
171
+ expect(match).toBe(true)
172
+ })
173
+
174
+ it(`match: :)`, () => {
175
+ const rt = new RichText({
176
+ text: `So happy :)`,
177
+ })
178
+ rt.detectFacetsWithoutResolution()
179
+
180
+ const match = hasMutedWord({
181
+ mutedWords: [{ value: `:)`, targets: ['content'] }],
182
+ text: rt.text,
183
+ facets: rt.facets,
184
+ outlineTags: [],
185
+ })
186
+
187
+ expect(match).toBe(true)
188
+ })
189
+ })
190
+
191
+ describe(`punctuation semi-fuzzy`, () => {
192
+ describe(`yay!`, () => {
193
+ const rt = new RichText({
194
+ text: `We're federating, yay!`,
195
+ })
196
+ rt.detectFacetsWithoutResolution()
197
+
198
+ it(`match: yay!`, () => {
199
+ const match = hasMutedWord({
200
+ mutedWords: [{ value: 'yay!', targets: ['content'] }],
201
+ text: rt.text,
202
+ facets: rt.facets,
203
+ outlineTags: [],
204
+ })
205
+
206
+ expect(match).toBe(true)
207
+ })
208
+
209
+ it(`match: yay`, () => {
210
+ const match = hasMutedWord({
211
+ mutedWords: [{ value: 'yay', targets: ['content'] }],
212
+ text: rt.text,
213
+ facets: rt.facets,
214
+ outlineTags: [],
215
+ })
216
+
217
+ expect(match).toBe(true)
218
+ })
219
+ })
220
+
221
+ describe(`y!ppee!!`, () => {
222
+ const rt = new RichText({
223
+ text: `We're federating, y!ppee!!`,
224
+ })
225
+ rt.detectFacetsWithoutResolution()
226
+
227
+ it(`match: y!ppee`, () => {
228
+ const match = hasMutedWord({
229
+ mutedWords: [{ value: 'y!ppee', targets: ['content'] }],
230
+ text: rt.text,
231
+ facets: rt.facets,
232
+ outlineTags: [],
233
+ })
234
+
235
+ expect(match).toBe(true)
236
+ })
237
+
238
+ // single exclamation point, source has double
239
+ it(`no match: y!ppee!`, () => {
240
+ const match = hasMutedWord({
241
+ mutedWords: [{ value: 'y!ppee!', targets: ['content'] }],
242
+ text: rt.text,
243
+ facets: rt.facets,
244
+ outlineTags: [],
245
+ })
246
+
247
+ expect(match).toBe(true)
248
+ })
249
+ })
250
+
251
+ describe(`Why so S@assy?`, () => {
252
+ const rt = new RichText({
253
+ text: `Why so S@assy?`,
254
+ })
255
+ rt.detectFacetsWithoutResolution()
256
+
257
+ it(`match: S@assy`, () => {
258
+ const match = hasMutedWord({
259
+ mutedWords: [{ value: 'S@assy', targets: ['content'] }],
260
+ text: rt.text,
261
+ facets: rt.facets,
262
+ outlineTags: [],
263
+ })
264
+
265
+ expect(match).toBe(true)
266
+ })
267
+
268
+ it(`match: s@assy`, () => {
269
+ const match = hasMutedWord({
270
+ mutedWords: [{ value: 's@assy', targets: ['content'] }],
271
+ text: rt.text,
272
+ facets: rt.facets,
273
+ outlineTags: [],
274
+ })
275
+
276
+ expect(match).toBe(true)
277
+ })
278
+ })
279
+
280
+ describe(`New York Times`, () => {
281
+ const rt = new RichText({
282
+ text: `New York Times`,
283
+ })
284
+ rt.detectFacetsWithoutResolution()
285
+
286
+ // case insensitive
287
+ it(`match: new york times`, () => {
288
+ const match = hasMutedWord({
289
+ mutedWords: [{ value: 'new york times', targets: ['content'] }],
290
+ text: rt.text,
291
+ facets: rt.facets,
292
+ outlineTags: [],
293
+ })
294
+
295
+ expect(match).toBe(true)
296
+ })
297
+ })
298
+
299
+ describe(`!command`, () => {
300
+ const rt = new RichText({
301
+ text: `Idk maybe a bot !command`,
302
+ })
303
+ rt.detectFacetsWithoutResolution()
304
+
305
+ it(`match: !command`, () => {
306
+ const match = hasMutedWord({
307
+ mutedWords: [{ value: `!command`, targets: ['content'] }],
308
+ text: rt.text,
309
+ facets: rt.facets,
310
+ outlineTags: [],
311
+ })
312
+
313
+ expect(match).toBe(true)
314
+ })
315
+
316
+ it(`match: command`, () => {
317
+ const match = hasMutedWord({
318
+ mutedWords: [{ value: `command`, targets: ['content'] }],
319
+ text: rt.text,
320
+ facets: rt.facets,
321
+ outlineTags: [],
322
+ })
323
+
324
+ expect(match).toBe(true)
325
+ })
326
+
327
+ it(`no match: !command`, () => {
328
+ const rt = new RichText({
329
+ text: `Idk maybe a bot command`,
330
+ })
331
+ rt.detectFacetsWithoutResolution()
332
+
333
+ const match = hasMutedWord({
334
+ mutedWords: [{ value: `!command`, targets: ['content'] }],
335
+ text: rt.text,
336
+ facets: rt.facets,
337
+ outlineTags: [],
338
+ })
339
+
340
+ expect(match).toBe(false)
341
+ })
342
+ })
343
+
344
+ describe(`e/acc`, () => {
345
+ const rt = new RichText({
346
+ text: `I'm e/acc pilled`,
347
+ })
348
+ rt.detectFacetsWithoutResolution()
349
+
350
+ it(`match: e/acc`, () => {
351
+ const match = hasMutedWord({
352
+ mutedWords: [{ value: `e/acc`, targets: ['content'] }],
353
+ text: rt.text,
354
+ facets: rt.facets,
355
+ outlineTags: [],
356
+ })
357
+
358
+ expect(match).toBe(true)
359
+ })
360
+
361
+ it(`match: acc`, () => {
362
+ const match = hasMutedWord({
363
+ mutedWords: [{ value: `acc`, targets: ['content'] }],
364
+ text: rt.text,
365
+ facets: rt.facets,
366
+ outlineTags: [],
367
+ })
368
+
369
+ expect(match).toBe(true)
370
+ })
371
+ })
372
+
373
+ describe(`super-bad`, () => {
374
+ const rt = new RichText({
375
+ text: `I'm super-bad`,
376
+ })
377
+ rt.detectFacetsWithoutResolution()
378
+
379
+ it(`match: super-bad`, () => {
380
+ const match = hasMutedWord({
381
+ mutedWords: [{ value: `super-bad`, targets: ['content'] }],
382
+ text: rt.text,
383
+ facets: rt.facets,
384
+ outlineTags: [],
385
+ })
386
+
387
+ expect(match).toBe(true)
388
+ })
389
+
390
+ it(`match: super`, () => {
391
+ const match = hasMutedWord({
392
+ mutedWords: [{ value: `super`, targets: ['content'] }],
393
+ text: rt.text,
394
+ facets: rt.facets,
395
+ outlineTags: [],
396
+ })
397
+
398
+ expect(match).toBe(true)
399
+ })
400
+
401
+ it(`match: super bad`, () => {
402
+ const match = hasMutedWord({
403
+ mutedWords: [{ value: `super bad`, targets: ['content'] }],
404
+ text: rt.text,
405
+ facets: rt.facets,
406
+ outlineTags: [],
407
+ })
408
+
409
+ expect(match).toBe(true)
410
+ })
411
+
412
+ it(`match: superbad`, () => {
413
+ const match = hasMutedWord({
414
+ mutedWords: [{ value: `superbad`, targets: ['content'] }],
415
+ text: rt.text,
416
+ facets: rt.facets,
417
+ outlineTags: [],
418
+ })
419
+
420
+ expect(match).toBe(false)
421
+ })
422
+ })
423
+
424
+ describe(`idk_what_this_would_be`, () => {
425
+ const rt = new RichText({
426
+ text: `Weird post with idk_what_this_would_be`,
427
+ })
428
+ rt.detectFacetsWithoutResolution()
429
+
430
+ it(`match: idk what this would be`, () => {
431
+ const match = hasMutedWord({
432
+ mutedWords: [
433
+ { value: `idk what this would be`, targets: ['content'] },
434
+ ],
435
+ text: rt.text,
436
+ facets: rt.facets,
437
+ outlineTags: [],
438
+ })
439
+
440
+ expect(match).toBe(true)
441
+ })
442
+
443
+ it(`no match: idk what this would be for`, () => {
444
+ // extra word
445
+ const match = hasMutedWord({
446
+ mutedWords: [
447
+ { value: `idk what this would be for`, targets: ['content'] },
448
+ ],
449
+ text: rt.text,
450
+ facets: rt.facets,
451
+ outlineTags: [],
452
+ })
453
+
454
+ expect(match).toBe(false)
455
+ })
456
+
457
+ it(`match: idk`, () => {
458
+ // extra word
459
+ const match = hasMutedWord({
460
+ mutedWords: [{ value: `idk`, targets: ['content'] }],
461
+ text: rt.text,
462
+ facets: rt.facets,
463
+ outlineTags: [],
464
+ })
465
+
466
+ expect(match).toBe(true)
467
+ })
468
+
469
+ it(`match: idkwhatthiswouldbe`, () => {
470
+ const match = hasMutedWord({
471
+ mutedWords: [{ value: `idkwhatthiswouldbe`, targets: ['content'] }],
472
+ text: rt.text,
473
+ facets: rt.facets,
474
+ outlineTags: [],
475
+ })
476
+
477
+ expect(match).toBe(false)
478
+ })
479
+ })
480
+
481
+ describe(`parentheses`, () => {
482
+ const rt = new RichText({
483
+ text: `Post with context(iykyk)`,
484
+ })
485
+ rt.detectFacetsWithoutResolution()
486
+
487
+ it(`match: context(iykyk)`, () => {
488
+ const match = hasMutedWord({
489
+ mutedWords: [{ value: `context(iykyk)`, targets: ['content'] }],
490
+ text: rt.text,
491
+ facets: rt.facets,
492
+ outlineTags: [],
493
+ })
494
+
495
+ expect(match).toBe(true)
496
+ })
497
+
498
+ it(`match: context`, () => {
499
+ const match = hasMutedWord({
500
+ mutedWords: [{ value: `context`, targets: ['content'] }],
501
+ text: rt.text,
502
+ facets: rt.facets,
503
+ outlineTags: [],
504
+ })
505
+
506
+ expect(match).toBe(true)
507
+ })
508
+
509
+ it(`match: iykyk`, () => {
510
+ const match = hasMutedWord({
511
+ mutedWords: [{ value: `iykyk`, targets: ['content'] }],
512
+ text: rt.text,
513
+ facets: rt.facets,
514
+ outlineTags: [],
515
+ })
516
+
517
+ expect(match).toBe(true)
518
+ })
519
+
520
+ it(`match: (iykyk)`, () => {
521
+ const match = hasMutedWord({
522
+ mutedWords: [{ value: `(iykyk)`, targets: ['content'] }],
523
+ text: rt.text,
524
+ facets: rt.facets,
525
+ outlineTags: [],
526
+ })
527
+
528
+ expect(match).toBe(true)
529
+ })
530
+ })
531
+
532
+ describe(`๐Ÿฆ‹`, () => {
533
+ const rt = new RichText({
534
+ text: `Post with ๐Ÿฆ‹`,
535
+ })
536
+ rt.detectFacetsWithoutResolution()
537
+
538
+ it(`match: ๐Ÿฆ‹`, () => {
539
+ const match = hasMutedWord({
540
+ mutedWords: [{ value: `๐Ÿฆ‹`, targets: ['content'] }],
541
+ text: rt.text,
542
+ facets: rt.facets,
543
+ outlineTags: [],
544
+ })
545
+
546
+ expect(match).toBe(true)
547
+ })
548
+ })
549
+ })
550
+
551
+ describe(`phrases`, () => {
552
+ describe(`I like turtles, or how I learned to stop worrying and love the internet.`, () => {
553
+ const rt = new RichText({
554
+ text: `I like turtles, or how I learned to stop worrying and love the internet.`,
555
+ })
556
+ rt.detectFacetsWithoutResolution()
557
+
558
+ it(`match: stop worrying`, () => {
559
+ const match = hasMutedWord({
560
+ mutedWords: [{ value: 'stop worrying', targets: ['content'] }],
561
+ text: rt.text,
562
+ facets: rt.facets,
563
+ outlineTags: [],
564
+ })
565
+
566
+ expect(match).toBe(true)
567
+ })
568
+
569
+ it(`match: turtles, or how`, () => {
570
+ const match = hasMutedWord({
571
+ mutedWords: [{ value: 'turtles, or how', targets: ['content'] }],
572
+ text: rt.text,
573
+ facets: rt.facets,
574
+ outlineTags: [],
575
+ })
576
+
577
+ expect(match).toBe(true)
578
+ })
579
+ })
580
+ })
581
+
582
+ describe(`languages without spaces`, () => {
583
+ // I love turtles, or how I learned to stop worrying and love the internet
584
+ describe(`็งใฏใ‚ซใƒกใŒๅฅฝใใงใ™ใ€ใพใŸใฏใฉใฎใ‚ˆใ†ใซใ—ใฆๅฟƒ้…ใ™ใ‚‹ใฎใ‚’ใ‚„ใ‚ใฆใ‚คใƒณใ‚ฟใƒผใƒใƒƒใƒˆใ‚’ๆ„›ใ™ใ‚‹ใ‚ˆใ†ใซใชใฃใŸใฎใ‹`, () => {
585
+ const rt = new RichText({
586
+ text: `็งใฏใ‚ซใƒกใŒๅฅฝใใงใ™ใ€ใพใŸใฏใฉใฎใ‚ˆใ†ใซใ—ใฆๅฟƒ้…ใ™ใ‚‹ใฎใ‚’ใ‚„ใ‚ใฆใ‚คใƒณใ‚ฟใƒผใƒใƒƒใƒˆใ‚’ๆ„›ใ™ใ‚‹ใ‚ˆใ†ใซใชใฃใŸใฎใ‹`,
587
+ })
588
+ rt.detectFacetsWithoutResolution()
589
+
590
+ // internet
591
+ it(`match: ใ‚คใƒณใ‚ฟใƒผใƒใƒƒใƒˆ`, () => {
592
+ const match = hasMutedWord({
593
+ mutedWords: [{ value: 'ใ‚คใƒณใ‚ฟใƒผใƒใƒƒใƒˆ', targets: ['content'] }],
594
+ text: rt.text,
595
+ facets: rt.facets,
596
+ outlineTags: [],
597
+ languages: ['ja'],
598
+ })
599
+
600
+ expect(match).toBe(true)
601
+ })
602
+ })
603
+ })
604
+
605
+ describe(`doesn't mute own post`, () => {
606
+ it(`does mute if it isn't own post`, () => {
607
+ const res = moderatePost(
608
+ mock.postView({
609
+ record: mock.post({
610
+ text: 'Mute words!',
611
+ }),
612
+ author: mock.profileViewBasic({
613
+ handle: 'bob.test',
614
+ displayName: 'Bob',
615
+ }),
616
+ labels: [],
617
+ }),
618
+ {
619
+ userDid: 'did:web:alice.test',
620
+ prefs: {
621
+ adultContentEnabled: false,
622
+ labels: {},
623
+ labelers: [],
624
+ mutedWords: [{ value: 'words', targets: ['content'] }],
625
+ hiddenPosts: [],
626
+ },
627
+ labelDefs: {},
628
+ },
629
+ )
630
+ expect(res.causes[0].type).toBe('mute-word')
631
+ })
632
+
633
+ it(`doesn't mute own post when muted word is in text`, () => {
634
+ const res = moderatePost(
635
+ mock.postView({
636
+ record: mock.post({
637
+ text: 'Mute words!',
638
+ }),
639
+ author: mock.profileViewBasic({
640
+ handle: 'bob.test',
641
+ displayName: 'Bob',
642
+ }),
643
+ labels: [],
644
+ }),
645
+ {
646
+ userDid: 'did:web:bob.test',
647
+ prefs: {
648
+ adultContentEnabled: false,
649
+ labels: {},
650
+ labelers: [],
651
+ mutedWords: [{ value: 'words', targets: ['content'] }],
652
+ hiddenPosts: [],
653
+ },
654
+ labelDefs: {},
655
+ },
656
+ )
657
+ expect(res.causes.length).toBe(0)
658
+ })
659
+
660
+ it(`doesn't mute own post when muted word is in tags`, () => {
661
+ const rt = new RichText({
662
+ text: `Mute #words!`,
663
+ })
664
+ const res = moderatePost(
665
+ mock.postView({
666
+ record: mock.post({
667
+ text: rt.text,
668
+ facets: rt.facets,
669
+ }),
670
+ author: mock.profileViewBasic({
671
+ handle: 'bob.test',
672
+ displayName: 'Bob',
673
+ }),
674
+ labels: [],
675
+ }),
676
+ {
677
+ userDid: 'did:web:bob.test',
678
+ prefs: {
679
+ adultContentEnabled: false,
680
+ labels: {},
681
+ labelers: [],
682
+ mutedWords: [{ value: 'words', targets: ['tags'] }],
683
+ hiddenPosts: [],
684
+ },
685
+ labelDefs: {},
686
+ },
687
+ )
688
+ expect(res.causes.length).toBe(0)
689
+ })
690
+ })
691
+ })