@fedify/fedify 1.10.5 → 1.10.7

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 (281) hide show
  1. package/dist/{actor-CjkHF7Cj.cjs → actor-BGIAXtRd.cjs} +3112 -4674
  2. package/dist/{actor-Ch9BTg3N.js → actor-C-_2S5Mn.mjs} +8 -15
  3. package/dist/{actor-CQdxP8N-.js → actor-Cujbx4Zv.js} +1205 -2768
  4. package/dist/{actor-eeONG_sv.d.ts → actor-DXwwgFeR.d.ts} +3 -3
  5. package/dist/{actor-D190nbTD.d.cts → actor-DxvGbmjm.d.cts} +3 -3
  6. package/dist/{assert-MZs1qjMx.js → assert-DikXweDx.mjs} +5 -9
  7. package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
  8. package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
  9. package/dist/{assert_is_error-BPGph1Jx.js → assert_is_error-C50x8tnw.mjs} +5 -9
  10. package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
  11. package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-CJC9ThS-.mjs} +6 -11
  12. package/dist/{assert_throws-BOO88avQ.js → assert_throws-BIL7gChy.mjs} +6 -10
  13. package/dist/{authdocloader-fR-Fqcpa.js → authdocloader-1Sk2bqFx.mjs} +9 -14
  14. package/dist/{authdocloader-COFZT9Wh.js → authdocloader-D4Y6iyTF.js} +8 -15
  15. package/dist/{authdocloader-zc5ibOmU.cjs → authdocloader-DQfruCir.cjs} +14 -22
  16. package/dist/{builder-YD0q32nG.js → builder-CZbrDRl7.mjs} +31 -40
  17. package/dist/{client-B3mQJNO7.d.ts → client-D7t26_op.d.ts} +2 -2
  18. package/dist/{client-BgCucCG7.js → client-Dyb8MI3u.mjs} +11 -15
  19. package/dist/{client-n6L4GtQL.d.cts → client-yc0Z0P6Y.d.cts} +2 -2
  20. package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
  21. package/dist/compat/mod.cjs +5 -8
  22. package/dist/compat/mod.d.cts +78 -12
  23. package/dist/compat/mod.d.ts +78 -12
  24. package/dist/compat/mod.js +4 -8
  25. package/dist/compat/transformers.test.mjs +62 -0
  26. package/dist/{context-Cr5DIxq_.d.ts → context-C6n2yrj0.d.ts} +33 -26
  27. package/dist/{context-WJoO0SQs.d.cts → context-PfghnHYj.d.cts} +33 -26
  28. package/dist/{denokv-D0nfNQ1x.js → denokv-NJPMXyK0.mjs} +22 -11
  29. package/dist/{docloader-BucCRHZI.d.ts → docloader-D7k5A9JP.d.ts} +2 -7
  30. package/dist/{docloader-ChxNLZAA.d.cts → docloader-DbM94pGY.d.cts} +2 -7
  31. package/dist/{docloader-BETPdM09.js → docloader-Dtaju6oI.js} +18 -156
  32. package/dist/{docloader-irBWMSOZ.cjs → docloader-Q3DfzuUi.cjs} +116 -220
  33. package/dist/{esm-iGH0sRsE.js → esm-DOJg552-.mjs} +49 -85
  34. package/dist/federation/{builder.test.js → builder.test.mjs} +22 -41
  35. package/dist/federation/collection.test.d.mts +2 -0
  36. package/dist/federation/collection.test.mjs +21 -0
  37. package/dist/federation/handler.test.d.mts +2 -0
  38. package/dist/federation/{handler.test.js → handler.test.mjs} +29 -58
  39. package/dist/federation/idempotency.test.d.mts +2 -0
  40. package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +29 -59
  41. package/dist/federation/inbox.test.d.mts +2 -0
  42. package/dist/federation/{inbox.test.js → inbox.test.mjs} +10 -15
  43. package/dist/federation/keycache.test.d.mts +2 -0
  44. package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -18
  45. package/dist/federation/kv.test.d.mts +2 -0
  46. package/dist/federation/{kv.test.js → kv.test.mjs} +12 -26
  47. package/dist/federation/middleware.test.d.mts +2 -0
  48. package/dist/federation/{middleware.test.js → middleware.test.mjs} +182 -197
  49. package/dist/federation/mod.cjs +245 -21
  50. package/dist/federation/mod.d.cts +4 -13
  51. package/dist/federation/mod.d.ts +4 -13
  52. package/dist/federation/mod.js +240 -18
  53. package/dist/federation/mq.test.d.mts +2 -0
  54. package/dist/federation/{mq.test.js → mq.test.mjs} +23 -38
  55. package/dist/federation/retry.test.d.mts +2 -0
  56. package/dist/federation/{retry.test.js → retry.test.mjs} +9 -14
  57. package/dist/federation/router.test.d.mts +2 -0
  58. package/dist/federation/{router.test.js → router.test.mjs} +12 -19
  59. package/dist/federation/send.test.d.mts +2 -0
  60. package/dist/federation/{send.test.js → send.test.mjs} +24 -34
  61. package/dist/{http-PgdBoDIj.js → http-BRwSVBn1.mjs} +16 -32
  62. package/dist/{http-DS9z_HzB.d.ts → http-BYXQvoZQ.d.ts} +5 -9
  63. package/dist/{http-C_1RU1U_.d.cts → http-CMzg-A9P.d.cts} +5 -9
  64. package/dist/{http-CQAqR_vx.cjs → http-DCrun8ql.cjs} +51 -68
  65. package/dist/{http-CxiIW4rD.js → http-DRnRwr3i.js} +17 -33
  66. package/dist/{inbox-DcDIqTbR.js → inbox-pD1nbb_5.mjs} +17 -25
  67. package/dist/key-Cmbps6xt.cjs +4 -0
  68. package/dist/{key-dNFkodH5.cjs → key-DEYIxAFs.cjs} +42 -50
  69. package/dist/key-DMO0TgTa.mjs +5 -0
  70. package/dist/{key-I-ibyaZH.js → key-DdL5Oc59.mjs} +12 -18
  71. package/dist/{key-Cg0kO4dA.js → key-vIzWPiil.js} +19 -19
  72. package/dist/{keycache-hSs_XFSb.js → keycache-BVR9f06Y.mjs} +6 -10
  73. package/dist/{keys-CElJez9H.js → keys-Co-0pK8a.mjs} +6 -10
  74. package/dist/{kv-DipCBaw2.d.ts → kv-C6UC8M9S.d.ts} +1 -1
  75. package/dist/{kv-BqEOXcZv.d.cts → kv-ClC9WJh5.d.cts} +1 -1
  76. package/dist/{kv-QzKcOQgP.js → kv-OuT2IU64.mjs} +6 -10
  77. package/dist/{ld-b16r91YS.js → ld-BFaDk5gX.mjs} +17 -31
  78. package/dist/{lookup-CySNcNcC.js → lookup-CMYXdjVH.mjs} +8 -17
  79. package/dist/{lookup-Bfq9Jpm0.cjs → lookup-CZGJqSjm.cjs} +16 -23
  80. package/dist/{lookup-CiSAeWJl.js → lookup-jlmCTRsO.js} +5 -11
  81. package/dist/middleware-BWlZ-wms.cjs +4 -0
  82. package/dist/{middleware-C5emnCh-.js → middleware-BXD5WJbj.mjs} +276 -321
  83. package/dist/{middleware-Dxo56yae.cjs → middleware-BhMQrJXH.cjs} +494 -547
  84. package/dist/{middleware-Bs4xDuXR.js → middleware-CmA2E9Bu.js} +349 -393
  85. package/dist/middleware-H3Ce7yn3.mjs +5 -0
  86. package/dist/{mod-D5rfgGFE.d.cts → mod-BQ3lrlXU.d.cts} +3 -3
  87. package/dist/{mod-Dz5Y15Uy.d.cts → mod-C72agZIN.d.cts} +4 -4
  88. package/dist/{mod-CxMBb_dd.d.cts → mod-CDbqB60V.d.cts} +2 -2
  89. package/dist/{mod-DS4kJskR.d.ts → mod-Lj0W1nnG.d.ts} +3 -3
  90. package/dist/{mod-BZfdiPBo.d.ts → mod-_HNKaczF.d.ts} +4 -4
  91. package/dist/{mod-ChbckRnC.d.ts → mod-lHd-Zdd_.d.ts} +2 -2
  92. package/dist/mod.cjs +31 -33
  93. package/dist/mod.d.cts +15 -17
  94. package/dist/mod.d.ts +15 -17
  95. package/dist/mod.js +20 -23
  96. package/dist/{mq-B7R1Q-M5.d.cts → mq-CrItclRD.d.cts} +1 -1
  97. package/dist/{mq-CRGm1e_F.d.ts → mq-D_ZZRdby.d.ts} +1 -1
  98. package/dist/nodeinfo/client.test.d.mts +2 -0
  99. package/dist/nodeinfo/{client.test.js → client.test.mjs} +23 -45
  100. package/dist/nodeinfo/handler.test.d.mts +2 -0
  101. package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +14 -43
  102. package/dist/nodeinfo/mod.cjs +5 -9
  103. package/dist/nodeinfo/mod.d.cts +2 -5
  104. package/dist/nodeinfo/mod.d.ts +2 -5
  105. package/dist/nodeinfo/mod.js +4 -9
  106. package/dist/nodeinfo/semver.test.d.mts +2 -0
  107. package/dist/nodeinfo/{semver.test.js → semver.test.mjs} +28 -51
  108. package/dist/nodeinfo/types.test.d.mts +2 -0
  109. package/dist/nodeinfo/{types.test.js → types.test.mjs} +10 -21
  110. package/dist/otel/exporter.test.d.mts +2 -0
  111. package/dist/otel/{exporter.test.js → exporter.test.mjs} +122 -180
  112. package/dist/otel/mod.cjs +16 -22
  113. package/dist/otel/mod.d.cts +2 -2
  114. package/dist/otel/mod.d.ts +2 -2
  115. package/dist/otel/mod.js +9 -16
  116. package/dist/{otel-Chy5T2Xh.js → otel-0v4Zy01l.mjs} +5 -10
  117. package/dist/{owner-AcrG3Xz1.d.cts → owner-0yNTyGMb.d.cts} +4 -4
  118. package/dist/{owner-Bs-sPbHX.js → owner-CNdS8zxf.mjs} +11 -16
  119. package/dist/{owner-8NMhXwJd.d.ts → owner-CPEbNpnZ.d.ts} +4 -4
  120. package/dist/{proof-SgRikE_Y.js → proof-Co7YmDpv.mjs} +20 -32
  121. package/dist/{proof-flD2DeA-.js → proof-DHPbi_Mx.js} +34 -60
  122. package/dist/{proof-BvQS195q.cjs → proof-DcPdtve2.cjs} +115 -140
  123. package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
  124. package/dist/rolldown-runtime-C7fyD9f2.js +15 -0
  125. package/dist/runtime/authdocloader.test.d.mts +2 -0
  126. package/dist/runtime/{authdocloader.test.js → authdocloader.test.mjs} +16 -28
  127. package/dist/runtime/docloader.test.d.mts +2 -0
  128. package/dist/runtime/{docloader.test.js → docloader.test.mjs} +55 -77
  129. package/dist/runtime/key.test.d.mts +2 -0
  130. package/dist/runtime/{key.test.js → key.test.mjs} +27 -57
  131. package/dist/runtime/langstr.test.d.mts +2 -0
  132. package/dist/runtime/{langstr.test.js → langstr.test.mjs} +9 -19
  133. package/dist/runtime/link.test.d.mts +2 -0
  134. package/dist/runtime/{link.test.js → link.test.mjs} +7 -11
  135. package/dist/runtime/mod.cjs +7 -13
  136. package/dist/runtime/mod.d.cts +103 -6
  137. package/dist/runtime/mod.d.ts +103 -6
  138. package/dist/runtime/mod.js +6 -13
  139. package/dist/runtime/multibase/multibase.test.d.mts +2 -0
  140. package/dist/runtime/multibase/{multibase.test.js → multibase.test.mjs} +16 -33
  141. package/dist/runtime/url.test.d.mts +2 -0
  142. package/dist/runtime/{url.test.js → url.test.mjs} +10 -15
  143. package/dist/{semver-dArNLkR9.js → semver-CgD82xxg.mjs} +13 -28
  144. package/dist/{send-C0gFHa2i.js → send-BRCWNcMa.mjs} +7 -12
  145. package/dist/sig/http.test.d.mts +2 -0
  146. package/dist/sig/{http.test.js → http.test.mjs} +119 -203
  147. package/dist/sig/key.test.d.mts +2 -0
  148. package/dist/sig/{key.test.js → key.test.mjs} +13 -22
  149. package/dist/sig/ld.test.d.mts +2 -0
  150. package/dist/sig/{ld.test.js → ld.test.mjs} +24 -39
  151. package/dist/sig/mod.cjs +7 -13
  152. package/dist/sig/mod.d.cts +3 -7
  153. package/dist/sig/mod.d.ts +3 -7
  154. package/dist/sig/mod.js +6 -13
  155. package/dist/sig/owner.test.d.mts +2 -0
  156. package/dist/sig/{owner.test.js → owner.test.mjs} +23 -39
  157. package/dist/sig/proof.test.d.mts +2 -0
  158. package/dist/sig/{proof.test.js → proof.test.mjs} +18 -31
  159. package/dist/{std__assert-X-_kMxKM.js → std__assert-2v7gYiZp.mjs} +13 -24
  160. package/dist/testing/docloader.test.d.mts +2 -0
  161. package/dist/testing/docloader.test.mjs +12 -0
  162. package/dist/testing/{mod.d.ts → mod.d.mts} +371 -541
  163. package/dist/testing/mod.mjs +5 -0
  164. package/dist/{testing-C1GIraJh.js → testing-BLIh1cXz.mjs} +27 -35
  165. package/dist/{transformers-BFT6d7J5.js → transformers-BV4OeK9o.js} +3 -7
  166. package/dist/{transformers-CoBS-oFG.cjs → transformers-CLtJ5H8o.cjs} +20 -25
  167. package/dist/{types-BgUCCngg.cjs → types-B34v-m2N.cjs} +45 -64
  168. package/dist/{types-BIgY6c-l.js → types-CAnkAQGM.mjs} +5 -9
  169. package/dist/{types-Bu-epI-z.js → types-CXZk86AG.js} +18 -36
  170. package/dist/vocab/actor.test.d.mts +2 -0
  171. package/dist/vocab/{actor.test.js → actor.test.mjs} +308 -550
  172. package/dist/vocab/cjs.test.d.mts +2 -0
  173. package/dist/vocab/cjs.test.mjs +14 -0
  174. package/dist/vocab/lookup.test.d.mts +2 -0
  175. package/dist/vocab/{lookup.test.js → lookup.test.mjs} +34 -51
  176. package/dist/vocab/mod.cjs +256 -16
  177. package/dist/vocab/mod.d.cts +3 -5
  178. package/dist/vocab/mod.d.ts +3 -5
  179. package/dist/vocab/mod.js +249 -10
  180. package/dist/vocab/type.test.d.mts +2 -0
  181. package/dist/vocab/type.test.mjs +16 -0
  182. package/dist/vocab/vocab.test.d.mts +2 -0
  183. package/dist/vocab/{vocab.test.js → vocab.test.mjs} +178 -311
  184. package/dist/{vocab-BASuuzcJ.d.ts → vocab-DaT4UsJF.d.ts} +2 -2
  185. package/dist/{vocab-DPMmFPJ1.d.cts → vocab-DnlmNyXi.d.cts} +2 -2
  186. package/dist/{type-DUhon7qK.js → vocab-rT_94Pke.mjs} +1178 -2876
  187. package/dist/webfinger/handler.test.d.mts +2 -0
  188. package/dist/webfinger/{handler.test.js → handler.test.mjs} +23 -56
  189. package/dist/webfinger/lookup.test.d.mts +2 -0
  190. package/dist/webfinger/{lookup.test.js → lookup.test.mjs} +13 -27
  191. package/dist/webfinger/mod.cjs +5 -9
  192. package/dist/webfinger/mod.d.cts +1 -3
  193. package/dist/webfinger/mod.d.ts +1 -3
  194. package/dist/webfinger/mod.js +4 -9
  195. package/dist/x/cfworkers.cjs +25 -14
  196. package/dist/x/cfworkers.d.cts +33 -6
  197. package/dist/x/cfworkers.d.ts +33 -6
  198. package/dist/x/cfworkers.js +22 -12
  199. package/dist/x/cfworkers.test.d.mts +2 -0
  200. package/dist/x/{cfworkers.test.js → cfworkers.test.mjs} +28 -26
  201. package/dist/x/hono.cjs +25 -14
  202. package/dist/x/hono.d.cts +1 -11
  203. package/dist/x/hono.d.ts +1 -11
  204. package/dist/x/hono.js +22 -12
  205. package/dist/x/sveltekit.cjs +23 -12
  206. package/dist/x/sveltekit.d.cts +1 -11
  207. package/dist/x/sveltekit.d.ts +1 -11
  208. package/dist/x/sveltekit.js +20 -10
  209. package/package.json +2 -2
  210. package/dist/chunk-DqRYRqnO.cjs +0 -34
  211. package/dist/compat/transformers.test.d.ts +0 -3
  212. package/dist/compat/transformers.test.js +0 -86
  213. package/dist/compat-DmDDELst.cjs +0 -4
  214. package/dist/compat-nxUqe4Z-.js +0 -4
  215. package/dist/federation/builder.test.d.ts +0 -3
  216. package/dist/federation/collection.test.d.ts +0 -3
  217. package/dist/federation/collection.test.js +0 -35
  218. package/dist/federation/handler.test.d.ts +0 -3
  219. package/dist/federation/idempotency.test.d.ts +0 -3
  220. package/dist/federation/inbox.test.d.ts +0 -3
  221. package/dist/federation/keycache.test.d.ts +0 -3
  222. package/dist/federation/kv.test.d.ts +0 -3
  223. package/dist/federation/middleware.test.d.ts +0 -3
  224. package/dist/federation/mq.test.d.ts +0 -3
  225. package/dist/federation/retry.test.d.ts +0 -3
  226. package/dist/federation/router.test.d.ts +0 -3
  227. package/dist/federation/send.test.d.ts +0 -3
  228. package/dist/federation-C15gGOh1.cjs +0 -266
  229. package/dist/federation-K-xsO03l.js +0 -248
  230. package/dist/key-Bnod5wJl.js +0 -10
  231. package/dist/key-C6swTX71.js +0 -10
  232. package/dist/key-_Uq8gkmM.cjs +0 -10
  233. package/dist/middleware-BWsOtDIF.cjs +0 -17
  234. package/dist/middleware-Bm4bJzjg.js +0 -26
  235. package/dist/middleware-BvODpE_U.js +0 -17
  236. package/dist/mod-C2tOeRkN.d.cts +0 -1
  237. package/dist/mod-CD7gfdq3.d.ts +0 -104
  238. package/dist/mod-CnULG6Aa.d.ts +0 -82
  239. package/dist/mod-FZd39qVq.d.cts +0 -1
  240. package/dist/mod-JUhOKMHj.d.cts +0 -102
  241. package/dist/mod-OQfb33eH.d.cts +0 -80
  242. package/dist/nodeinfo/client.test.d.ts +0 -3
  243. package/dist/nodeinfo/handler.test.d.ts +0 -3
  244. package/dist/nodeinfo/semver.test.d.ts +0 -3
  245. package/dist/nodeinfo/types.test.d.ts +0 -3
  246. package/dist/nodeinfo-Co9lJrWl.cjs +0 -4
  247. package/dist/nodeinfo-DfycQ8Wf.js +0 -4
  248. package/dist/otel/exporter.test.d.ts +0 -3
  249. package/dist/runtime/authdocloader.test.d.ts +0 -3
  250. package/dist/runtime/docloader.test.d.ts +0 -3
  251. package/dist/runtime/key.test.d.ts +0 -3
  252. package/dist/runtime/langstr.test.d.ts +0 -3
  253. package/dist/runtime/link.test.d.ts +0 -3
  254. package/dist/runtime/multibase/multibase.test.d.ts +0 -3
  255. package/dist/runtime/url.test.d.ts +0 -3
  256. package/dist/runtime-C58AJWSv.cjs +0 -4
  257. package/dist/runtime-DPYEDf-o.js +0 -4
  258. package/dist/sig/http.test.d.ts +0 -3
  259. package/dist/sig/key.test.d.ts +0 -3
  260. package/dist/sig/ld.test.d.ts +0 -3
  261. package/dist/sig/owner.test.d.ts +0 -3
  262. package/dist/sig/proof.test.d.ts +0 -3
  263. package/dist/sig-ByHXzqUi.cjs +0 -4
  264. package/dist/sig-Cj3tk-ig.js +0 -4
  265. package/dist/testing/docloader.test.d.ts +0 -3
  266. package/dist/testing/docloader.test.js +0 -24
  267. package/dist/testing/mod.js +0 -10
  268. package/dist/vocab/actor.test.d.ts +0 -3
  269. package/dist/vocab/lookup.test.d.ts +0 -3
  270. package/dist/vocab/type.test.d.ts +0 -3
  271. package/dist/vocab/type.test.js +0 -25
  272. package/dist/vocab/vocab.test.d.ts +0 -3
  273. package/dist/vocab-5i6DEIi6.cjs +0 -294
  274. package/dist/vocab-CBavAdew.js +0 -258
  275. package/dist/webfinger/handler.test.d.ts +0 -3
  276. package/dist/webfinger/lookup.test.d.ts +0 -3
  277. package/dist/webfinger-BjOEdFPs.cjs +0 -4
  278. package/dist/webfinger-De_bU0iE.js +0 -4
  279. package/dist/x/cfworkers.test.d.ts +0 -3
  280. /package/dist/{mod-1pDWKvUL.d.ts → compat/transformers.test.d.mts} +0 -0
  281. /package/dist/{mod-g0xFzAP9.d.ts → federation/builder.test.d.mts} +0 -0
@@ -1,294 +0,0 @@
1
-
2
- const { Temporal } = require("@js-temporal/polyfill");
3
- const { URLPattern } = require("urlpattern-polyfill");
4
-
5
- const require_chunk = require('./chunk-DqRYRqnO.cjs');
6
- const require_docloader = require('./docloader-irBWMSOZ.cjs');
7
- const require_actor = require('./actor-CjkHF7Cj.cjs');
8
- const require_lookup = require('./lookup-Bfq9Jpm0.cjs');
9
- const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
10
- const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
11
- const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
12
-
13
- //#region src/vocab/handle.ts
14
- /**
15
- * Regular expression to match a fediverse handle in the format `@user@server`
16
- * or `user@server`. The `user` part can contain alphanumeric characters and
17
- * some special characters except `@`. The `server` part is all characters
18
- * after the `@` symbol in the middle.
19
- */
20
- const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]+)$/;
21
- /**
22
- * Parses a fediverse handle in the format `@user@server` or `user@server`.
23
- * The `user` part can contain alphanumeric characters and some special
24
- * characters except `@`. The `server` part is all characters after the `@`
25
- * symbol in the middle.
26
- *
27
- * @example
28
- * ```typescript
29
- * const handle = parseFediverseHandle("@username@example.com");
30
- * console.log(handle?.username); // "username"
31
- * console.log(handle?.host); // "example.com"
32
- * ```
33
- *
34
- * @param handle - The fediverse handle string to parse.
35
- * @returns A {@link FediverseHandle} object with `username` and `host`
36
- * if the input is valid; otherwise `null`.
37
- * @since 1.8.0
38
- */
39
- function parseFediverseHandle(handle) {
40
- const match = handleRegexp.exec(handle);
41
- if (match) return {
42
- username: match[1],
43
- host: match[2]
44
- };
45
- return null;
46
- }
47
- /**
48
- * Checks if a string is a valid fediverse handle in the format `@user@server`
49
- * or `user@server`. The `user` part can contain alphanumeric characters and
50
- * some special characters except `@`. The `server` part is all characters
51
- * after the `@` symbol in the middle.
52
- *
53
- * @example
54
- * ```typescript
55
- * console.log(isFediverseHandle("@username@example.com")); // true
56
- * console.log(isFediverseHandle("username@example.com")); // true
57
- * console.log(isFediverseHandle("@username@")); // false
58
- * ```
59
- *
60
- * @param handle - The string to test as a fediverse handle.
61
- * @returns `true` if the string matches the fediverse handle pattern;
62
- * otherwise `false`.
63
- * @since 1.8.0
64
- */
65
- function isFediverseHandle(handle) {
66
- return handleRegexp.test(handle);
67
- }
68
- /**
69
- * Converts a fediverse handle in the format `@user@server` or `user@server`
70
- * to an `acct:` URI, which is a URL-like identifier for ActivityPub actors.
71
- *
72
- * @example
73
- * ```typescript
74
- * const identifier = toAcctUrl("@username@example.com");
75
- * console.log(identifier?.href); // "acct:username@example.com"
76
- * ```
77
- *
78
- * @param handle - The fediverse handle string to convert.
79
- * @returns A `URL` object representing the `acct:` URI if conversion succeeds;
80
- * otherwise `null`.
81
- * @since 1.8.0
82
- */
83
- function toAcctUrl(handle) {
84
- const parsed = parseFediverseHandle(handle);
85
- if (!parsed) return null;
86
- const identifier = new URL(`acct:${parsed.username}@${parsed.host}`);
87
- return identifier;
88
- }
89
-
90
- //#endregion
91
- //#region src/vocab/lookup.ts
92
- const logger = (0, __logtape_logtape.getLogger)([
93
- "fedify",
94
- "vocab",
95
- "lookup"
96
- ]);
97
- /**
98
- * Looks up an ActivityStreams object by its URI (including `acct:` URIs)
99
- * or a fediverse handle (e.g., `@user@server` or `user@server`).
100
- *
101
- * @example
102
- * ``` typescript
103
- * // Look up an actor by its fediverse handle:
104
- * await lookupObject("@hongminhee@fosstodon.org");
105
- * // returning a `Person` object.
106
- *
107
- * // A fediverse handle can omit the leading '@':
108
- * await lookupObject("hongminhee@fosstodon.org");
109
- * // returning a `Person` object.
110
- *
111
- * // A `acct:` URI can be used as well:
112
- * await lookupObject("acct:hongminhee@fosstodon.org");
113
- * // returning a `Person` object.
114
- *
115
- * // Look up an object by its URI:
116
- * await lookupObject("https://todon.eu/@hongminhee/112060633798771581");
117
- * // returning a `Note` object.
118
- *
119
- * // It can be a `URL` object as well:
120
- * await lookupObject(new URL("https://todon.eu/@hongminhee/112060633798771581"));
121
- * // returning a `Note` object.
122
- * ```
123
- *
124
- * @param identifier The URI or fediverse handle to look up.
125
- * @param options Lookup options.
126
- * @returns The object, or `null` if not found.
127
- * @since 0.2.0
128
- */
129
- async function lookupObject(identifier, options = {}) {
130
- const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
131
- const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
132
- return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
133
- try {
134
- const result = await lookupObjectInternal(identifier, options);
135
- if (result == null) span.setStatus({ code: __opentelemetry_api.SpanStatusCode.ERROR });
136
- else {
137
- if (result.id != null) span.setAttribute("activitypub.object.id", result.id.href);
138
- span.setAttribute("activitypub.object.type", require_actor.getTypeId(result).href);
139
- if (result.replyTargetIds.length > 0) span.setAttribute("activitypub.object.in_reply_to", result.replyTargetIds.map((id) => id.href));
140
- span.addEvent("activitypub.object.fetched", {
141
- "activitypub.object.type": require_actor.getTypeId(result).href,
142
- "activitypub.object.json": JSON.stringify(await result.toJsonLd(options))
143
- });
144
- }
145
- return result;
146
- } catch (error) {
147
- span.recordException(error);
148
- span.setStatus({
149
- code: __opentelemetry_api.SpanStatusCode.ERROR,
150
- message: String(error)
151
- });
152
- throw error;
153
- } finally {
154
- span.end();
155
- }
156
- });
157
- }
158
- async function lookupObjectInternal(identifier, options = {}) {
159
- const documentLoader = options.documentLoader ?? require_docloader.getDocumentLoader({ userAgent: options.userAgent });
160
- if (typeof identifier === "string") identifier = toAcctUrl(identifier) ?? new URL(identifier);
161
- let remoteDoc = null;
162
- if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
163
- remoteDoc = await documentLoader(identifier.href, { signal: options.signal });
164
- } catch (error) {
165
- logger.debug("Failed to fetch remote document:\n{error}", { error });
166
- }
167
- if (remoteDoc == null) {
168
- const jrd = await require_lookup.lookupWebFinger(identifier, {
169
- userAgent: options.userAgent,
170
- tracerProvider: options.tracerProvider,
171
- allowPrivateAddress: "allowPrivateAddress" in options && options.allowPrivateAddress === true,
172
- signal: options.signal
173
- });
174
- if (jrd?.links == null) return null;
175
- for (const l of jrd.links) {
176
- if (l.type !== "application/activity+json" && !l.type?.match(/application\/ld\+json;\s*profile="https:\/\/www.w3.org\/ns\/activitystreams"/) || l.rel !== "self" || l.href == null) continue;
177
- try {
178
- remoteDoc = await documentLoader(l.href, { signal: options.signal });
179
- break;
180
- } catch (error) {
181
- logger.debug("Failed to fetch remote document:\n{error}", { error });
182
- continue;
183
- }
184
- }
185
- }
186
- if (remoteDoc == null) return null;
187
- let object;
188
- try {
189
- object = await require_actor.Object.fromJsonLd(remoteDoc.document, {
190
- documentLoader,
191
- contextLoader: options.contextLoader,
192
- tracerProvider: options.tracerProvider,
193
- baseUrl: new URL(remoteDoc.documentUrl)
194
- });
195
- } catch (error) {
196
- if (error instanceof TypeError) {
197
- logger.debug("Failed to parse JSON-LD document: {error}\n{document}", {
198
- ...remoteDoc,
199
- error
200
- });
201
- return null;
202
- }
203
- throw error;
204
- }
205
- if (options.crossOrigin !== "trust" && object.id != null && object.id.origin !== new URL(remoteDoc.documentUrl).origin) {
206
- if (options.crossOrigin === "throw") throw new Error(`The object's @id (${object.id.href}) has a different origin than the document URL (${remoteDoc.documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to "trust".`);
207
- logger.warn("The object's @id ({objectId}) has a different origin than the document URL ({documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
208
- ...remoteDoc,
209
- objectId: object.id.href
210
- });
211
- return null;
212
- }
213
- return object;
214
- }
215
- /**
216
- * Traverses a collection, yielding each item in the collection.
217
- * If the collection is paginated, it will fetch the next page
218
- * automatically.
219
- *
220
- * @example
221
- * ``` typescript
222
- * const collection = await lookupObject(collectionUrl);
223
- * if (collection instanceof Collection) {
224
- * for await (const item of traverseCollection(collection)) {
225
- * console.log(item.id?.href);
226
- * }
227
- * }
228
- * ```
229
- *
230
- * @param collection The collection to traverse.
231
- * @param options Options for traversing the collection.
232
- * @returns An async iterable of each item in the collection.
233
- * @since 1.1.0
234
- */
235
- async function* traverseCollection(collection, options = {}) {
236
- const interval = Temporal.Duration.from(options.interval ?? { seconds: 0 }).total("millisecond");
237
- let page = await collection.getFirst(options);
238
- if (page == null) for await (const item of collection.getItems(options)) yield item;
239
- else while (page != null) {
240
- for await (const item of page.getItems(options)) yield item;
241
- if (interval > 0) await (0, es_toolkit.delay)(interval);
242
- page = await page.getNext(options);
243
- }
244
- }
245
-
246
- //#endregion
247
- //#region src/vocab/constants.ts
248
- /**
249
- * The special public collection for [public addressing]. *Do not mutate this
250
- * object.*
251
- *
252
- * [public addressing]: https://www.w3.org/TR/activitypub/#public-addressing
253
- *
254
- * @since 0.7.0
255
- */
256
- const PUBLIC_COLLECTION = new URL("https://www.w3.org/ns/activitystreams#Public");
257
-
258
- //#endregion
259
- Object.defineProperty(exports, 'PUBLIC_COLLECTION', {
260
- enumerable: true,
261
- get: function () {
262
- return PUBLIC_COLLECTION;
263
- }
264
- });
265
- Object.defineProperty(exports, 'isFediverseHandle', {
266
- enumerable: true,
267
- get: function () {
268
- return isFediverseHandle;
269
- }
270
- });
271
- Object.defineProperty(exports, 'lookupObject', {
272
- enumerable: true,
273
- get: function () {
274
- return lookupObject;
275
- }
276
- });
277
- Object.defineProperty(exports, 'parseFediverseHandle', {
278
- enumerable: true,
279
- get: function () {
280
- return parseFediverseHandle;
281
- }
282
- });
283
- Object.defineProperty(exports, 'toAcctUrl', {
284
- enumerable: true,
285
- get: function () {
286
- return toAcctUrl;
287
- }
288
- });
289
- Object.defineProperty(exports, 'traverseCollection', {
290
- enumerable: true,
291
- get: function () {
292
- return traverseCollection;
293
- }
294
- });
@@ -1,258 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { deno_default, getDocumentLoader } from "./docloader-BETPdM09.js";
6
- import { Object as Object$1, getTypeId } from "./actor-CQdxP8N-.js";
7
- import { lookupWebFinger } from "./lookup-CiSAeWJl.js";
8
- import { getLogger } from "@logtape/logtape";
9
- import { SpanStatusCode, trace } from "@opentelemetry/api";
10
- import { delay } from "es-toolkit";
11
-
12
- //#region src/vocab/handle.ts
13
- /**
14
- * Regular expression to match a fediverse handle in the format `@user@server`
15
- * or `user@server`. The `user` part can contain alphanumeric characters and
16
- * some special characters except `@`. The `server` part is all characters
17
- * after the `@` symbol in the middle.
18
- */
19
- const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]+)$/;
20
- /**
21
- * Parses a fediverse handle in the format `@user@server` or `user@server`.
22
- * The `user` part can contain alphanumeric characters and some special
23
- * characters except `@`. The `server` part is all characters after the `@`
24
- * symbol in the middle.
25
- *
26
- * @example
27
- * ```typescript
28
- * const handle = parseFediverseHandle("@username@example.com");
29
- * console.log(handle?.username); // "username"
30
- * console.log(handle?.host); // "example.com"
31
- * ```
32
- *
33
- * @param handle - The fediverse handle string to parse.
34
- * @returns A {@link FediverseHandle} object with `username` and `host`
35
- * if the input is valid; otherwise `null`.
36
- * @since 1.8.0
37
- */
38
- function parseFediverseHandle(handle) {
39
- const match = handleRegexp.exec(handle);
40
- if (match) return {
41
- username: match[1],
42
- host: match[2]
43
- };
44
- return null;
45
- }
46
- /**
47
- * Checks if a string is a valid fediverse handle in the format `@user@server`
48
- * or `user@server`. The `user` part can contain alphanumeric characters and
49
- * some special characters except `@`. The `server` part is all characters
50
- * after the `@` symbol in the middle.
51
- *
52
- * @example
53
- * ```typescript
54
- * console.log(isFediverseHandle("@username@example.com")); // true
55
- * console.log(isFediverseHandle("username@example.com")); // true
56
- * console.log(isFediverseHandle("@username@")); // false
57
- * ```
58
- *
59
- * @param handle - The string to test as a fediverse handle.
60
- * @returns `true` if the string matches the fediverse handle pattern;
61
- * otherwise `false`.
62
- * @since 1.8.0
63
- */
64
- function isFediverseHandle(handle) {
65
- return handleRegexp.test(handle);
66
- }
67
- /**
68
- * Converts a fediverse handle in the format `@user@server` or `user@server`
69
- * to an `acct:` URI, which is a URL-like identifier for ActivityPub actors.
70
- *
71
- * @example
72
- * ```typescript
73
- * const identifier = toAcctUrl("@username@example.com");
74
- * console.log(identifier?.href); // "acct:username@example.com"
75
- * ```
76
- *
77
- * @param handle - The fediverse handle string to convert.
78
- * @returns A `URL` object representing the `acct:` URI if conversion succeeds;
79
- * otherwise `null`.
80
- * @since 1.8.0
81
- */
82
- function toAcctUrl(handle) {
83
- const parsed = parseFediverseHandle(handle);
84
- if (!parsed) return null;
85
- const identifier = new URL(`acct:${parsed.username}@${parsed.host}`);
86
- return identifier;
87
- }
88
-
89
- //#endregion
90
- //#region src/vocab/lookup.ts
91
- const logger = getLogger([
92
- "fedify",
93
- "vocab",
94
- "lookup"
95
- ]);
96
- /**
97
- * Looks up an ActivityStreams object by its URI (including `acct:` URIs)
98
- * or a fediverse handle (e.g., `@user@server` or `user@server`).
99
- *
100
- * @example
101
- * ``` typescript
102
- * // Look up an actor by its fediverse handle:
103
- * await lookupObject("@hongminhee@fosstodon.org");
104
- * // returning a `Person` object.
105
- *
106
- * // A fediverse handle can omit the leading '@':
107
- * await lookupObject("hongminhee@fosstodon.org");
108
- * // returning a `Person` object.
109
- *
110
- * // A `acct:` URI can be used as well:
111
- * await lookupObject("acct:hongminhee@fosstodon.org");
112
- * // returning a `Person` object.
113
- *
114
- * // Look up an object by its URI:
115
- * await lookupObject("https://todon.eu/@hongminhee/112060633798771581");
116
- * // returning a `Note` object.
117
- *
118
- * // It can be a `URL` object as well:
119
- * await lookupObject(new URL("https://todon.eu/@hongminhee/112060633798771581"));
120
- * // returning a `Note` object.
121
- * ```
122
- *
123
- * @param identifier The URI or fediverse handle to look up.
124
- * @param options Lookup options.
125
- * @returns The object, or `null` if not found.
126
- * @since 0.2.0
127
- */
128
- async function lookupObject(identifier, options = {}) {
129
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
130
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
131
- return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
132
- try {
133
- const result = await lookupObjectInternal(identifier, options);
134
- if (result == null) span.setStatus({ code: SpanStatusCode.ERROR });
135
- else {
136
- if (result.id != null) span.setAttribute("activitypub.object.id", result.id.href);
137
- span.setAttribute("activitypub.object.type", getTypeId(result).href);
138
- if (result.replyTargetIds.length > 0) span.setAttribute("activitypub.object.in_reply_to", result.replyTargetIds.map((id) => id.href));
139
- span.addEvent("activitypub.object.fetched", {
140
- "activitypub.object.type": getTypeId(result).href,
141
- "activitypub.object.json": JSON.stringify(await result.toJsonLd(options))
142
- });
143
- }
144
- return result;
145
- } catch (error) {
146
- span.recordException(error);
147
- span.setStatus({
148
- code: SpanStatusCode.ERROR,
149
- message: String(error)
150
- });
151
- throw error;
152
- } finally {
153
- span.end();
154
- }
155
- });
156
- }
157
- async function lookupObjectInternal(identifier, options = {}) {
158
- const documentLoader = options.documentLoader ?? getDocumentLoader({ userAgent: options.userAgent });
159
- if (typeof identifier === "string") identifier = toAcctUrl(identifier) ?? new URL(identifier);
160
- let remoteDoc = null;
161
- if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
162
- remoteDoc = await documentLoader(identifier.href, { signal: options.signal });
163
- } catch (error) {
164
- logger.debug("Failed to fetch remote document:\n{error}", { error });
165
- }
166
- if (remoteDoc == null) {
167
- const jrd = await lookupWebFinger(identifier, {
168
- userAgent: options.userAgent,
169
- tracerProvider: options.tracerProvider,
170
- allowPrivateAddress: "allowPrivateAddress" in options && options.allowPrivateAddress === true,
171
- signal: options.signal
172
- });
173
- if (jrd?.links == null) return null;
174
- for (const l of jrd.links) {
175
- if (l.type !== "application/activity+json" && !l.type?.match(/application\/ld\+json;\s*profile="https:\/\/www.w3.org\/ns\/activitystreams"/) || l.rel !== "self" || l.href == null) continue;
176
- try {
177
- remoteDoc = await documentLoader(l.href, { signal: options.signal });
178
- break;
179
- } catch (error) {
180
- logger.debug("Failed to fetch remote document:\n{error}", { error });
181
- continue;
182
- }
183
- }
184
- }
185
- if (remoteDoc == null) return null;
186
- let object;
187
- try {
188
- object = await Object$1.fromJsonLd(remoteDoc.document, {
189
- documentLoader,
190
- contextLoader: options.contextLoader,
191
- tracerProvider: options.tracerProvider,
192
- baseUrl: new URL(remoteDoc.documentUrl)
193
- });
194
- } catch (error) {
195
- if (error instanceof TypeError) {
196
- logger.debug("Failed to parse JSON-LD document: {error}\n{document}", {
197
- ...remoteDoc,
198
- error
199
- });
200
- return null;
201
- }
202
- throw error;
203
- }
204
- if (options.crossOrigin !== "trust" && object.id != null && object.id.origin !== new URL(remoteDoc.documentUrl).origin) {
205
- if (options.crossOrigin === "throw") throw new Error(`The object's @id (${object.id.href}) has a different origin than the document URL (${remoteDoc.documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to "trust".`);
206
- logger.warn("The object's @id ({objectId}) has a different origin than the document URL ({documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
207
- ...remoteDoc,
208
- objectId: object.id.href
209
- });
210
- return null;
211
- }
212
- return object;
213
- }
214
- /**
215
- * Traverses a collection, yielding each item in the collection.
216
- * If the collection is paginated, it will fetch the next page
217
- * automatically.
218
- *
219
- * @example
220
- * ``` typescript
221
- * const collection = await lookupObject(collectionUrl);
222
- * if (collection instanceof Collection) {
223
- * for await (const item of traverseCollection(collection)) {
224
- * console.log(item.id?.href);
225
- * }
226
- * }
227
- * ```
228
- *
229
- * @param collection The collection to traverse.
230
- * @param options Options for traversing the collection.
231
- * @returns An async iterable of each item in the collection.
232
- * @since 1.1.0
233
- */
234
- async function* traverseCollection(collection, options = {}) {
235
- const interval = Temporal.Duration.from(options.interval ?? { seconds: 0 }).total("millisecond");
236
- let page = await collection.getFirst(options);
237
- if (page == null) for await (const item of collection.getItems(options)) yield item;
238
- else while (page != null) {
239
- for await (const item of page.getItems(options)) yield item;
240
- if (interval > 0) await delay(interval);
241
- page = await page.getNext(options);
242
- }
243
- }
244
-
245
- //#endregion
246
- //#region src/vocab/constants.ts
247
- /**
248
- * The special public collection for [public addressing]. *Do not mutate this
249
- * object.*
250
- *
251
- * [public addressing]: https://www.w3.org/TR/activitypub/#public-addressing
252
- *
253
- * @since 0.7.0
254
- */
255
- const PUBLIC_COLLECTION = new URL("https://www.w3.org/ns/activitystreams#Public");
256
-
257
- //#endregion
258
- export { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection };
@@ -1,3 +0,0 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- globalThis.addEventListener = () => {};
@@ -1,3 +0,0 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- globalThis.addEventListener = () => {};
@@ -1,4 +0,0 @@
1
-
2
- const { Temporal } = require("@js-temporal/polyfill");
3
- const { URLPattern } = require("urlpattern-polyfill");
4
-
@@ -1,4 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
@@ -1,3 +0,0 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- globalThis.addEventListener = () => {};