@fedify/fedify 2.0.0-pr.451.1731 → 2.0.0-pr.451.1735

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 (162) hide show
  1. package/dist/{actor-GwnlqPRv.js → actor-BlCt_BFA.js} +1 -1
  2. package/dist/{actor-Cd2CREO0.d.ts → actor-DqFajh9s.d.ts} +2 -2
  3. package/dist/{actor-Ci-5y3ml.cjs → actor-SSKGPs2C.cjs} +186 -187
  4. package/dist/{actor-DDhZuMGl.d.cts → actor-f2NtjyCg.d.cts} +2 -2
  5. package/dist/{actor-CRQwUlsr.js → actor-qRieKMCS.js} +185 -186
  6. package/dist/{builder-BflZmL4k.js → builder-Daev8Oe3.js} +3 -3
  7. package/dist/{client-Cle5j1T1.d.cts → client-94iWEfQa.d.cts} +1 -1
  8. package/dist/{client-Bkaw0_PR.d.ts → client-BsGzbnV-.d.ts} +1 -1
  9. package/dist/{client-DylapB-t.js → client-pY7-3icS.js} +1 -1
  10. package/dist/compat/mod.d.cts +11 -12
  11. package/dist/compat/mod.d.ts +11 -12
  12. package/dist/compat/transformers.test.js +16 -16
  13. package/dist/{context-BOYzcFSe.d.cts → context-BvYz3eOb.d.cts} +11 -11
  14. package/dist/{context-DqFifMwj.d.ts → context-myrGWbL_.d.ts} +11 -11
  15. package/dist/{docloader-BpcE9hBI.js → docloader-CuY-IQHN.js} +4 -5
  16. package/dist/{esm-DjbC-dsH.js → esm-CO0P-prF.js} +1 -1
  17. package/dist/federation/builder.test.js +4 -4
  18. package/dist/federation/collection.test.js +2 -2
  19. package/dist/federation/handler.test.js +17 -17
  20. package/dist/federation/idempotency.test.js +17 -17
  21. package/dist/federation/inbox.test.js +3 -3
  22. package/dist/federation/keycache.test.js +3 -3
  23. package/dist/federation/kv.test.js +2 -2
  24. package/dist/federation/middleware.test.js +18 -18
  25. package/dist/federation/mod.cjs +9 -10
  26. package/dist/federation/mod.d.cts +11 -12
  27. package/dist/federation/mod.d.ts +11 -12
  28. package/dist/federation/mod.js +9 -10
  29. package/dist/federation/mq.test.js +2 -2
  30. package/dist/federation/negotiation.test.js +2 -2
  31. package/dist/federation/retry.test.js +2 -2
  32. package/dist/federation/router.test.js +2 -2
  33. package/dist/federation/send.test.js +9 -9
  34. package/dist/{http-CCUJdi0H.js → http--W_KqmV8.js} +2 -2
  35. package/dist/{http-BE7aFuqn.d.ts → http-BbO0ejuk.d.ts} +1 -1
  36. package/dist/{http-DtUGyvkU.cjs → http-CZRSpr-0.cjs} +5 -5
  37. package/dist/{http-B6SKO6NJ.d.cts → http-M8k5mKc0.d.cts} +1 -1
  38. package/dist/{http-BzsavjR2.js → http-cj5p1nm9.js} +2 -2
  39. package/dist/{inbox-DizLjfhC.js → inbox-DCOu4Fxg.js} +1 -1
  40. package/dist/{key-De1MJH3k.js → key-CLBIsQ2b.js} +2 -2
  41. package/dist/{keycache-D2HiBv4F.js → keycache-C_E92fAZ.js} +1 -1
  42. package/dist/{keys-B4ZjS1Ot.js → keys-CESa8pOV.js} +1 -1
  43. package/dist/kv-cache-6gn8hq87.cjs +133 -0
  44. package/dist/kv-cache-D6OS46Qp.js +121 -0
  45. package/dist/kv-cache-z0lgwFi_.js +93 -0
  46. package/dist/{ld-Dux3_Cw2.js → ld-uohK5TcN.js} +2 -2
  47. package/dist/{lookup-Bql--V-C.js → lookup-B4NiLSoR.js} +129 -60
  48. package/dist/{lookup-Bep-EOgr.js → lookup-Bp3gBRGD.js} +188 -297
  49. package/dist/lookup-CfVdYD74.cjs +273 -0
  50. package/dist/{middleware-DrpnHeGO.cjs → middleware-B5t3REnT.cjs} +18 -19
  51. package/dist/middleware-B86mRO81.cjs +15 -0
  52. package/dist/{middleware-BBTmHKGh.js → middleware-BEWbWO0t.js} +8 -9
  53. package/dist/middleware-BzGmhttT.js +26 -0
  54. package/dist/middleware-DxFOBA0V.js +15 -0
  55. package/dist/{middleware-D7tP9Tq6.js → middleware-yd4xq6Dt.js} +13 -13
  56. package/dist/{mod-DLIidI_j.d.ts → mod-B2iOw50L.d.ts} +2 -2
  57. package/dist/{mod-Cm97bAiT.d.ts → mod-BYynOiJG.d.ts} +2 -2
  58. package/dist/{mod-CRENK2dd.d.ts → mod-BlVovdcy.d.ts} +2 -3
  59. package/dist/{mod--K7l84wp.d.cts → mod-BxRCHTz-.d.cts} +2 -3
  60. package/dist/{mod-DuclhZjh.d.cts → mod-C58MZ7Wx.d.cts} +1 -1
  61. package/dist/{mod-D9XZsft2.d.cts → mod-DbFNTF7m.d.cts} +2 -2
  62. package/dist/{mod-COlOrmr9.d.cts → mod-DgdBYYa0.d.cts} +2 -2
  63. package/dist/{mod-CB80AlIA.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
  64. package/dist/{mod-CLKu6Uo_.d.cts → mod-VastcQsk.d.cts} +2 -2
  65. package/dist/{mod-CaWbCg0N.d.ts → mod-k0Dk3fGk.d.ts} +2 -2
  66. package/dist/mod.cjs +13 -15
  67. package/dist/mod.d.cts +15 -16
  68. package/dist/mod.d.ts +16 -17
  69. package/dist/mod.js +14 -15
  70. package/dist/nodeinfo/client.test.js +4 -4
  71. package/dist/nodeinfo/handler.test.js +16 -16
  72. package/dist/nodeinfo/mod.cjs +2 -3
  73. package/dist/nodeinfo/mod.d.cts +2 -3
  74. package/dist/nodeinfo/mod.d.ts +2 -3
  75. package/dist/nodeinfo/mod.js +2 -3
  76. package/dist/nodeinfo/types.test.js +2 -2
  77. package/dist/{owner-dkg5OpSC.d.cts → owner-B4HbyP8s.d.cts} +2 -2
  78. package/dist/{owner-Zq8du9WO.js → owner-DMwt6EnB.js} +2 -2
  79. package/dist/{owner-CktUdA0h.d.ts → owner-kQRGVXG1.d.ts} +2 -2
  80. package/dist/{proof-aIlK5BTc.js → proof-BRMzWGtg.js} +3 -3
  81. package/dist/{proof-0PY1LDZY.cjs → proof-DVvnQ6WP.cjs} +7 -7
  82. package/dist/{proof-C5S_3hdJ.js → proof-X6v_1MA6.js} +2 -2
  83. package/dist/{send-BbVnlsQO.js → send-Cy3TUzxE.js} +2 -2
  84. package/dist/sig/http.test.js +7 -7
  85. package/dist/sig/key.test.js +5 -5
  86. package/dist/sig/ld.test.js +6 -6
  87. package/dist/sig/mod.cjs +5 -6
  88. package/dist/sig/mod.d.cts +5 -6
  89. package/dist/sig/mod.d.ts +5 -6
  90. package/dist/sig/mod.js +5 -6
  91. package/dist/sig/owner.test.js +6 -6
  92. package/dist/sig/proof.test.js +6 -6
  93. package/dist/testing/docloader.test.js +2 -2
  94. package/dist/testing/mod.d.ts +1 -27
  95. package/dist/testing/mod.js +2 -2
  96. package/dist/{testing-BkidWE0N.js → testing-BJJvJvZe.js} +1 -1
  97. package/dist/{types-CXnyjUdK.js → types-BtUjyi5y.js} +1 -1
  98. package/dist/{types-BDNYgodm.cjs → types-CWgzGaqk.cjs} +3 -3
  99. package/dist/utils/docloader.test.js +9 -8
  100. package/dist/utils/kv-cache.test.js +4 -3
  101. package/dist/utils/mod.cjs +5 -7
  102. package/dist/utils/mod.d.cts +5 -6
  103. package/dist/utils/mod.d.ts +5 -6
  104. package/dist/utils/mod.js +6 -7
  105. package/dist/vocab/actor.test.js +4 -4
  106. package/dist/vocab/lookup.test.js +3 -3
  107. package/dist/vocab/mod.cjs +3 -4
  108. package/dist/vocab/mod.d.cts +3 -4
  109. package/dist/vocab/mod.d.ts +3 -4
  110. package/dist/vocab/mod.js +3 -4
  111. package/dist/vocab/type.test.js +2 -2
  112. package/dist/vocab/vocab.test.js +3 -3
  113. package/dist/{vocab-Dapemq3v.cjs → vocab-BPtsEU8k.cjs} +3 -4
  114. package/dist/{vocab-BiKK7m2H.js → vocab-DFaqbY9O.js} +2 -3
  115. package/dist/webfinger/handler.test.js +16 -16
  116. package/dist/webfinger/lookup.test.js +3 -3
  117. package/dist/webfinger/mod.cjs +2 -3
  118. package/dist/webfinger/mod.d.cts +1 -2
  119. package/dist/webfinger/mod.d.ts +1 -2
  120. package/dist/webfinger/mod.js +2 -3
  121. package/dist/x/cfworkers.d.cts +2 -2
  122. package/dist/x/cfworkers.d.ts +2 -2
  123. package/dist/x/cfworkers.test.js +2 -2
  124. package/dist/x/hono.d.cts +10 -11
  125. package/dist/x/hono.d.ts +10 -11
  126. package/dist/x/sveltekit.d.cts +10 -11
  127. package/dist/x/sveltekit.d.ts +10 -11
  128. package/package.json +2 -3
  129. package/dist/kv-cache-3VK2-wq_.cjs +0 -4279
  130. package/dist/kv-cache-DNvS-egZ.js +0 -4236
  131. package/dist/kv-cache-rR-Cnl95.js +0 -4267
  132. package/dist/lookup-BmGuy-Ps.cjs +0 -210
  133. package/dist/middleware-BUZSGsQH.js +0 -16
  134. package/dist/middleware-BusTq7Js.cjs +0 -16
  135. package/dist/middleware-tZdLtCWz.js +0 -26
  136. package/dist/request-BbHkedIU.d.cts +0 -35
  137. package/dist/request-Bc5CHBqO.cjs +0 -208
  138. package/dist/request-C0Ags1gQ.js +0 -184
  139. package/dist/request-U1t6zZtk.d.ts +0 -39
  140. package/dist/utils/request.test.d.ts +0 -3
  141. package/dist/utils/request.test.js +0 -48
  142. package/dist/utils/url.test.d.ts +0 -3
  143. package/dist/utils/url.test.js +0 -41
  144. /package/dist/{federation-DOuZpcAw.cjs → federation-CRpdnOMS.cjs} +0 -0
  145. /package/dist/{federation-pZJsapBn.js → federation-jcR8-ZxP.js} +0 -0
  146. /package/dist/{kv-Dt06smFt.d.ts → kv-BKNZ-Tb-.d.ts} +0 -0
  147. /package/dist/{kv-BMKIFXNW.d.cts → kv-Bxr0Q87_.d.cts} +0 -0
  148. /package/dist/{mod-FZd39qVq.d.cts → mod-B-hUPT2N.d.cts} +0 -0
  149. /package/dist/{mod-B-ZQqbGe.d.ts → mod-CVgZgliM.d.ts} +0 -0
  150. /package/dist/{mod-CjsiSl7_.d.ts → mod-xIj-IT58.d.ts} +0 -0
  151. /package/dist/{mq-CPRJk4mZ.d.ts → mq-CUKlBw08.d.ts} +0 -0
  152. /package/dist/{mq-B7R1Q-M5.d.cts → mq-DcJPkXD5.d.cts} +0 -0
  153. /package/dist/{nodeinfo-B0UefMXO.js → nodeinfo-BnthBobC.js} +0 -0
  154. /package/dist/{nodeinfo-ByTd7HpT.cjs → nodeinfo-CdN0rEnZ.cjs} +0 -0
  155. /package/dist/{sig-Dx59zAgn.js → sig-C34-oHBl.js} +0 -0
  156. /package/dist/{sig-DE_NC_VQ.cjs → sig-YYj5tCnr.cjs} +0 -0
  157. /package/dist/{utils-BXMGcmqK.js → utils-D-Va7aXC.js} +0 -0
  158. /package/dist/{utils-B6yXfxAQ.cjs → utils-DyRU1gdZ.cjs} +0 -0
  159. /package/dist/{vocab-ivDKb439.d.ts → vocab-BCWe1Ih5.d.ts} +0 -0
  160. /package/dist/{vocab-DCBw44JZ.d.cts → vocab-CeDBzu-f.d.cts} +0 -0
  161. /package/dist/{webfinger-qG8R5jc3.js → webfinger-C72Y8lrh.js} +0 -0
  162. /package/dist/{webfinger-C949bxcD.cjs → webfinger-vAtLmxOF.cjs} +0 -0
@@ -3,15 +3,14 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
5
  import "../transformers-BFT6d7J5.js";
6
- import "../request-C0Ags1gQ.js";
7
- import "../actor-CRQwUlsr.js";
8
- import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-BBTmHKGh.js";
9
- import "../lookup-Bql--V-C.js";
10
- import "../http-BzsavjR2.js";
11
- import "../proof-aIlK5BTc.js";
12
- import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-pZJsapBn.js";
13
- import "../types-CXnyjUdK.js";
14
- import "../kv-cache-rR-Cnl95.js";
15
- import "../vocab-BiKK7m2H.js";
6
+ import "../lookup-B4NiLSoR.js";
7
+ import "../actor-qRieKMCS.js";
8
+ import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-BEWbWO0t.js";
9
+ import "../http-cj5p1nm9.js";
10
+ import "../proof-BRMzWGtg.js";
11
+ import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-jcR8-ZxP.js";
12
+ import "../types-BtUjyi5y.js";
13
+ import "../kv-cache-D6OS46Qp.js";
14
+ import "../vocab-DFaqbY9O.js";
16
15
 
17
16
  export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
@@ -3,11 +3,11 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../lookup-Bep-EOgr.js";
6
+ import "../lookup-Bp3gBRGD.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
- import { test } from "../testing-BkidWE0N.js";
10
+ import { test } from "../testing-BJJvJvZe.js";
11
11
  import { assertGreater, assertGreaterOrEqual } from "../std__assert-DWivtrGR.js";
12
12
  import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
13
13
  import "../assert_throws-BNXdRGWP.js";
@@ -3,12 +3,12 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../lookup-Bep-EOgr.js";
6
+ import "../lookup-Bp3gBRGD.js";
7
7
  import "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { acceptsJsonLd } from "../negotiation-C4nFufNk.js";
11
- import { test } from "../testing-BkidWE0N.js";
11
+ import { test } from "../testing-BJJvJvZe.js";
12
12
  import "../std__assert-DWivtrGR.js";
13
13
  import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
14
14
  import "../assert_throws-BNXdRGWP.js";
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../lookup-Bep-EOgr.js";
6
+ import "../lookup-Bp3gBRGD.js";
7
7
  import { AssertionError, assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { createExponentialBackoffPolicy } from "../retry-CfF8Gn4d.js";
9
- import { test } from "../testing-BkidWE0N.js";
9
+ import { test } from "../testing-BJJvJvZe.js";
10
10
  import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
11
11
 
12
12
  //#region src/federation/retry.test.ts
@@ -3,11 +3,11 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Router, RouterError } from "../lookup-Bep-EOgr.js";
6
+ import { Router, RouterError } from "../lookup-Bp3gBRGD.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
- import { test } from "../testing-BkidWE0N.js";
10
+ import { test } from "../testing-BJJvJvZe.js";
11
11
  import "../std__assert-DWivtrGR.js";
12
12
  import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
13
13
  import { assertThrows } from "../assert_throws-BNXdRGWP.js";
@@ -3,22 +3,22 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, Application, Endpoints, Group, Person, Service } from "../lookup-Bep-EOgr.js";
6
+ import { Activity, Application, Endpoints, Group, Person, Service } from "../lookup-Bp3gBRGD.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
- import "../actor-GwnlqPRv.js";
11
- import "../key-De1MJH3k.js";
12
- import { verifyRequest } from "../http-CCUJdi0H.js";
13
- import { doesActorOwnKey } from "../owner-Zq8du9WO.js";
14
- import { extractInboxes, sendActivity } from "../send-BbVnlsQO.js";
15
- import { mockDocumentLoader, test } from "../testing-BkidWE0N.js";
10
+ import "../actor-BlCt_BFA.js";
11
+ import "../key-CLBIsQ2b.js";
12
+ import { verifyRequest } from "../http--W_KqmV8.js";
13
+ import { doesActorOwnKey } from "../owner-DMwt6EnB.js";
14
+ import { extractInboxes, sendActivity } from "../send-Cy3TUzxE.js";
15
+ import { mockDocumentLoader, test } from "../testing-BJJvJvZe.js";
16
16
  import "../std__assert-DWivtrGR.js";
17
17
  import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
18
18
  import "../assert_throws-BNXdRGWP.js";
19
19
  import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
20
- import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-B4ZjS1Ot.js";
21
- import { esm_default } from "../esm-DjbC-dsH.js";
20
+ import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-CESa8pOV.js";
21
+ import { esm_default } from "../esm-CO0P-prF.js";
22
22
 
23
23
  //#region src/federation/send.test.ts
24
24
  test("extractInboxes()", () => {
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { CryptographicKey, deno_default } from "./lookup-Bep-EOgr.js";
7
- import { fetchKey, validateCryptoKey } from "./key-De1MJH3k.js";
6
+ import { CryptographicKey, deno_default } from "./lookup-Bp3gBRGD.js";
7
+ import { fetchKey, validateCryptoKey } from "./key-CLBIsQ2b.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
10
10
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { CryptographicKey, Multikey } from "./vocab-ivDKb439.js";
3
+ import { CryptographicKey, Multikey } from "./vocab-BCWe1Ih5.js";
4
4
  import { TracerProvider } from "@opentelemetry/api";
5
5
  import { DocumentLoader } from "@fedify/vocab-runtime";
6
6
 
@@ -3,8 +3,8 @@
3
3
  const { URLPattern } = require("urlpattern-polyfill");
4
4
 
5
5
  const require_chunk = require('./chunk-DqRYRqnO.cjs');
6
- const require_request = require('./request-Bc5CHBqO.cjs');
7
- const require_actor = require('./actor-Ci-5y3ml.cjs');
6
+ const require_lookup = require('./lookup-CfVdYD74.cjs');
7
+ const require_actor = require('./actor-SSKGPs2C.cjs');
8
8
  const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
9
9
  const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
10
10
  const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
@@ -108,7 +108,7 @@ async function importJwk(jwk, type) {
108
108
  */
109
109
  function fetchKey(keyId, cls, options = {}) {
110
110
  const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
111
- const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
111
+ const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
112
112
  keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
113
113
  return tracer.startActiveSpan("activitypub.fetch_key", {
114
114
  kind: __opentelemetry_api.SpanKind.CLIENT,
@@ -276,7 +276,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
276
276
  async function signRequest(request, privateKey, keyId, options = {}) {
277
277
  validateCryptoKey(privateKey, "private");
278
278
  const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
279
- const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
279
+ const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
280
280
  return await tracer.startActiveSpan("http_signatures.sign", async (span) => {
281
281
  try {
282
282
  const spec = options.spec ?? "draft-cavage-http-signatures-12";
@@ -505,7 +505,7 @@ const supportedHashAlgorithms = {
505
505
  */
506
506
  async function verifyRequest(request, options = {}) {
507
507
  const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
508
- const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
508
+ const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
509
509
  return await tracer.startActiveSpan("http_signatures.verify", async (span) => {
510
510
  if (span.isRecording()) {
511
511
  span.setAttribute(__opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_METHOD, request.method);
@@ -1,4 +1,4 @@
1
- import { CryptographicKey, Multikey } from "./vocab-DCBw44JZ.cjs";
1
+ import { CryptographicKey, Multikey } from "./vocab-CeDBzu-f.cjs";
2
2
  import { DocumentLoader } from "@fedify/vocab-runtime";
3
3
  import { TracerProvider } from "@opentelemetry/api";
4
4
 
@@ -2,8 +2,8 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { deno_default } from "./request-C0Ags1gQ.js";
6
- import { CryptographicKey, Object as Object$1, isActor } from "./actor-CRQwUlsr.js";
5
+ import { deno_default } from "./lookup-B4NiLSoR.js";
6
+ import { CryptographicKey, Object as Object$1, isActor } from "./actor-qRieKMCS.js";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, deno_default, getTypeId } from "./lookup-Bep-EOgr.js";
6
+ import { Activity, deno_default, getTypeId } from "./lookup-Bp3gBRGD.js";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
9
9
 
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { CryptographicKey, Object as Object$1, deno_default } from "./lookup-Bep-EOgr.js";
7
- import { isActor } from "./actor-GwnlqPRv.js";
6
+ import { CryptographicKey, Object as Object$1, deno_default } from "./lookup-Bp3gBRGD.js";
7
+ import { isActor } from "./actor-BlCt_BFA.js";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { CryptographicKey, Multikey } from "./lookup-Bep-EOgr.js";
6
+ import { CryptographicKey, Multikey } from "./lookup-Bp3gBRGD.js";
7
7
 
8
8
  //#region src/federation/keycache.ts
9
9
  var KvKeyCache = class {
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { CryptographicKey, Multikey } from "./lookup-Bep-EOgr.js";
6
+ import { CryptographicKey, Multikey } from "./lookup-Bp3gBRGD.js";
7
7
  import { importSpki } from "@fedify/vocab-runtime";
8
8
 
9
9
  //#region src/testing/keys.ts
@@ -0,0 +1,133 @@
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_http = require('./http-CZRSpr-0.cjs');
7
+ const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
8
+ const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
9
+ const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
10
+
11
+ //#region src/utils/docloader.ts
12
+ const logger$1 = (0, __logtape_logtape.getLogger)([
13
+ "fedify",
14
+ "utils",
15
+ "docloader"
16
+ ]);
17
+ /**
18
+ * Gets an authenticated {@link DocumentLoader} for the given identity.
19
+ * Note that an authenticated document loader intentionally does not cache
20
+ * the fetched documents.
21
+ * @param identity The identity to get the document loader for.
22
+ * The actor's key pair.
23
+ * @param options The options for the document loader.
24
+ * @returns The authenticated document loader.
25
+ * @throws {TypeError} If the key is invalid or unsupported.
26
+ * @since 0.4.0
27
+ */
28
+ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAgent, specDeterminer, tracerProvider } = {}) {
29
+ require_http.validateCryptoKey(identity.privateKey);
30
+ async function load(url, options) {
31
+ if (!allowPrivateAddress) try {
32
+ await (0, __fedify_vocab_runtime.validatePublicUrl)(url);
33
+ } catch (error) {
34
+ if (error instanceof __fedify_vocab_runtime.UrlError) logger$1.error("Disallowed private URL: {url}", {
35
+ url,
36
+ error
37
+ });
38
+ throw error;
39
+ }
40
+ const originalRequest = (0, __fedify_vocab_runtime.createActivityPubRequest)(url, { userAgent });
41
+ const response = await require_http.doubleKnock(originalRequest, identity, {
42
+ specDeterminer,
43
+ log: (0, es_toolkit.curry)(__fedify_vocab_runtime.logRequest)(logger$1),
44
+ tracerProvider,
45
+ signal: options?.signal
46
+ });
47
+ return (0, __fedify_vocab_runtime.getRemoteDocument)(url, response, load);
48
+ }
49
+ return load;
50
+ }
51
+ const _fetchDocumentLoader = (0, __fedify_vocab_runtime.getDocumentLoader)();
52
+ const _fetchDocumentLoader_allowPrivateAddress = (0, __fedify_vocab_runtime.getDocumentLoader)({ allowPrivateAddress: true });
53
+
54
+ //#endregion
55
+ //#region src/utils/kv-cache.ts
56
+ const logger = (0, __logtape_logtape.getLogger)([
57
+ "fedify",
58
+ "utils",
59
+ "kv-cache"
60
+ ]);
61
+ /**
62
+ * Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
63
+ * @param parameters The parameters for the cache.
64
+ * @returns The decorated document loader which is cache-enabled.
65
+ */
66
+ function kvCache({ loader, kv, prefix, rules }) {
67
+ const keyPrefix = prefix ?? ["_fedify", "remoteDocument"];
68
+ rules ??= [[new URLPattern({}), Temporal.Duration.from({ minutes: 5 })]];
69
+ for (const [p, duration] of rules) if (Temporal.Duration.compare(duration, { days: 30 }) > 0) throw new TypeError("The maximum cache duration is 30 days: " + (p instanceof URLPattern ? `${p.protocol}://${p.username}:${p.password}@${p.hostname}:${p.port}/${p.pathname}?${p.search}#${p.hash}` : p.toString()));
70
+ return async (url, options) => {
71
+ if (url in __fedify_vocab_runtime.preloadedContexts) {
72
+ logger.debug("Using preloaded context: {url}.", { url });
73
+ return {
74
+ contextUrl: null,
75
+ document: __fedify_vocab_runtime.preloadedContexts[url],
76
+ documentUrl: url
77
+ };
78
+ }
79
+ const match = matchRule(url, rules);
80
+ if (match == null) return await loader(url, options);
81
+ const key = [...keyPrefix, url];
82
+ let cache = void 0;
83
+ try {
84
+ cache = await kv.get(key);
85
+ } catch (error) {
86
+ if (error instanceof Error) logger.warn("Failed to get the document of {url} from the KV cache: {error}", {
87
+ url,
88
+ error
89
+ });
90
+ }
91
+ if (cache == null) {
92
+ const remoteDoc = await loader(url, options);
93
+ try {
94
+ await kv.set(key, remoteDoc, { ttl: match });
95
+ } catch (error) {
96
+ logger.warn("Failed to save the document of {url} to the KV cache: {error}", {
97
+ url,
98
+ error
99
+ });
100
+ }
101
+ return remoteDoc;
102
+ }
103
+ return cache;
104
+ };
105
+ }
106
+ function matchRule(url, rules) {
107
+ for (const [pattern, duration] of rules) {
108
+ if (typeof pattern === "string") {
109
+ if (url === pattern) return duration;
110
+ continue;
111
+ }
112
+ if (pattern instanceof URL) {
113
+ if (pattern.href == url) return duration;
114
+ continue;
115
+ }
116
+ if (pattern.test(url)) return duration;
117
+ }
118
+ return null;
119
+ }
120
+
121
+ //#endregion
122
+ Object.defineProperty(exports, 'getAuthenticatedDocumentLoader', {
123
+ enumerable: true,
124
+ get: function () {
125
+ return getAuthenticatedDocumentLoader;
126
+ }
127
+ });
128
+ Object.defineProperty(exports, 'kvCache', {
129
+ enumerable: true,
130
+ get: function () {
131
+ return kvCache;
132
+ }
133
+ });
@@ -0,0 +1,121 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ import { doubleKnock, validateCryptoKey } from "./http-cj5p1nm9.js";
6
+ import { getLogger } from "@logtape/logtape";
7
+ import { UrlError, createActivityPubRequest, getDocumentLoader, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
8
+ import { curry } from "es-toolkit";
9
+
10
+ //#region src/utils/docloader.ts
11
+ const logger$1 = getLogger([
12
+ "fedify",
13
+ "utils",
14
+ "docloader"
15
+ ]);
16
+ /**
17
+ * Gets an authenticated {@link DocumentLoader} for the given identity.
18
+ * Note that an authenticated document loader intentionally does not cache
19
+ * the fetched documents.
20
+ * @param identity The identity to get the document loader for.
21
+ * The actor's key pair.
22
+ * @param options The options for the document loader.
23
+ * @returns The authenticated document loader.
24
+ * @throws {TypeError} If the key is invalid or unsupported.
25
+ * @since 0.4.0
26
+ */
27
+ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAgent, specDeterminer, tracerProvider } = {}) {
28
+ validateCryptoKey(identity.privateKey);
29
+ async function load(url, options) {
30
+ if (!allowPrivateAddress) try {
31
+ await validatePublicUrl(url);
32
+ } catch (error) {
33
+ if (error instanceof UrlError) logger$1.error("Disallowed private URL: {url}", {
34
+ url,
35
+ error
36
+ });
37
+ throw error;
38
+ }
39
+ const originalRequest = createActivityPubRequest(url, { userAgent });
40
+ const response = await doubleKnock(originalRequest, identity, {
41
+ specDeterminer,
42
+ log: curry(logRequest)(logger$1),
43
+ tracerProvider,
44
+ signal: options?.signal
45
+ });
46
+ return getRemoteDocument(url, response, load);
47
+ }
48
+ return load;
49
+ }
50
+ const _fetchDocumentLoader = getDocumentLoader();
51
+ const _fetchDocumentLoader_allowPrivateAddress = getDocumentLoader({ allowPrivateAddress: true });
52
+
53
+ //#endregion
54
+ //#region src/utils/kv-cache.ts
55
+ const logger = getLogger([
56
+ "fedify",
57
+ "utils",
58
+ "kv-cache"
59
+ ]);
60
+ /**
61
+ * Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
62
+ * @param parameters The parameters for the cache.
63
+ * @returns The decorated document loader which is cache-enabled.
64
+ */
65
+ function kvCache({ loader, kv, prefix, rules }) {
66
+ const keyPrefix = prefix ?? ["_fedify", "remoteDocument"];
67
+ rules ??= [[new URLPattern({}), Temporal.Duration.from({ minutes: 5 })]];
68
+ for (const [p, duration] of rules) if (Temporal.Duration.compare(duration, { days: 30 }) > 0) throw new TypeError("The maximum cache duration is 30 days: " + (p instanceof URLPattern ? `${p.protocol}://${p.username}:${p.password}@${p.hostname}:${p.port}/${p.pathname}?${p.search}#${p.hash}` : p.toString()));
69
+ return async (url, options) => {
70
+ if (url in preloadedContexts) {
71
+ logger.debug("Using preloaded context: {url}.", { url });
72
+ return {
73
+ contextUrl: null,
74
+ document: preloadedContexts[url],
75
+ documentUrl: url
76
+ };
77
+ }
78
+ const match = matchRule(url, rules);
79
+ if (match == null) return await loader(url, options);
80
+ const key = [...keyPrefix, url];
81
+ let cache = void 0;
82
+ try {
83
+ cache = await kv.get(key);
84
+ } catch (error) {
85
+ if (error instanceof Error) logger.warn("Failed to get the document of {url} from the KV cache: {error}", {
86
+ url,
87
+ error
88
+ });
89
+ }
90
+ if (cache == null) {
91
+ const remoteDoc = await loader(url, options);
92
+ try {
93
+ await kv.set(key, remoteDoc, { ttl: match });
94
+ } catch (error) {
95
+ logger.warn("Failed to save the document of {url} to the KV cache: {error}", {
96
+ url,
97
+ error
98
+ });
99
+ }
100
+ return remoteDoc;
101
+ }
102
+ return cache;
103
+ };
104
+ }
105
+ function matchRule(url, rules) {
106
+ for (const [pattern, duration] of rules) {
107
+ if (typeof pattern === "string") {
108
+ if (url === pattern) return duration;
109
+ continue;
110
+ }
111
+ if (pattern instanceof URL) {
112
+ if (pattern.href == url) return duration;
113
+ continue;
114
+ }
115
+ if (pattern.test(url)) return duration;
116
+ }
117
+ return null;
118
+ }
119
+
120
+ //#endregion
121
+ export { getAuthenticatedDocumentLoader, kvCache };
@@ -0,0 +1,93 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+ globalThis.addEventListener = () => {};
5
+
6
+ import { preloadedContexts } from "@fedify/vocab-runtime";
7
+ import { getLogger } from "@logtape/logtape";
8
+
9
+ //#region src/utils/kv-cache.ts
10
+ const logger = getLogger([
11
+ "fedify",
12
+ "utils",
13
+ "kv-cache"
14
+ ]);
15
+ /**
16
+ * A mock implementation of a key–value store for testing purposes.
17
+ */
18
+ var MockKvStore = class {
19
+ #values = {};
20
+ get(key) {
21
+ return Promise.resolve(this.#values[JSON.stringify(key)]);
22
+ }
23
+ set(key, value, _options) {
24
+ this.#values[JSON.stringify(key)] = value;
25
+ return Promise.resolve();
26
+ }
27
+ async delete(_) {}
28
+ cas(..._) {
29
+ return Promise.resolve(false);
30
+ }
31
+ };
32
+ /**
33
+ * Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
34
+ * @param parameters The parameters for the cache.
35
+ * @returns The decorated document loader which is cache-enabled.
36
+ */
37
+ function kvCache({ loader, kv, prefix, rules }) {
38
+ const keyPrefix = prefix ?? ["_fedify", "remoteDocument"];
39
+ rules ??= [[new URLPattern({}), Temporal.Duration.from({ minutes: 5 })]];
40
+ for (const [p, duration] of rules) if (Temporal.Duration.compare(duration, { days: 30 }) > 0) throw new TypeError("The maximum cache duration is 30 days: " + (p instanceof URLPattern ? `${p.protocol}://${p.username}:${p.password}@${p.hostname}:${p.port}/${p.pathname}?${p.search}#${p.hash}` : p.toString()));
41
+ return async (url, options) => {
42
+ if (url in preloadedContexts) {
43
+ logger.debug("Using preloaded context: {url}.", { url });
44
+ return {
45
+ contextUrl: null,
46
+ document: preloadedContexts[url],
47
+ documentUrl: url
48
+ };
49
+ }
50
+ const match = matchRule(url, rules);
51
+ if (match == null) return await loader(url, options);
52
+ const key = [...keyPrefix, url];
53
+ let cache = void 0;
54
+ try {
55
+ cache = await kv.get(key);
56
+ } catch (error) {
57
+ if (error instanceof Error) logger.warn("Failed to get the document of {url} from the KV cache: {error}", {
58
+ url,
59
+ error
60
+ });
61
+ }
62
+ if (cache == null) {
63
+ const remoteDoc = await loader(url, options);
64
+ try {
65
+ await kv.set(key, remoteDoc, { ttl: match });
66
+ } catch (error) {
67
+ logger.warn("Failed to save the document of {url} to the KV cache: {error}", {
68
+ url,
69
+ error
70
+ });
71
+ }
72
+ return remoteDoc;
73
+ }
74
+ return cache;
75
+ };
76
+ }
77
+ function matchRule(url, rules) {
78
+ for (const [pattern, duration] of rules) {
79
+ if (typeof pattern === "string") {
80
+ if (url === pattern) return duration;
81
+ continue;
82
+ }
83
+ if (pattern instanceof URL) {
84
+ if (pattern.href == url) return duration;
85
+ continue;
86
+ }
87
+ if (pattern.test(url)) return duration;
88
+ }
89
+ return null;
90
+ }
91
+
92
+ //#endregion
93
+ export { MockKvStore, kvCache };
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, CryptographicKey, Object as Object$1, deno_default, getTypeId } from "./lookup-Bep-EOgr.js";
7
- import { fetchKey, validateCryptoKey } from "./key-De1MJH3k.js";
6
+ import { Activity, CryptographicKey, Object as Object$1, deno_default, getTypeId } from "./lookup-Bp3gBRGD.js";
7
+ import { fetchKey, validateCryptoKey } from "./key-CLBIsQ2b.js";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { SpanStatusCode, trace } from "@opentelemetry/api";