@fedify/fedify 2.0.0-pr.490.2 → 2.0.0-pr.559.4

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 (267) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +64 -37
  3. package/dist/{builder-4syLV1-z.js → builder-DTlQwmVF.js} +10 -3
  4. package/dist/{client-BsGzbnV-.d.ts → client-CUTUGgvJ.d.ts} +18 -18
  5. package/dist/{client-pY7-3icS.js → client-Dg7OfUDA.js} +28 -23
  6. package/dist/{client-94iWEfQa.d.cts → client-by-PEGAJ.d.cts} +18 -18
  7. package/dist/compat/mod.cjs +1 -1
  8. package/dist/compat/mod.d.cts +6 -10
  9. package/dist/compat/mod.d.ts +6 -10
  10. package/dist/compat/mod.js +1 -1
  11. package/dist/compat/transformers.test.js +22 -21
  12. package/dist/{context-PxGADCsD.d.cts → context-B6X-7loD.d.cts} +206 -74
  13. package/dist/{context-V-XS2_6O.d.ts → context-CJaICYPw.d.ts} +206 -74
  14. package/dist/context-CZ5llAss.js +109 -0
  15. package/dist/deno-DGx1JZHr.js +124 -0
  16. package/dist/{testing-BslrM_9E.js → dist-B5f6a8Tt.js} +90 -110
  17. package/dist/{docloader-DndkGj0O.js → docloader-D8UHsyqD.js} +3 -3
  18. package/dist/{esm-VlKMJQqV.js → esm-DGl7uK1r.js} +1 -1
  19. package/dist/federation/builder.test.js +7 -5
  20. package/dist/federation/collection.test.js +2 -3
  21. package/dist/federation/handler.test.js +24 -23
  22. package/dist/federation/idempotency.test.js +59 -22
  23. package/dist/federation/inbox.test.js +4 -3
  24. package/dist/federation/keycache.test.js +4 -4
  25. package/dist/federation/kv.test.js +56 -3
  26. package/dist/federation/middleware.test.js +307 -93
  27. package/dist/federation/mod.cjs +9 -10
  28. package/dist/federation/mod.d.cts +7 -11
  29. package/dist/federation/mod.d.ts +7 -11
  30. package/dist/federation/mod.js +8 -11
  31. package/dist/federation/mq.test.js +167 -16
  32. package/dist/federation/negotiation.test.js +2 -3
  33. package/dist/federation/retry.test.js +2 -3
  34. package/dist/federation/router.test.js +2 -2
  35. package/dist/federation/send.test.js +93 -11
  36. package/dist/{webfinger/handler.test.js → federation/webfinger.test.js} +24 -22
  37. package/dist/{federation-CRpdnOMS.cjs → federation-CE0CJ_0G.cjs} +116 -10
  38. package/dist/{federation-jcR8-ZxP.js → federation-D6FVaeAR.js} +122 -16
  39. package/dist/{http-YhR_TMMQ.js → http-CL3G0rnf.js} +126 -9
  40. package/dist/{http-M8k5mKc0.d.cts → http-ClB3pLcL.d.cts} +1 -1
  41. package/dist/{http-Dxpqz4hE.cjs → http-DKBUv5zZ.cjs} +139 -16
  42. package/dist/{http-BbO0ejuk.d.ts → http-DLBDPal9.d.ts} +1 -1
  43. package/dist/{http-DH47B-h3.js → http-LGtYlSfN.js} +3 -2
  44. package/dist/{inbox-CEyHvxOo.js → inbox-DbtWQY2D.js} +2 -1
  45. package/dist/{key-x7E5PYI0.js → key-BCtt1Ugy.js} +3 -3
  46. package/dist/{keycache-BRXuBDuy.js → keycache-DRxpZ5r9.js} +1 -1
  47. package/dist/{keys-DLk_8H-l.js → keys-ZbcByPg9.js} +1 -1
  48. package/dist/{kv-Bxr0Q87_.d.cts → kv-B4vFhIYL.d.cts} +30 -1
  49. package/dist/{kv-BKNZ-Tb-.d.ts → kv-CYySNrsn.d.ts} +30 -1
  50. package/dist/{kv-CRZrzyXm.js → kv-QzKcOQgP.js} +22 -0
  51. package/dist/{kv-cache-HFnFIjSD.js → kv-cache-0786BfqY.js} +3 -3
  52. package/dist/{kv-cache-DN9pfMBe.js → kv-cache-B__dHl7g.js} +15 -2
  53. package/dist/{kv-cache-BMpfJFTx.cjs → kv-cache-DCJojeTn.cjs} +3 -3
  54. package/dist/{ld-CRPaU6c8.js → ld-QlZPwGEH.js} +4 -3
  55. package/dist/middleware-B3jUPnDa.js +12 -0
  56. package/dist/middleware-BFiwWMA2.cjs +12 -0
  57. package/dist/middleware-DMx6DyIw.js +26 -0
  58. package/dist/{middleware-DfLpMu7C.js → middleware-Dm58nObp.js} +280 -166
  59. package/dist/{middleware-BIqFwRwI.js → middleware-WokE4qxc.js} +245 -178
  60. package/dist/{middleware-Ck7O6mb0.cjs → middleware-hWyKOO_6.cjs} +332 -206
  61. package/dist/{mod-DMpuiKXi.d.cts → mod-BHXq4Q3x.d.cts} +7 -7
  62. package/dist/{mod-DgxG-byT.d.cts → mod-BrS8tiad.d.cts} +2 -2
  63. package/dist/mod-CoMP50Rf.d.ts +64 -0
  64. package/dist/{mod-BoRKfJPE.d.cts → mod-DScazwCW.d.cts} +4 -4
  65. package/dist/mod-DTzN6Pv3.d.cts +62 -0
  66. package/dist/{mod-aAE2wOWV.d.ts → mod-DZmuPaKv.d.ts} +7 -7
  67. package/dist/{mod-D5Z2tISD.d.ts → mod-jOa7W503.d.ts} +2 -2
  68. package/dist/{mod-Cdo6SYlJ.d.ts → mod-xKJ57rwu.d.ts} +4 -4
  69. package/dist/mod.cjs +12 -93
  70. package/dist/mod.d.cts +11 -15
  71. package/dist/mod.d.ts +11 -15
  72. package/dist/mod.js +11 -15
  73. package/dist/nodeinfo/client.test.js +3 -4
  74. package/dist/nodeinfo/handler.test.js +22 -21
  75. package/dist/nodeinfo/mod.cjs +2 -2
  76. package/dist/nodeinfo/mod.d.cts +2 -2
  77. package/dist/nodeinfo/mod.d.ts +2 -2
  78. package/dist/nodeinfo/mod.js +2 -2
  79. package/dist/nodeinfo/types.test.js +2 -3
  80. package/dist/otel/exporter.test.js +893 -0
  81. package/dist/otel/mod.cjs +256 -0
  82. package/dist/otel/mod.d.cts +230 -0
  83. package/dist/otel/mod.d.ts +232 -0
  84. package/dist/otel/mod.js +255 -0
  85. package/dist/{owner-kQRGVXG1.d.ts → owner-BgI8C-VY.d.ts} +1 -2
  86. package/dist/{owner-B4HbyP8s.d.cts → owner-C-zfmVAD.d.cts} +1 -2
  87. package/dist/{owner-CIWnopkT.js → owner-Cejm-F7S.js} +2 -2
  88. package/dist/{proof-D-5ri6rf.js → proof-BOQBHd-i.js} +3 -2
  89. package/dist/{proof-fEwcA7LA.cjs → proof-Bmi8ZIcW.cjs} +24 -25
  90. package/dist/{proof-C8-2l0zH.js → proof-CnaEQ_Ev.js} +4 -5
  91. package/dist/router-D9eI0s4b.js +118 -0
  92. package/dist/{send-CPGk9QKZ.js → send-jFxXfsN8.js} +38 -4
  93. package/dist/sig/http.test.js +6 -7
  94. package/dist/sig/key.test.js +5 -5
  95. package/dist/sig/ld.test.js +6 -6
  96. package/dist/sig/mod.cjs +3 -5
  97. package/dist/sig/mod.d.cts +3 -5
  98. package/dist/sig/mod.d.ts +3 -5
  99. package/dist/sig/mod.js +3 -5
  100. package/dist/sig/owner.test.js +6 -7
  101. package/dist/sig/proof.test.js +6 -6
  102. package/dist/testing/mod.d.ts +173 -7006
  103. package/dist/testing/mod.js +4 -3
  104. package/dist/{transformers-CoBS-oFG.cjs → transformers-BjBg6Lag.cjs} +2 -2
  105. package/dist/{transformers-BFT6d7J5.js → transformers-N_ip_y4P.js} +2 -2
  106. package/dist/{types-BtUjyi5y.js → types-8l28uC8o.js} +30 -25
  107. package/dist/{types-CWgzGaqk.cjs → types-B6z6CqIz.cjs} +30 -25
  108. package/dist/{types-C2XVl6gj.js → types-CPz01LGH.js} +3 -3
  109. package/dist/utils/docloader.test.js +7 -8
  110. package/dist/utils/kv-cache.test.js +5 -3
  111. package/dist/utils/mod.cjs +3 -5
  112. package/dist/utils/mod.d.cts +3 -4
  113. package/dist/utils/mod.d.ts +3 -4
  114. package/dist/utils/mod.js +3 -5
  115. package/dist/vocab/mod.cjs +8 -81
  116. package/dist/vocab/mod.d.cts +1 -4
  117. package/dist/vocab/mod.d.ts +1 -4
  118. package/dist/vocab/mod.js +1 -5
  119. package/package.json +27 -27
  120. package/dist/actor-BT-e5fn9.js +0 -146
  121. package/dist/actor-B_gRMloq.js +0 -41647
  122. package/dist/actor-CBfPjuWj.cjs +0 -42079
  123. package/dist/actor-DqFajh9s.d.ts +0 -130
  124. package/dist/actor-f2NtjyCg.d.cts +0 -128
  125. package/dist/fixtures/activitypub.academy/users/brauca_darradiul.json +0 -83
  126. package/dist/fixtures/example.com/announce.json +0 -6
  127. package/dist/fixtures/example.com/collection.json +0 -19
  128. package/dist/fixtures/example.com/create.json +0 -6
  129. package/dist/fixtures/example.com/cross-origin-actor.json +0 -6
  130. package/dist/fixtures/example.com/hong-gildong.json +0 -11
  131. package/dist/fixtures/example.com/invite.json +0 -7
  132. package/dist/fixtures/example.com/key.json +0 -7
  133. package/dist/fixtures/example.com/key2.json +0 -6
  134. package/dist/fixtures/example.com/object.json +0 -6
  135. package/dist/fixtures/example.com/orderedcollectionpage.json +0 -24
  136. package/dist/fixtures/example.com/paged/a.json +0 -13
  137. package/dist/fixtures/example.com/paged/b.json +0 -16
  138. package/dist/fixtures/example.com/paged-collection.json +0 -6
  139. package/dist/fixtures/example.com/person.json +0 -22
  140. package/dist/fixtures/example.com/person2.json +0 -40
  141. package/dist/fixtures/example.com/test.json +0 -5
  142. package/dist/fixtures/example.com/users/handle.json +0 -16
  143. package/dist/fixtures/example.com/wrong-type.json +0 -3
  144. package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +0 -6
  145. package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +0 -24
  146. package/dist/fixtures/remote.domain/users/bob.json +0 -20
  147. package/dist/fixtures/server.example/users/alice.json +0 -20
  148. package/dist/fixtures/w3id.org/identity/v1.json +0 -152
  149. package/dist/fixtures/w3id.org/security/data-integrity/v1.json +0 -74
  150. package/dist/fixtures/w3id.org/security/multikey/v1.json +0 -35
  151. package/dist/fixtures/w3id.org/security/v1.json +0 -50
  152. package/dist/fixtures/wizard.casa/users/hongminhee.json +0 -69
  153. package/dist/fixtures/www.w3.org/ns/activitystreams.json +0 -379
  154. package/dist/fixtures/www.w3.org/ns/did/v1.json +0 -58
  155. package/dist/lookup-BTqtVATt.cjs +0 -266
  156. package/dist/lookup-DOSnR912.js +0 -254
  157. package/dist/lookup-Dj9-mgOn.js +0 -42184
  158. package/dist/middleware-CxswDtQn.js +0 -15
  159. package/dist/middleware-CyITsnX0.js +0 -26
  160. package/dist/middleware-Z8lc_drL.cjs +0 -15
  161. package/dist/mod-BlVovdcy.d.ts +0 -309
  162. package/dist/mod-BxRCHTz-.d.cts +0 -307
  163. package/dist/mod-C58MZ7Wx.d.cts +0 -113
  164. package/dist/mod-CcDPcLJW.d.cts +0 -1
  165. package/dist/mod-Ds0mpFZU.d.ts +0 -115
  166. package/dist/mod-bjzj5QIb.d.ts +0 -2
  167. package/dist/otel-1BmGPuZc.js +0 -64
  168. package/dist/src/vocab/accept.yaml +0 -15
  169. package/dist/src/vocab/activity.yaml +0 -98
  170. package/dist/src/vocab/add.yaml +0 -16
  171. package/dist/src/vocab/announce.yaml +0 -30
  172. package/dist/src/vocab/application.yaml +0 -324
  173. package/dist/src/vocab/arrive.yaml +0 -15
  174. package/dist/src/vocab/article.yaml +0 -46
  175. package/dist/src/vocab/audio.yaml +0 -11
  176. package/dist/src/vocab/block.yaml +0 -16
  177. package/dist/src/vocab/chatmessage.yaml +0 -50
  178. package/dist/src/vocab/collection.yaml +0 -154
  179. package/dist/src/vocab/collectionpage.yaml +0 -55
  180. package/dist/src/vocab/create.yaml +0 -28
  181. package/dist/src/vocab/dataintegrityproof.yaml +0 -56
  182. package/dist/src/vocab/delete.yaml +0 -27
  183. package/dist/src/vocab/didservice.yaml +0 -22
  184. package/dist/src/vocab/dislike.yaml +0 -14
  185. package/dist/src/vocab/document.yaml +0 -31
  186. package/dist/src/vocab/emoji.yaml +0 -12
  187. package/dist/src/vocab/emojireact.yaml +0 -17
  188. package/dist/src/vocab/endpoints.yaml +0 -85
  189. package/dist/src/vocab/event.yaml +0 -11
  190. package/dist/src/vocab/export.yaml +0 -9
  191. package/dist/src/vocab/flag.yaml +0 -15
  192. package/dist/src/vocab/follow.yaml +0 -19
  193. package/dist/src/vocab/group.yaml +0 -324
  194. package/dist/src/vocab/hashtag.yaml +0 -14
  195. package/dist/src/vocab/ignore.yaml +0 -14
  196. package/dist/src/vocab/image.yaml +0 -9
  197. package/dist/src/vocab/intransitiveactivity.yaml +0 -15
  198. package/dist/src/vocab/invite.yaml +0 -14
  199. package/dist/src/vocab/join.yaml +0 -14
  200. package/dist/src/vocab/key.yaml +0 -28
  201. package/dist/src/vocab/leave.yaml +0 -14
  202. package/dist/src/vocab/like.yaml +0 -16
  203. package/dist/src/vocab/link.yaml +0 -101
  204. package/dist/src/vocab/listen.yaml +0 -12
  205. package/dist/src/vocab/mention.yaml +0 -9
  206. package/dist/src/vocab/move.yaml +0 -15
  207. package/dist/src/vocab/multikey.yaml +0 -36
  208. package/dist/src/vocab/note.yaml +0 -48
  209. package/dist/src/vocab/object.yaml +0 -404
  210. package/dist/src/vocab/offer.yaml +0 -15
  211. package/dist/src/vocab/orderedcollection.yaml +0 -39
  212. package/dist/src/vocab/orderedcollectionpage.yaml +0 -50
  213. package/dist/src/vocab/organization.yaml +0 -324
  214. package/dist/src/vocab/page.yaml +0 -11
  215. package/dist/src/vocab/person.yaml +0 -324
  216. package/dist/src/vocab/place.yaml +0 -75
  217. package/dist/src/vocab/profile.yaml +0 -26
  218. package/dist/src/vocab/propertyvalue.yaml +0 -32
  219. package/dist/src/vocab/question.yaml +0 -103
  220. package/dist/src/vocab/read.yaml +0 -13
  221. package/dist/src/vocab/reject.yaml +0 -14
  222. package/dist/src/vocab/relationship.yaml +0 -52
  223. package/dist/src/vocab/remove.yaml +0 -14
  224. package/dist/src/vocab/service.yaml +0 -324
  225. package/dist/src/vocab/source.yaml +0 -26
  226. package/dist/src/vocab/tentativeaccept.yaml +0 -14
  227. package/dist/src/vocab/tentativereject.yaml +0 -14
  228. package/dist/src/vocab/tombstone.yaml +0 -24
  229. package/dist/src/vocab/travel.yaml +0 -16
  230. package/dist/src/vocab/undo.yaml +0 -26
  231. package/dist/src/vocab/update.yaml +0 -58
  232. package/dist/src/vocab/video.yaml +0 -11
  233. package/dist/src/vocab/view.yaml +0 -13
  234. package/dist/testing/docloader.test.js +0 -22
  235. package/dist/vocab/actor.test.js +0 -5963
  236. package/dist/vocab/lookup.test.d.ts +0 -3
  237. package/dist/vocab/lookup.test.js +0 -476
  238. package/dist/vocab/type.test.d.ts +0 -3
  239. package/dist/vocab/type.test.js +0 -24
  240. package/dist/vocab/vocab.test.d.ts +0 -3
  241. package/dist/vocab/vocab.test.js +0 -9397
  242. package/dist/vocab-BCWe1Ih5.d.ts +0 -14905
  243. package/dist/vocab-ByUp-A2_.js +0 -260
  244. package/dist/vocab-CeDBzu-f.d.cts +0 -14903
  245. package/dist/vocab-X_X5T8D3.cjs +0 -296
  246. package/dist/webfinger/handler.test.d.ts +0 -3
  247. package/dist/webfinger/lookup.test.d.ts +0 -3
  248. package/dist/webfinger/lookup.test.js +0 -193
  249. package/dist/webfinger/mod.cjs +0 -8
  250. package/dist/webfinger/mod.d.cts +0 -2
  251. package/dist/webfinger/mod.d.ts +0 -4
  252. package/dist/webfinger/mod.js +0 -8
  253. package/dist/webfinger-C72Y8lrh.js +0 -4
  254. package/dist/webfinger-vAtLmxOF.cjs +0 -4
  255. /package/dist/{collection-BzWsN9pB.js → collection-CcnIw1qY.js} +0 -0
  256. /package/dist/{testing/docloader.test.d.ts → federation/webfinger.test.d.ts} +0 -0
  257. /package/dist/{mod-CVgZgliM.d.ts → mod-1E3W847c.d.ts} +0 -0
  258. /package/dist/{mod-B-hUPT2N.d.cts → mod-C81L6_lQ.d.cts} +0 -0
  259. /package/dist/{negotiation-C4nFufNk.js → negotiation-5NPJL6zp.js} +0 -0
  260. /package/dist/{nodeinfo-BnthBobC.js → nodeinfo-BlLsRSiT.js} +0 -0
  261. /package/dist/{nodeinfo-CdN0rEnZ.cjs → nodeinfo-DuMYTpbZ.cjs} +0 -0
  262. /package/dist/{vocab/actor.test.d.ts → otel/exporter.test.d.ts} +0 -0
  263. /package/dist/{retry-CfF8Gn4d.js → retry-D4GJ670a.js} +0 -0
  264. /package/dist/{sig-C34-oHBl.js → sig-CwuONEzF.js} +0 -0
  265. /package/dist/{sig-YYj5tCnr.cjs → sig-DeXX2xnj.cjs} +0 -0
  266. /package/dist/{utils-DyRU1gdZ.cjs → utils-Db0ZmjcD.cjs} +0 -0
  267. /package/dist/{utils-D-Va7aXC.js → utils-Wranxuoe.js} +0 -0
@@ -1,15 +1,13 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-BsGzbnV-.js";
4
- import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-BCWe1Ih5.js";
5
- import { Actor, Recipient } from "./actor-DqFajh9s.js";
6
- import { HttpMessageSignaturesSpec } from "./http-BbO0ejuk.js";
7
- import { GetKeyOwnerOptions } from "./owner-kQRGVXG1.js";
8
- import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-BlVovdcy.js";
9
- import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-Ds0mpFZU.js";
10
- import { KvKey, KvStore } from "./kv-BKNZ-Tb-.js";
11
- import { Span, TracerProvider } from "@opentelemetry/api";
3
+ import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-CUTUGgvJ.js";
4
+ import { HttpMessageSignaturesSpec } from "./http-DLBDPal9.js";
5
+ import { GetKeyOwnerOptions } from "./owner-BgI8C-VY.js";
6
+ import { KvKey, KvStore } from "./kv-CYySNrsn.js";
7
+ import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/vocab";
8
+ import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
12
9
  import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
10
+ import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
13
11
 
14
12
  //#region src/compat/types.d.ts
15
13
  /**
@@ -23,9 +21,9 @@ type ActivityTransformer<TContextData> = (activity: Activity, context: Context<T
23
21
  * A page of items.
24
22
  */
25
23
  interface PageItems<TItem> {
26
- prevCursor?: string | null;
27
- nextCursor?: string | null;
28
- items: TItem[];
24
+ readonly prevCursor?: string | null;
25
+ readonly nextCursor?: string | null;
26
+ readonly items: readonly TItem[];
29
27
  }
30
28
  /**
31
29
  * Calculates the [partial follower collection digest][1].
@@ -55,15 +53,44 @@ interface SenderKeyPair {
55
53
  /**
56
54
  * The actor's private key to sign the request.
57
55
  */
58
- privateKey: CryptoKey;
56
+ readonly privateKey: CryptoKey;
59
57
  /**
60
58
  * The public key ID that corresponds to the private key.
61
59
  */
62
- keyId: URL;
60
+ readonly keyId: URL;
63
61
  }
64
62
  /**
65
63
  * Parameters for {@link sendActivity}.
66
64
  */
65
+
66
+ /**
67
+ * An error that is thrown when an activity fails to send to a remote inbox.
68
+ * It contains structured information about the failure, including the HTTP
69
+ * status code, the inbox URL, and the response body.
70
+ * @since 2.0.0
71
+ */
72
+ declare class SendActivityError extends Error {
73
+ /**
74
+ * The inbox URL that the activity was being sent to.
75
+ */
76
+ readonly inbox: URL;
77
+ /**
78
+ * The HTTP status code returned by the inbox.
79
+ */
80
+ readonly statusCode: number;
81
+ /**
82
+ * The response body from the inbox, if any.
83
+ */
84
+ readonly responseBody: string;
85
+ /**
86
+ * Creates a new {@link SendActivityError}.
87
+ * @param inbox The inbox URL.
88
+ * @param statusCode The HTTP status code.
89
+ * @param message The error message.
90
+ * @param responseBody The response body.
91
+ */
92
+ constructor(inbox: URL, statusCode: number, message: string, responseBody: string);
93
+ }
67
94
  //#endregion
68
95
  //#region src/federation/callback.d.ts
69
96
  /**
@@ -226,6 +253,40 @@ type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) =
226
253
  * @since 0.6.0
227
254
  */
228
255
  type OutboxErrorHandler = (error: Error, activity: Activity | null) => void | Promise<void>;
256
+ /**
257
+ * A callback that handles permanent delivery failures when sending activities
258
+ * to remote inboxes.
259
+ *
260
+ * This handler is called when an inbox returns an HTTP status code that
261
+ * indicates permanent failure (such as `410 Gone` or `404 Not Found`),
262
+ * allowing the application to clean up followers that are no longer reachable.
263
+ *
264
+ * Unlike {@link OutboxErrorHandler}, which is called for every delivery failure
265
+ * (including retries), this handler is called only once for permanent failures,
266
+ * after which delivery is not retried.
267
+ *
268
+ * If any errors are thrown in this callback, they are caught, logged,
269
+ * and ignored.
270
+ *
271
+ * @template TContextData The context data to pass to the {@link Context}.
272
+ * @param context The context.
273
+ * @param values The delivery failure information.
274
+ * @since 2.0.0
275
+ */
276
+ type OutboxPermanentFailureHandler<TContextData> = (context: Context<TContextData>, values: {
277
+ /** The inbox URL that failed. */
278
+ readonly inbox: URL;
279
+ /** The activity that failed to deliver. */
280
+ readonly activity: Activity;
281
+ /** The error that occurred. */
282
+ readonly error: SendActivityError;
283
+ /** The HTTP status code returned by the inbox. */
284
+ readonly statusCode: number;
285
+ /**
286
+ * The actor IDs that were supposed to receive the activity at this inbox.
287
+ */
288
+ readonly actorIds: readonly URL[];
289
+ }) => void | Promise<void>;
229
290
  /**
230
291
  * A callback that determines if a request is authorized or not.
231
292
  *
@@ -319,7 +380,19 @@ interface MessageQueueEnqueueOptions {
319
380
  *
320
381
  * It must not be negative.
321
382
  */
322
- delay?: Temporal.Duration;
383
+ readonly delay?: Temporal.Duration;
384
+ /**
385
+ * An optional key that ensures messages with the same ordering key are
386
+ * processed sequentially (one at a time). Messages with different ordering
387
+ * keys (or no ordering key) may be processed in parallel.
388
+ *
389
+ * This is useful for ensuring that related messages are processed in order,
390
+ * such as ensuring that a `Delete` activity is processed after a `Create`
391
+ * activity for the same object.
392
+ *
393
+ * @since 2.0.0
394
+ */
395
+ readonly orderingKey?: string;
323
396
  }
324
397
  /**
325
398
  * Additional options for listening to a message queue.
@@ -362,7 +435,7 @@ interface MessageQueue {
362
435
  * @param messages The messages to enqueue.
363
436
  * @param options Additional options for enqueuing the messages.
364
437
  */
365
- enqueueMany?: (messages: any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
438
+ enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
366
439
  /**
367
440
  * Listens for messages in the queue.
368
441
  * @param handler The handler for messages in the queue.
@@ -404,7 +477,7 @@ declare class InProcessMessageQueue implements MessageQueue {
404
477
  */
405
478
  constructor(options?: InProcessMessageQueueOptions);
406
479
  enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
407
- enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
480
+ enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
408
481
  listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
409
482
  }
410
483
  /**
@@ -420,6 +493,21 @@ declare class InProcessMessageQueue implements MessageQueue {
420
493
  * for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
421
494
  * workloads.
422
495
  *
496
+ * When using `ParallelMessageQueue`, the ordering guarantee is preserved
497
+ * *only if* the underlying queue implementation delivers messages in a wrapper
498
+ * format that includes the `__fedify_ordering_key__` property. Currently,
499
+ * only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
500
+ * For other queue implementations (e.g., `InProcessMessageQueue`,
501
+ * `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
502
+ * `AmqpMessageQueue`), the ordering key cannot be detected by
503
+ * `ParallelMessageQueue`, so ordering guarantees are handled by those
504
+ * implementations directly rather than at the `ParallelMessageQueue` level.
505
+ *
506
+ * Messages with the same ordering key will never be processed concurrently
507
+ * by different workers, ensuring sequential processing within each key.
508
+ * Messages with different ordering keys (or no ordering key) can still be
509
+ * processed in parallel.
510
+ *
423
511
  * @since 1.0.0
424
512
  */
425
513
  declare class ParallelMessageQueue implements MessageQueue {
@@ -442,7 +530,7 @@ declare class ParallelMessageQueue implements MessageQueue {
442
530
  */
443
531
  constructor(queue: MessageQueue, workers: number);
444
532
  enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
445
- enqueueMany(messages: any[], options?: MessageQueueEnqueueOptions): Promise<void>;
533
+ enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
446
534
  listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
447
535
  }
448
536
  //#endregion
@@ -573,8 +661,8 @@ declare function createFederationBuilder<TContextData>(): FederationBuilder<TCon
573
661
  //#endregion
574
662
  //#region src/federation/queue.d.ts
575
663
  interface SenderKeyJwkPair {
576
- keyId: string;
577
- privateKey: JsonWebKey;
664
+ readonly keyId: string;
665
+ readonly privateKey: JsonWebKey;
578
666
  }
579
667
  /**
580
668
  * A message that represents a task to be processed by the background worker.
@@ -587,44 +675,47 @@ interface SenderKeyJwkPair {
587
675
  */
588
676
  type Message = FanoutMessage | OutboxMessage | InboxMessage;
589
677
  interface FanoutMessage {
590
- type: "fanout";
591
- id: ReturnType<typeof crypto.randomUUID>;
592
- baseUrl: string;
593
- keys: SenderKeyJwkPair[];
594
- inboxes: Record<string, {
595
- actorIds: string[];
596
- sharedInbox: boolean;
597
- }>;
598
- activity: unknown;
599
- activityId?: string;
600
- activityType: string;
601
- collectionSync?: string;
602
- traceContext: Record<string, string>;
678
+ readonly type: "fanout";
679
+ readonly id: ReturnType<typeof crypto.randomUUID>;
680
+ readonly baseUrl: string;
681
+ readonly keys: readonly SenderKeyJwkPair[];
682
+ readonly inboxes: Readonly<Record<string, {
683
+ readonly actorIds: readonly string[];
684
+ readonly sharedInbox: boolean;
685
+ }>>;
686
+ readonly activity: unknown;
687
+ readonly activityId?: string;
688
+ readonly activityType: string;
689
+ readonly collectionSync?: string;
690
+ readonly orderingKey?: string;
691
+ readonly traceContext: Readonly<Record<string, string>>;
603
692
  }
604
693
  interface OutboxMessage {
605
- type: "outbox";
606
- id: ReturnType<typeof crypto.randomUUID>;
607
- baseUrl: string;
608
- keys: SenderKeyJwkPair[];
609
- activity: unknown;
610
- activityId?: string;
611
- activityType: string;
612
- inbox: string;
613
- sharedInbox: boolean;
614
- started: string;
615
- attempt: number;
616
- headers: Record<string, string>;
617
- traceContext: Record<string, string>;
694
+ readonly type: "outbox";
695
+ readonly id: ReturnType<typeof crypto.randomUUID>;
696
+ readonly baseUrl: string;
697
+ readonly keys: readonly SenderKeyJwkPair[];
698
+ readonly activity: unknown;
699
+ readonly activityId?: string;
700
+ readonly activityType: string;
701
+ readonly inbox: string;
702
+ readonly sharedInbox: boolean;
703
+ readonly actorIds?: readonly string[];
704
+ readonly started: string;
705
+ readonly attempt: number;
706
+ readonly headers: Readonly<Record<string, string>>;
707
+ readonly orderingKey?: string;
708
+ readonly traceContext: Readonly<Record<string, string>>;
618
709
  }
619
710
  interface InboxMessage {
620
- type: "inbox";
621
- id: ReturnType<typeof crypto.randomUUID>;
622
- baseUrl: string;
623
- activity: unknown;
624
- started: string;
625
- attempt: number;
626
- identifier: string | null;
627
- traceContext: Record<string, string>;
711
+ readonly type: "inbox";
712
+ readonly id: ReturnType<typeof crypto.randomUUID>;
713
+ readonly baseUrl: string;
714
+ readonly activity: unknown;
715
+ readonly started: string;
716
+ readonly attempt: number;
717
+ readonly identifier: string | null;
718
+ readonly traceContext: Readonly<Record<string, string>>;
628
719
  }
629
720
  //#endregion
630
721
  //#region src/federation/retry.d.ts
@@ -708,19 +799,19 @@ interface FederationQueueOptions {
708
799
  * The message queue for incoming activities. If not provided, incoming
709
800
  * activities will not be queued and will be processed immediately.
710
801
  */
711
- inbox?: MessageQueue;
802
+ readonly inbox?: MessageQueue;
712
803
  /**
713
804
  * The message queue for outgoing activities. If not provided, outgoing
714
805
  * activities will not be queued and will be sent immediately.
715
806
  */
716
- outbox?: MessageQueue;
807
+ readonly outbox?: MessageQueue;
717
808
  /**
718
809
  * The message queue for fanning out outgoing activities. If not provided,
719
810
  * outgoing activities will not be fanned out in the background, but will be
720
811
  * fanned out immediately, which causes slow response times on
721
812
  * {@link Context.sendActivity} calls.
722
813
  */
723
- fanout?: MessageQueue;
814
+ readonly fanout?: MessageQueue;
724
815
  }
725
816
  /**
726
817
  * Prefixes for namespacing keys in the Deno KV store.
@@ -731,18 +822,18 @@ interface FederationKvPrefixes {
731
822
  * processed or not.
732
823
  * @default `["_fedify", "activityIdempotence"]`
733
824
  */
734
- activityIdempotence: KvKey;
825
+ readonly activityIdempotence: KvKey;
735
826
  /**
736
827
  * The key prefix used for storing remote JSON-LD documents.
737
828
  * @default `["_fedify", "remoteDocument"]`
738
829
  */
739
- remoteDocument: KvKey;
830
+ readonly remoteDocument: KvKey;
740
831
  /**
741
832
  * The key prefix used for caching public keys.
742
833
  * @default `["_fedify", "publicKey"]`
743
834
  * @since 0.12.0
744
835
  */
745
- publicKey: KvKey;
836
+ readonly publicKey: KvKey;
746
837
  /**
747
838
  * The key prefix used for caching HTTP Message Signatures specs.
748
839
  * The cached spec is used to reduce the number of requests to make signed
@@ -750,7 +841,7 @@ interface FederationKvPrefixes {
750
841
  * @default `["_fedify", "httpMessageSignaturesSpec"]`
751
842
  * @since 1.6.0
752
843
  */
753
- httpMessageSignaturesSpec: KvKey;
844
+ readonly httpMessageSignaturesSpec: KvKey;
754
845
  }
755
846
  /**
756
847
  * Options for {@link CreateFederationOptions.origin} when it is not a string.
@@ -1049,7 +1140,7 @@ interface Federatable<TContextData> {
1049
1140
  * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
1050
1141
  * The path must have no variables.
1051
1142
  * @returns An object to register inbox listeners.
1052
- * @throws {RouteError} Thrown if the path pattern is invalid.
1143
+ * @throws {RouterError} Thrown if the path pattern is invalid.
1053
1144
  */
1054
1145
  setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
1055
1146
  /**
@@ -1142,6 +1233,22 @@ interface Federatable<TContextData> {
1142
1233
  * @param dispatcher A collection dispatcher callback to register.
1143
1234
  */
1144
1235
  setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
1236
+ /**
1237
+ * Registers a handler for permanent delivery failures.
1238
+ *
1239
+ * This handler is called when an inbox returns an HTTP status code
1240
+ * that indicates permanent failure (`410 Gone`, `404 Not Found`, etc.),
1241
+ * allowing the application to clean up followers that are no longer
1242
+ * reachable.
1243
+ *
1244
+ * Unlike `onOutboxError`, which is called for every delivery failure
1245
+ * (including retries), this handler is called only once for permanent
1246
+ * failures, after which delivery is not retried.
1247
+ *
1248
+ * @param handler A callback to handle permanent failures.
1249
+ * @since 2.0.0
1250
+ */
1251
+ setOutboxPermanentFailureHandler(handler: OutboxPermanentFailureHandler<TContextData>): void;
1145
1252
  }
1146
1253
  /**
1147
1254
  * An object that registers federation-related business logic and dispatches
@@ -1314,6 +1421,17 @@ interface FederationOptions<TContextData> {
1314
1421
  * If any errors are thrown in this callback, they are ignored.
1315
1422
  */
1316
1423
  onOutboxError?: OutboxErrorHandler;
1424
+ /**
1425
+ * HTTP status codes that should be treated as permanent delivery failures.
1426
+ * When an inbox returns one of these codes, the delivery will not be retried
1427
+ * and the permanent failure handler (if registered via
1428
+ * {@link Federatable.setOutboxPermanentFailureHandler}) will be called.
1429
+ *
1430
+ * By default, `[404, 410]`.
1431
+ *
1432
+ * @since 2.0.0
1433
+ */
1434
+ permanentFailureStatusCodes?: readonly number[];
1317
1435
  /**
1318
1436
  * The time window for verifying HTTP Signatures of incoming requests. If the
1319
1437
  * request is older or newer than this window, it is rejected. Or if it is
@@ -1768,7 +1886,7 @@ interface Context<TContextData> {
1768
1886
  * @param cls The class of the object.
1769
1887
  * @param values The values to pass to the object dispatcher.
1770
1888
  * @returns The object's URI.
1771
- * @throws {RouteError} If no object dispatcher is available for the class.
1889
+ * @throws {RouterError} If no object dispatcher is available for the class.
1772
1890
  * @throws {TypeError} If values are invalid.
1773
1891
  * @since 0.7.0
1774
1892
  */
@@ -2000,7 +2118,7 @@ interface Context<TContextData> {
2000
2118
  handle: string;
2001
2119
  }, recipients: Recipient | Recipient[], activity: Activity, options?: SendActivityOptions): Promise<void>;
2002
2120
  /**
2003
- * Sends an activity to the outboxes of the sender's followers.
2121
+ * Sends an activity to the inboxes of the sender's followers.
2004
2122
  * @param sender The sender's identifier or the sender's username.
2005
2123
  * @param recipients In this case, it must be `"followers"`.
2006
2124
  * @param activity The activity to send.
@@ -2041,7 +2159,7 @@ interface Context<TContextData> {
2041
2159
  * @param name The name of the collection, which can be a string or a symbol.
2042
2160
  * @param values The values of the URI parameters.
2043
2161
  * @return The URI of the collection.
2044
- * @throws {RouteError} If no object dispatcher is available for the name.
2162
+ * @throws {RouterError} If no object dispatcher is available for the name.
2045
2163
  * @throws {TypeError} If values are invalid.
2046
2164
  * @since 1.8.0
2047
2165
  */
@@ -2164,7 +2282,7 @@ interface InboxContext<TContextData> extends Context<TContextData> {
2164
2282
  * inbox, it is `null`.
2165
2283
  * @since 1.2.0
2166
2284
  */
2167
- recipient: string | null;
2285
+ readonly recipient: string | null;
2168
2286
  /**
2169
2287
  * Creates a new context with the same properties as this one,
2170
2288
  * but with the given data.
@@ -2320,7 +2438,7 @@ interface SendActivityOptions {
2320
2438
  /**
2321
2439
  * Whether to prefer the shared inbox for the recipients.
2322
2440
  */
2323
- preferSharedInbox?: boolean;
2441
+ readonly preferSharedInbox?: boolean;
2324
2442
  /**
2325
2443
  * Whether to send the activity immediately, without enqueuing it.
2326
2444
  * If `true`, the activity will be sent immediately and the retrial
@@ -2328,7 +2446,7 @@ interface SendActivityOptions {
2328
2446
  *
2329
2447
  * @since 0.3.0
2330
2448
  */
2331
- immediate?: boolean;
2449
+ readonly immediate?: boolean;
2332
2450
  /**
2333
2451
  * Determines how activities are queued when sent to multiple recipients.
2334
2452
  *
@@ -2345,7 +2463,7 @@ interface SendActivityOptions {
2345
2463
  * @default `"auto"`
2346
2464
  * @since 1.5.0
2347
2465
  */
2348
- fanout?: "auto" | "skip" | "force";
2466
+ readonly fanout?: "auto" | "skip" | "force";
2349
2467
  /**
2350
2468
  * The base URIs to exclude from the recipients' inboxes. It is useful
2351
2469
  * for excluding the recipients having the same shared inbox with the sender.
@@ -2354,7 +2472,21 @@ interface SendActivityOptions {
2354
2472
  *
2355
2473
  * @since 0.9.0
2356
2474
  */
2357
- excludeBaseUris?: URL[];
2475
+ readonly excludeBaseUris?: readonly URL[];
2476
+ /**
2477
+ * An optional key to ensure ordered delivery of activities. Activities with
2478
+ * the same `orderingKey` are guaranteed to be delivered in the order they
2479
+ * were enqueued, per recipient server.
2480
+ *
2481
+ * Typical use case: pass the object ID (e.g., `Note` ID) to ensure that
2482
+ * `Create`, `Update`, and `Delete` activities for the same object are
2483
+ * delivered in order.
2484
+ *
2485
+ * When omitted, no ordering is guaranteed (maximum parallelism).
2486
+ *
2487
+ * @since 2.0.0
2488
+ */
2489
+ readonly orderingKey?: string;
2358
2490
  }
2359
2491
  /**
2360
2492
  * Options for {@link Context.sendActivity} method when sending to a collection.
@@ -2437,15 +2569,15 @@ interface ActorKeyPair extends CryptoKeyPair {
2437
2569
  /**
2438
2570
  * The URI of the public key, which is used for verifying HTTP Signatures.
2439
2571
  */
2440
- keyId: URL;
2572
+ readonly keyId: URL;
2441
2573
  /**
2442
2574
  * A {@link CryptographicKey} instance of the public key.
2443
2575
  */
2444
- cryptographicKey: CryptographicKey;
2576
+ readonly cryptographicKey: CryptographicKey;
2445
2577
  /**
2446
2578
  * A {@link Multikey} instance of the public key.
2447
2579
  */
2448
- multikey: Multikey;
2580
+ readonly multikey: Multikey;
2449
2581
  }
2450
2582
  //#endregion
2451
- export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
2583
+ export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
@@ -0,0 +1,109 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+ globalThis.addEventListener = () => {};
5
+
6
+ import { mockDocumentLoader } from "./dist-B5f6a8Tt.js";
7
+ import { RouterError } from "./router-D9eI0s4b.js";
8
+ import { lookupObject, traverseCollection } from "@fedify/vocab";
9
+ import { lookupWebFinger } from "@fedify/webfinger";
10
+ import { trace } from "@opentelemetry/api";
11
+
12
+ //#region src/testing/context.ts
13
+ function createContext(values) {
14
+ const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
15
+ function throwRouterError() {
16
+ throw new RouterError("Not implemented");
17
+ }
18
+ return {
19
+ federation,
20
+ data,
21
+ origin: url.origin,
22
+ canonicalOrigin: canonicalOrigin ?? url.origin,
23
+ host: url.host,
24
+ hostname: url.hostname,
25
+ documentLoader: documentLoader ?? mockDocumentLoader,
26
+ contextLoader: contextLoader ?? mockDocumentLoader,
27
+ tracerProvider: tracerProvider ?? trace.getTracerProvider(),
28
+ clone: clone ?? ((data$1) => createContext({
29
+ ...values,
30
+ data: data$1
31
+ })),
32
+ getNodeInfoUri: getNodeInfoUri ?? throwRouterError,
33
+ getActorUri: getActorUri ?? throwRouterError,
34
+ getObjectUri: getObjectUri ?? throwRouterError,
35
+ getCollectionUri: getCollectionUri ?? throwRouterError,
36
+ getOutboxUri: getOutboxUri ?? throwRouterError,
37
+ getInboxUri: getInboxUri ?? throwRouterError,
38
+ getFollowingUri: getFollowingUri ?? throwRouterError,
39
+ getFollowersUri: getFollowersUri ?? throwRouterError,
40
+ getLikedUri: getLikedUri ?? throwRouterError,
41
+ getFeaturedUri: getFeaturedUri ?? throwRouterError,
42
+ getFeaturedTagsUri: getFeaturedTagsUri ?? throwRouterError,
43
+ parseUri: parseUri ?? ((_uri) => {
44
+ throw new Error("Not implemented");
45
+ }),
46
+ getDocumentLoader: getDocumentLoader ?? ((_params) => {
47
+ throw new Error("Not implemented");
48
+ }),
49
+ getActorKeyPairs: getActorKeyPairs ?? ((_handle) => Promise.resolve([])),
50
+ lookupObject: lookupObject$1 ?? ((uri, options = {}) => {
51
+ return lookupObject(uri, {
52
+ documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
53
+ contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
54
+ });
55
+ }),
56
+ traverseCollection: traverseCollection$1 ?? ((collection, options = {}) => {
57
+ return traverseCollection(collection, {
58
+ documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
59
+ contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
60
+ });
61
+ }),
62
+ lookupNodeInfo: lookupNodeInfo ?? ((_params) => {
63
+ throw new Error("Not implemented");
64
+ }),
65
+ lookupWebFinger: lookupWebFinger$1 ?? ((resource, options = {}) => {
66
+ return lookupWebFinger(resource, options);
67
+ }),
68
+ sendActivity: sendActivity ?? ((_params) => {
69
+ throw new Error("Not implemented");
70
+ }),
71
+ routeActivity: routeActivity ?? ((_params) => {
72
+ throw new Error("Not implemented");
73
+ })
74
+ };
75
+ }
76
+ function createRequestContext(args) {
77
+ return {
78
+ ...createContext(args),
79
+ clone: args.clone ?? ((data) => createRequestContext({
80
+ ...args,
81
+ data
82
+ })),
83
+ request: args.request ?? new Request(args.url),
84
+ url: args.url,
85
+ getActor: args.getActor ?? (() => Promise.resolve(null)),
86
+ getObject: args.getObject ?? (() => Promise.resolve(null)),
87
+ getSignedKey: args.getSignedKey ?? (() => Promise.resolve(null)),
88
+ getSignedKeyOwner: args.getSignedKeyOwner ?? (() => Promise.resolve(null)),
89
+ sendActivity: args.sendActivity ?? ((_params) => {
90
+ throw new Error("Not implemented");
91
+ })
92
+ };
93
+ }
94
+ function createInboxContext(args) {
95
+ return {
96
+ ...createContext(args),
97
+ clone: args.clone ?? ((data) => createInboxContext({
98
+ ...args,
99
+ data
100
+ })),
101
+ recipient: args.recipient ?? null,
102
+ forwardActivity: args.forwardActivity ?? ((_params) => {
103
+ throw new Error("Not implemented");
104
+ })
105
+ };
106
+ }
107
+
108
+ //#endregion
109
+ export { createInboxContext, createRequestContext };