@fedify/fedify 1.8.1-pr.350.1285 → 1.8.1

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 (102) hide show
  1. package/README.md +2 -0
  2. package/dist/{actor-CaMRRcub.js → actor-BDPKTUai.js} +179 -179
  3. package/dist/{actor-D_mYtQ--.js → actor-CLRQDEV9.js} +1 -1
  4. package/dist/{actor-C2nhWp6O.d.ts → actor-Uh1YDuVl.d.ts} +2 -2
  5. package/dist/{authdocloader-CQh4IJfT.js → authdocloader-BBwf1_f7.js} +6 -5
  6. package/dist/{authdocloader-K0Peq1hX.js → authdocloader-C2mtQBvn.js} +6 -5
  7. package/dist/{builder-fPWs-TI4.js → builder-C2kEWQ9P.js} +4 -4
  8. package/dist/{client-D2tgjFk3.d.ts → client-DF8anIB5.d.ts} +1 -1
  9. package/dist/{client-9cPnAibf.js → client-DQZ4AQIk.js} +1 -1
  10. package/dist/compat/mod.d.ts +10 -10
  11. package/dist/compat/transformers.test.js +16 -16
  12. package/dist/{context-BBD2ZH_P.d.ts → context-CnveeHUR.d.ts} +8 -8
  13. package/dist/{docloader-Bz56sKV5.d.ts → docloader-CxWcuWqQ.d.ts} +14 -1
  14. package/dist/{docloader-BBtyRca1.js → docloader-Dvsvkvlo.js} +23 -27
  15. package/dist/{esm-QBbiQNo4.js → esm-BWVigQCO.js} +1 -1
  16. package/dist/federation/builder.test.js +5 -5
  17. package/dist/federation/collection.test.js +3 -3
  18. package/dist/federation/handler.test.js +17 -17
  19. package/dist/federation/inbox.test.js +4 -4
  20. package/dist/federation/keycache.test.js +4 -4
  21. package/dist/federation/kv.test.js +3 -3
  22. package/dist/federation/middleware.test.js +18 -18
  23. package/dist/federation/mod.d.ts +9 -9
  24. package/dist/federation/mod.js +10 -10
  25. package/dist/federation/mq.test.js +3 -3
  26. package/dist/federation/retry.test.js +3 -3
  27. package/dist/federation/router.test.js +3 -3
  28. package/dist/federation/send.test.js +10 -10
  29. package/dist/{http-B0NkMLuT.js → http-Cdw1rmQb.js} +11 -5
  30. package/dist/{http-DWJVfkyZ.js → http-CgMHCKJe.js} +12 -6
  31. package/dist/{http-l4uEvaAw.d.ts → http-DtG44GdM.d.ts} +2 -2
  32. package/dist/{inbox-B1nIxc0q.js → inbox-CvnAgO-D.js} +1 -1
  33. package/dist/{key-BDCSCae-.js → key-C5L8OQYQ.js} +3 -3
  34. package/dist/{key-BRl4AtNh.js → key-CK11m7Rs.js} +2 -2
  35. package/dist/{key-CKINuzqT.js → key-CuoSylWi.js} +4 -4
  36. package/dist/{key-Bpdjmig5.js → key-I8MiG9nK.js} +2 -2
  37. package/dist/{keycache-CoDCGPU_.js → keycache-Z0xx1tPQ.js} +1 -1
  38. package/dist/{keys--rBfRBtT.js → keys-Ddyoaf_e.js} +1 -1
  39. package/dist/{ld-C3oVh0YJ.js → ld-DTtWNgiE.js} +2 -2
  40. package/dist/{lookup-BJelGpWr.d.ts → lookup-3czM5mmU.d.ts} +7 -1
  41. package/dist/{lookup-BLwnybnA.js → lookup-BBjrfjI5.js} +5 -4
  42. package/dist/{lookup-BxBwlMQM.js → lookup-nB-tCGVP.js} +3 -2
  43. package/dist/middleware-BQe2VdJO.js +26 -0
  44. package/dist/middleware-DOSupjKJ.js +17 -0
  45. package/dist/{middleware-KK44603T.js → middleware-DScUEBAy.js} +10 -10
  46. package/dist/{middleware-hQ-rKnGR.js → middleware-TVCxZbNW.js} +13 -13
  47. package/dist/{mod-DDwnlIlm.d.ts → mod-DPpunL8j.d.ts} +2 -2
  48. package/dist/{mod-D79SaXL-.d.ts → mod-cz-tNIqP.d.ts} +7 -2
  49. package/dist/{mod-DM7ZpXF4.d.ts → mod-mSMqo9JU.d.ts} +2 -2
  50. package/dist/{mod-DwquBB1g.d.ts → mod-tQVUxQ_D.d.ts} +3 -3
  51. package/dist/mod.d.ts +12 -12
  52. package/dist/mod.js +10 -10
  53. package/dist/nodeinfo/client.test.js +5 -5
  54. package/dist/nodeinfo/handler.test.js +16 -16
  55. package/dist/nodeinfo/mod.d.ts +2 -2
  56. package/dist/nodeinfo/mod.js +2 -2
  57. package/dist/nodeinfo/semver.test.js +3 -3
  58. package/dist/nodeinfo/types.test.js +3 -3
  59. package/dist/{owner-fFqUg4lq.d.ts → owner-C12klfeG.d.ts} +3 -3
  60. package/dist/{owner-D42JugRm.js → owner-H5ZC_lkd.js} +2 -2
  61. package/dist/{proof-wEvE3AbS.js → proof-Chg3ytBc.js} +3 -3
  62. package/dist/{proof-CIm_fnDK.js → proof-De02H0W-.js} +2 -2
  63. package/dist/runtime/authdocloader.test.js +49 -9
  64. package/dist/runtime/docloader.test.js +60 -4
  65. package/dist/runtime/key.test.js +5 -5
  66. package/dist/runtime/langstr.test.js +3 -3
  67. package/dist/runtime/mod.d.ts +4 -4
  68. package/dist/runtime/mod.js +6 -6
  69. package/dist/runtime/multibase/multibase.test.js +3 -3
  70. package/dist/runtime/url.test.js +3 -3
  71. package/dist/{send-BRA7aMRV.js → send-CL5-bPSf.js} +2 -2
  72. package/dist/sig/http.test.js +51 -9
  73. package/dist/sig/key.test.js +6 -6
  74. package/dist/sig/ld.test.js +7 -7
  75. package/dist/sig/mod.d.ts +6 -6
  76. package/dist/sig/mod.js +6 -6
  77. package/dist/sig/owner.test.js +7 -7
  78. package/dist/sig/proof.test.js +7 -7
  79. package/dist/testing/docloader.test.js +3 -3
  80. package/dist/testing/mod.d.ts +24 -1
  81. package/dist/testing/mod.js +3 -3
  82. package/dist/{testing-C7zAnwt8.js → testing-BVNNmwCi.js} +3 -3
  83. package/dist/{type-gkozZs_Y.js → type-iB-6GI3W.js} +202 -205
  84. package/dist/{types-YGkwBxol.js → types-mbUbOJzp.js} +1 -1
  85. package/dist/vocab/actor.test.js +5 -5
  86. package/dist/vocab/lookup.test.js +98 -6
  87. package/dist/vocab/mod.d.ts +4 -4
  88. package/dist/vocab/mod.js +4 -4
  89. package/dist/vocab/type.test.js +3 -3
  90. package/dist/vocab/vocab.test.js +4 -4
  91. package/dist/{vocab-DQ4SEIWh.js → vocab-Bpo_epAX.js} +7 -6
  92. package/dist/{vocab-CA7YwVEz.d.ts → vocab-Ukxjz3TM.d.ts} +1 -1
  93. package/dist/webfinger/handler.test.js +16 -16
  94. package/dist/webfinger/lookup.test.js +58 -4
  95. package/dist/webfinger/mod.d.ts +2 -2
  96. package/dist/webfinger/mod.js +2 -2
  97. package/dist/x/cfworkers.test.js +3 -3
  98. package/dist/x/hono.d.ts +9 -9
  99. package/dist/x/sveltekit.d.ts +9 -9
  100. package/package.json +1 -1
  101. package/dist/middleware-BEG0MAZG.js +0 -26
  102. package/dist/middleware-BtSPPgam.js +0 -17
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Application, Group, Organization, Person, Service, deno_default, getTypeId, lookupWebFinger } from "./type-gkozZs_Y.js";
6
+ import { Application, Group, Organization, Person, Service, deno_default, getTypeId, lookupWebFinger } from "./type-iB-6GI3W.js";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { domainToASCII, domainToUnicode } from "node:url";
9
9
 
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { GetUserAgentOptions } from "./docloader-Bz56sKV5.js";
4
- import { Application, Group, Organization, Person, Service } from "./vocab-CA7YwVEz.js";
3
+ import { GetUserAgentOptions } from "./docloader-CxWcuWqQ.js";
4
+ import { Application, Group, Organization, Person, Service } from "./vocab-Ukxjz3TM.js";
5
5
  import { TracerProvider } from "@opentelemetry/api";
6
6
 
7
7
  //#region src/vocab/actor.d.ts
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./type-gkozZs_Y.js";
7
- import { validateCryptoKey } from "./key-Bpdjmig5.js";
8
- import { doubleKnock } from "./http-B0NkMLuT.js";
6
+ import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./type-iB-6GI3W.js";
7
+ import { validateCryptoKey } from "./key-I8MiG9nK.js";
8
+ import { doubleKnock } from "./http-Cdw1rmQb.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
 
11
11
  //#region src/runtime/authdocloader.ts
@@ -27,7 +27,7 @@ const logger = getLogger([
27
27
  */
28
28
  function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAgent, specDeterminer, tracerProvider } = {}) {
29
29
  validateCryptoKey(identity.privateKey);
30
- async function load(url) {
30
+ async function load(url, options) {
31
31
  if (!allowPrivateAddress) try {
32
32
  await validatePublicUrl(url);
33
33
  } catch (error) {
@@ -41,7 +41,8 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
41
41
  const response = await doubleKnock(originalRequest, identity, {
42
42
  specDeterminer,
43
43
  log: logRequest,
44
- tracerProvider
44
+ tracerProvider,
45
+ signal: options?.signal
45
46
  });
46
47
  return getRemoteDocument(url, response, load);
47
48
  }
@@ -2,9 +2,9 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-BBtyRca1.js";
6
- import { validateCryptoKey } from "./key-BRl4AtNh.js";
7
- import { doubleKnock } from "./http-DWJVfkyZ.js";
5
+ import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-Dvsvkvlo.js";
6
+ import { validateCryptoKey } from "./key-CK11m7Rs.js";
7
+ import { doubleKnock } from "./http-CgMHCKJe.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
 
10
10
  //#region src/runtime/authdocloader.ts
@@ -26,7 +26,7 @@ const logger = getLogger([
26
26
  */
27
27
  function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAgent, specDeterminer, tracerProvider } = {}) {
28
28
  validateCryptoKey(identity.privateKey);
29
- async function load(url) {
29
+ async function load(url, options) {
30
30
  if (!allowPrivateAddress) try {
31
31
  await validatePublicUrl(url);
32
32
  } catch (error) {
@@ -40,7 +40,8 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
40
40
  const response = await doubleKnock(originalRequest, identity, {
41
41
  specDeterminer,
42
42
  log: logRequest,
43
- tracerProvider
43
+ tracerProvider,
44
+ signal: options?.signal
44
45
  });
45
46
  return getRemoteDocument(url, response, load);
46
47
  }
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default, getTypeId } from "./type-gkozZs_Y.js";
7
- import { Router, RouterError } from "./lookup-BLwnybnA.js";
8
- import { InboxListenerSet } from "./inbox-B1nIxc0q.js";
6
+ import { deno_default, getTypeId } from "./type-iB-6GI3W.js";
7
+ import { Router, RouterError } from "./lookup-BBjrfjI5.js";
8
+ import { InboxListenerSet } from "./inbox-CvnAgO-D.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
11
11
 
@@ -41,7 +41,7 @@ var FederationBuilderImpl = class {
41
41
  this.collectionTypeIds = {};
42
42
  }
43
43
  async build(options) {
44
- const { FederationImpl } = await import("./middleware-BEG0MAZG.js");
44
+ const { FederationImpl } = await import("./middleware-BQe2VdJO.js");
45
45
  const f = new FederationImpl(options);
46
46
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
47
47
  f.router = this.router.clone();
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { GetUserAgentOptions } from "./docloader-Bz56sKV5.js";
3
+ import { GetUserAgentOptions } from "./docloader-CxWcuWqQ.js";
4
4
 
5
5
  //#region src/nodeinfo/semver.d.ts
6
6
  /**
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { getUserAgent } from "./type-gkozZs_Y.js";
6
+ import { getUserAgent } from "./type-iB-6GI3W.js";
7
7
  import { parseSemVer } from "./semver-dArNLkR9.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
 
@@ -1,15 +1,15 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import "../kv-C7sopW2E.js";
4
- import "../docloader-Bz56sKV5.js";
5
- import "../client-D2tgjFk3.js";
6
- import "../vocab-CA7YwVEz.js";
7
- import "../actor-C2nhWp6O.js";
8
- import "../http-l4uEvaAw.js";
9
- import "../owner-fFqUg4lq.js";
10
- import "../mod-D79SaXL-.js";
11
- import "../lookup-BJelGpWr.js";
12
- import { ActivityTransformer } from "../context-BBD2ZH_P.js";
4
+ import "../docloader-CxWcuWqQ.js";
5
+ import "../client-DF8anIB5.js";
6
+ import "../vocab-Ukxjz3TM.js";
7
+ import "../actor-Uh1YDuVl.js";
8
+ import "../http-DtG44GdM.js";
9
+ import "../owner-C12klfeG.js";
10
+ import "../mod-cz-tNIqP.js";
11
+ import "../lookup-3czM5mmU.js";
12
+ import { ActivityTransformer } from "../context-CnveeHUR.js";
13
13
  import "../mq-CRGm1e_F.js";
14
- import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-DDwnlIlm.js";
14
+ import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-DPpunL8j.js";
15
15
  export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
@@ -3,30 +3,30 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Follow, Person } from "../type-gkozZs_Y.js";
6
+ import { Follow, Person } from "../type-iB-6GI3W.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-CRZrzyXm.js";
11
- import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-hQ-rKnGR.js";
11
+ import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-TVCxZbNW.js";
12
12
  import "../semver-dArNLkR9.js";
13
- import "../client-9cPnAibf.js";
14
- import "../lookup-BLwnybnA.js";
13
+ import "../client-DQZ4AQIk.js";
14
+ import "../lookup-BBjrfjI5.js";
15
15
  import "../types-BIgY6c-l.js";
16
- import "../actor-D_mYtQ--.js";
17
- import "../key-Bpdjmig5.js";
18
- import "../http-B0NkMLuT.js";
19
- import "../authdocloader-CQh4IJfT.js";
20
- import "../ld-C3oVh0YJ.js";
21
- import "../owner-D42JugRm.js";
22
- import "../proof-CIm_fnDK.js";
23
- import "../inbox-B1nIxc0q.js";
24
- import "../builder-fPWs-TI4.js";
16
+ import "../actor-CLRQDEV9.js";
17
+ import "../key-I8MiG9nK.js";
18
+ import "../http-Cdw1rmQb.js";
19
+ import "../authdocloader-BBwf1_f7.js";
20
+ import "../ld-DTtWNgiE.js";
21
+ import "../owner-H5ZC_lkd.js";
22
+ import "../proof-De02H0W-.js";
23
+ import "../inbox-CvnAgO-D.js";
24
+ import "../builder-C2kEWQ9P.js";
25
25
  import "../collection-CSzG2j1P.js";
26
- import "../keycache-CoDCGPU_.js";
26
+ import "../keycache-Z0xx1tPQ.js";
27
27
  import "../retry-D4GJ670a.js";
28
- import "../send-BRA7aMRV.js";
29
- import { test } from "../testing-C7zAnwt8.js";
28
+ import "../send-CL5-bPSf.js";
29
+ import { test } from "../testing-BVNNmwCi.js";
30
30
 
31
31
  //#region src/compat/transformers.test.ts
32
32
  const federation = new FederationImpl({ kv: new MemoryKvStore() });
@@ -1,14 +1,14 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { KvKey, KvStore } from "./kv-C7sopW2E.js";
4
- import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "./docloader-Bz56sKV5.js";
5
- import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-D2tgjFk3.js";
6
- import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-CA7YwVEz.js";
7
- import { Actor, Recipient } from "./actor-C2nhWp6O.js";
8
- import { HttpMessageSignaturesSpec } from "./http-l4uEvaAw.js";
9
- import { GetKeyOwnerOptions } from "./owner-fFqUg4lq.js";
10
- import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-D79SaXL-.js";
11
- import { LookupWebFingerOptions, ResourceDescriptor } from "./lookup-BJelGpWr.js";
4
+ import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "./docloader-CxWcuWqQ.js";
5
+ import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-DF8anIB5.js";
6
+ import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-Ukxjz3TM.js";
7
+ import { Actor, Recipient } from "./actor-Uh1YDuVl.js";
8
+ import { HttpMessageSignaturesSpec } from "./http-DtG44GdM.js";
9
+ import { GetKeyOwnerOptions } from "./owner-C12klfeG.js";
10
+ import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-cz-tNIqP.js";
11
+ import { LookupWebFingerOptions, ResourceDescriptor } from "./lookup-3czM5mmU.js";
12
12
  import { MessageQueue } from "./mq-CRGm1e_F.js";
13
13
  import { Span, TracerProvider } from "@opentelemetry/api";
14
14
 
@@ -21,12 +21,24 @@ interface RemoteDocument {
21
21
  */
22
22
  documentUrl: string;
23
23
  }
24
+ /**
25
+ * Options for {@link DocumentLoader}.
26
+ * @since 1.8.0
27
+ */
28
+ interface DocumentLoaderOptions {
29
+ /**
30
+ * An `AbortSignal` for cancellation.
31
+ * @since 1.8.0
32
+ */
33
+ signal?: AbortSignal;
34
+ }
24
35
  /**
25
36
  * A JSON-LD document loader that fetches documents from the Web.
26
37
  * @param url The URL of the document to load.
38
+ * @param options The options for the document loader.
27
39
  * @returns The loaded remote document.
28
40
  */
29
- type DocumentLoader = (url: string) => Promise<RemoteDocument>;
41
+ type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
30
42
  /**
31
43
  * A factory function that creates a {@link DocumentLoader} with options.
32
44
  * @param options The options for the document loader.
@@ -140,6 +152,7 @@ declare function getDocumentLoader({
140
152
  * @deprecated Use {@link getDocumentLoader} instead.
141
153
  */
142
154
  declare function fetchDocumentLoader(url: string, allowPrivateAddress?: boolean): Promise<RemoteDocument>;
155
+ declare function fetchDocumentLoader(url: string, options?: DocumentLoaderOptions): Promise<RemoteDocument>;
143
156
  /**
144
157
  * The parameters for {@link kvCache} function.
145
158
  */
@@ -10,7 +10,7 @@ import { isIP } from "node:net";
10
10
 
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "1.8.1-pr.350.1285+2f8c4b37";
13
+ var version = "1.8.1";
14
14
  var license = "MIT";
15
15
  var exports = {
16
16
  ".": "./src/mod.ts",
@@ -4465,7 +4465,8 @@ async function getRemoteDocument(url, response, fetch$1) {
4465
4465
  * @since 1.3.0
4466
4466
  */
4467
4467
  function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAgent } = {}) {
4468
- async function load(url) {
4468
+ async function load(url, options) {
4469
+ options?.signal?.throwIfAborted();
4469
4470
  if (!skipPreloadedContexts && url in contexts_default) {
4470
4471
  logger.debug("Using preloaded context: {url}.", { url });
4471
4472
  return {
@@ -4485,35 +4486,22 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
4485
4486
  }
4486
4487
  const request = createRequest(url, { userAgent });
4487
4488
  logRequest(request);
4488
- const response = await fetch(request, { redirect: "manual" });
4489
- if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return load(response.headers.get("Location"));
4489
+ const response = await fetch(request, {
4490
+ redirect: "manual",
4491
+ signal: options?.signal
4492
+ });
4493
+ if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return load(response.headers.get("Location"), options);
4490
4494
  return getRemoteDocument(url, response, load);
4491
4495
  }
4492
4496
  return load;
4493
4497
  }
4494
4498
  const _fetchDocumentLoader = getDocumentLoader();
4495
4499
  const _fetchDocumentLoader_allowPrivateAddress = getDocumentLoader({ allowPrivateAddress: true });
4496
- /**
4497
- * A JSON-LD document loader that utilizes the browser's `fetch` API.
4498
- *
4499
- * This loader preloads the below frequently used contexts:
4500
- *
4501
- * - <https://www.w3.org/ns/activitystreams>
4502
- * - <https://w3id.org/security/v1>
4503
- * - <https://w3id.org/security/data-integrity/v1>
4504
- * - <https://www.w3.org/ns/did/v1>
4505
- * - <https://w3id.org/security/multikey/v1>
4506
- * - <https://purl.archive.org/socialweb/webfinger>
4507
- * - <http://schema.org/>
4508
- * @param url The URL of the document to load.
4509
- * @param allowPrivateAddress Whether to allow fetching private network
4510
- * addresses. Turned off by default.
4511
- * @returns The remote document.
4512
- * @deprecated Use {@link getDocumentLoader} instead.
4513
- */
4514
- function fetchDocumentLoader(url, allowPrivateAddress = false) {
4500
+ function fetchDocumentLoader(url, arg = false) {
4501
+ const allowPrivateAddress = typeof arg === "boolean" ? arg : false;
4515
4502
  logger.warn("fetchDocumentLoader() function is deprecated. Use getDocumentLoader() function instead.");
4516
- return (allowPrivateAddress ? _fetchDocumentLoader_allowPrivateAddress : _fetchDocumentLoader)(url);
4503
+ const loader = allowPrivateAddress ? _fetchDocumentLoader_allowPrivateAddress : _fetchDocumentLoader;
4504
+ return loader(url);
4517
4505
  }
4518
4506
  /**
4519
4507
  * Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
@@ -4538,9 +4526,17 @@ function kvCache({ loader, kv, prefix, rules }) {
4538
4526
  }
4539
4527
  return null;
4540
4528
  }
4541
- return async (url) => {
4529
+ return async (url, options) => {
4530
+ if (url in contexts_default) {
4531
+ logger.debug("Using preloaded context: {url}.", { url });
4532
+ return {
4533
+ contextUrl: null,
4534
+ document: contexts_default[url],
4535
+ documentUrl: url
4536
+ };
4537
+ }
4542
4538
  const match = matchRule(url);
4543
- if (match == null) return await loader(url);
4539
+ if (match == null) return await loader(url, options);
4544
4540
  const key = [...keyPrefix, url];
4545
4541
  let cache = void 0;
4546
4542
  try {
@@ -4552,7 +4548,7 @@ function kvCache({ loader, kv, prefix, rules }) {
4552
4548
  });
4553
4549
  }
4554
4550
  if (cache == null) {
4555
- const remoteDoc = await loader(url);
4551
+ const remoteDoc = await loader(url, options);
4556
4552
  try {
4557
4553
  await kv.set(key, remoteDoc, { ttl: match });
4558
4554
  } catch (error) {
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { __commonJS, __toESM } from "./type-gkozZs_Y.js";
6
+ import { __commonJS, __toESM } from "./type-iB-6GI3W.js";
7
7
 
8
8
  //#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
9
9
  var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js"(exports, module) {
@@ -3,16 +3,16 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, Note, Person } from "../type-gkozZs_Y.js";
6
+ import { Activity, Note, Person } from "../type-iB-6GI3W.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-CRZrzyXm.js";
11
11
  import { parseSemVer } from "../semver-dArNLkR9.js";
12
- import "../lookup-BLwnybnA.js";
13
- import "../inbox-B1nIxc0q.js";
14
- import { createFederationBuilder } from "../builder-fPWs-TI4.js";
15
- import { test } from "../testing-C7zAnwt8.js";
12
+ import "../lookup-BBjrfjI5.js";
13
+ import "../inbox-CvnAgO-D.js";
14
+ import { createFederationBuilder } from "../builder-C2kEWQ9P.js";
15
+ import { test } from "../testing-BVNNmwCi.js";
16
16
  import { assertExists } from "../std__assert-X-_kMxKM.js";
17
17
  import "../assert_rejects-DiIiJbZn.js";
18
18
  import "../assert_is_error-BPGph1Jx.js";
@@ -3,13 +3,13 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../type-gkozZs_Y.js";
6
+ import "../type-iB-6GI3W.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
- import "../lookup-BLwnybnA.js";
10
+ import "../lookup-BBjrfjI5.js";
11
11
  import { buildCollectionSynchronizationHeader, digest } from "../collection-CSzG2j1P.js";
12
- import { test } from "../testing-C7zAnwt8.js";
12
+ import { test } from "../testing-BVNNmwCi.js";
13
13
  import "../std__assert-X-_kMxKM.js";
14
14
  import "../assert_rejects-DiIiJbZn.js";
15
15
  import "../assert_is_error-BPGph1Jx.js";
@@ -3,36 +3,36 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Create, Note, Person } from "../type-gkozZs_Y.js";
6
+ import { Create, Note, Person } from "../type-iB-6GI3W.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
10
  import { MemoryKvStore } from "../kv-CRZrzyXm.js";
11
- import { acceptsJsonLd, createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-hQ-rKnGR.js";
11
+ import { acceptsJsonLd, createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-TVCxZbNW.js";
12
12
  import "../semver-dArNLkR9.js";
13
- import "../client-9cPnAibf.js";
14
- import "../lookup-BLwnybnA.js";
13
+ import "../client-DQZ4AQIk.js";
14
+ import "../lookup-BBjrfjI5.js";
15
15
  import "../types-BIgY6c-l.js";
16
- import "../actor-D_mYtQ--.js";
17
- import "../key-Bpdjmig5.js";
18
- import { signRequest } from "../http-B0NkMLuT.js";
19
- import "../authdocloader-CQh4IJfT.js";
20
- import "../ld-C3oVh0YJ.js";
21
- import "../owner-D42JugRm.js";
22
- import "../proof-CIm_fnDK.js";
23
- import "../inbox-B1nIxc0q.js";
24
- import "../builder-fPWs-TI4.js";
16
+ import "../actor-CLRQDEV9.js";
17
+ import "../key-I8MiG9nK.js";
18
+ import { signRequest } from "../http-Cdw1rmQb.js";
19
+ import "../authdocloader-BBwf1_f7.js";
20
+ import "../ld-DTtWNgiE.js";
21
+ import "../owner-H5ZC_lkd.js";
22
+ import "../proof-De02H0W-.js";
23
+ import "../inbox-CvnAgO-D.js";
24
+ import "../builder-C2kEWQ9P.js";
25
25
  import "../collection-CSzG2j1P.js";
26
- import "../keycache-CoDCGPU_.js";
26
+ import "../keycache-Z0xx1tPQ.js";
27
27
  import "../retry-D4GJ670a.js";
28
- import "../send-BRA7aMRV.js";
29
- import { createInboxContext, createRequestContext, mockDocumentLoader, test } from "../testing-C7zAnwt8.js";
28
+ import "../send-CL5-bPSf.js";
29
+ import { createInboxContext, createRequestContext, mockDocumentLoader, test } from "../testing-BVNNmwCi.js";
30
30
  import "../std__assert-X-_kMxKM.js";
31
31
  import { assertFalse } from "../assert_rejects-DiIiJbZn.js";
32
32
  import "../assert_is_error-BPGph1Jx.js";
33
33
  import "../assert_not_equals-f3m3epl3.js";
34
34
  import "../assert_throws-BOO88avQ.js";
35
- import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys--rBfRBtT.js";
35
+ import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-Ddyoaf_e.js";
36
36
 
37
37
  //#region src/federation/handler.test.ts
38
38
  test("acceptsJsonLd()", () => {
@@ -3,11 +3,11 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, Create, Invite, Offer, Update } from "../type-gkozZs_Y.js";
6
+ import { Activity, Create, Invite, Offer, Update } from "../type-iB-6GI3W.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
- import "../lookup-BLwnybnA.js";
9
- import { InboxListenerSet } from "../inbox-B1nIxc0q.js";
10
- import { test } from "../testing-C7zAnwt8.js";
8
+ import "../lookup-BBjrfjI5.js";
9
+ import { InboxListenerSet } from "../inbox-CvnAgO-D.js";
10
+ import { test } from "../testing-BVNNmwCi.js";
11
11
  import "../assert_is_error-BPGph1Jx.js";
12
12
  import { assertThrows } from "../assert_throws-BOO88avQ.js";
13
13
 
@@ -3,14 +3,14 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { CryptographicKey, Multikey } from "../type-gkozZs_Y.js";
6
+ import { CryptographicKey, Multikey } from "../type-iB-6GI3W.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-CRZrzyXm.js";
11
- import "../lookup-BLwnybnA.js";
12
- import { KvKeyCache } from "../keycache-CoDCGPU_.js";
13
- import { test } from "../testing-C7zAnwt8.js";
11
+ import "../lookup-BBjrfjI5.js";
12
+ import { KvKeyCache } from "../keycache-Z0xx1tPQ.js";
13
+ import { test } from "../testing-BVNNmwCi.js";
14
14
 
15
15
  //#region src/federation/keycache.test.ts
16
16
  test("KvKeyCache.set()", async () => {
@@ -3,13 +3,13 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../type-gkozZs_Y.js";
6
+ import "../type-iB-6GI3W.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-CRZrzyXm.js";
11
- import "../lookup-BLwnybnA.js";
12
- import { test } from "../testing-C7zAnwt8.js";
11
+ import "../lookup-BBjrfjI5.js";
12
+ import { test } from "../testing-BVNNmwCi.js";
13
13
  import "../std__assert-X-_kMxKM.js";
14
14
  import "../assert_rejects-DiIiJbZn.js";
15
15
  import "../assert_is_error-BPGph1Jx.js";
@@ -3,37 +3,37 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, Announce, Create, FetchError, Invite, Multikey, Note, Object as Object$1, Offer, Person, fetchDocumentLoader, getTypeId } from "../type-gkozZs_Y.js";
6
+ import { Activity, Announce, Create, FetchError, Invite, Multikey, Note, Object as Object$1, Offer, Person, fetchDocumentLoader, getTypeId } from "../type-iB-6GI3W.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-CRZrzyXm.js";
11
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "../middleware-hQ-rKnGR.js";
11
+ import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "../middleware-TVCxZbNW.js";
12
12
  import "../semver-dArNLkR9.js";
13
- import "../client-9cPnAibf.js";
14
- import { RouterError, lookupObject } from "../lookup-BLwnybnA.js";
13
+ import "../client-DQZ4AQIk.js";
14
+ import { RouterError, lookupObject } from "../lookup-BBjrfjI5.js";
15
15
  import "../types-BIgY6c-l.js";
16
- import "../actor-D_mYtQ--.js";
17
- import "../key-Bpdjmig5.js";
18
- import { signRequest, verifyRequest } from "../http-B0NkMLuT.js";
19
- import { getAuthenticatedDocumentLoader } from "../authdocloader-CQh4IJfT.js";
20
- import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-C3oVh0YJ.js";
21
- import { doesActorOwnKey } from "../owner-D42JugRm.js";
22
- import { signObject, verifyObject } from "../proof-CIm_fnDK.js";
23
- import "../inbox-B1nIxc0q.js";
24
- import "../builder-fPWs-TI4.js";
16
+ import "../actor-CLRQDEV9.js";
17
+ import "../key-I8MiG9nK.js";
18
+ import { signRequest, verifyRequest } from "../http-Cdw1rmQb.js";
19
+ import { getAuthenticatedDocumentLoader } from "../authdocloader-BBwf1_f7.js";
20
+ import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-DTtWNgiE.js";
21
+ import { doesActorOwnKey } from "../owner-H5ZC_lkd.js";
22
+ import { signObject, verifyObject } from "../proof-De02H0W-.js";
23
+ import "../inbox-CvnAgO-D.js";
24
+ import "../builder-C2kEWQ9P.js";
25
25
  import "../collection-CSzG2j1P.js";
26
- import "../keycache-CoDCGPU_.js";
26
+ import "../keycache-Z0xx1tPQ.js";
27
27
  import "../retry-D4GJ670a.js";
28
- import "../send-BRA7aMRV.js";
29
- import { mockDocumentLoader, test } from "../testing-C7zAnwt8.js";
28
+ import "../send-CL5-bPSf.js";
29
+ import { mockDocumentLoader, test } from "../testing-BVNNmwCi.js";
30
30
  import { assertStrictEquals } from "../std__assert-X-_kMxKM.js";
31
31
  import { assertFalse, assertRejects } from "../assert_rejects-DiIiJbZn.js";
32
32
  import "../assert_is_error-BPGph1Jx.js";
33
33
  import { assertNotEquals } from "../assert_not_equals-f3m3epl3.js";
34
34
  import { assertThrows } from "../assert_throws-BOO88avQ.js";
35
- import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys--rBfRBtT.js";
36
- import { esm_default } from "../esm-QBbiQNo4.js";
35
+ import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-Ddyoaf_e.js";
36
+ import { esm_default } from "../esm-BWVigQCO.js";
37
37
 
38
38
  //#region src/testing/fixtures/example.com/person.json
39
39
  var __context$1 = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"];
@@ -1,15 +1,15 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-C7sopW2E.js";
4
- import "../docloader-Bz56sKV5.js";
5
- import "../client-D2tgjFk3.js";
6
- import "../vocab-CA7YwVEz.js";
7
- import "../actor-C2nhWp6O.js";
8
- import "../http-l4uEvaAw.js";
9
- import "../owner-fFqUg4lq.js";
10
- import "../mod-D79SaXL-.js";
11
- import "../lookup-BJelGpWr.js";
12
- import { 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, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParamsKeyPath, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-BBD2ZH_P.js";
4
+ import "../docloader-CxWcuWqQ.js";
5
+ import "../client-DF8anIB5.js";
6
+ import "../vocab-Ukxjz3TM.js";
7
+ import "../actor-Uh1YDuVl.js";
8
+ import "../http-DtG44GdM.js";
9
+ import "../owner-C12klfeG.js";
10
+ import "../mod-cz-tNIqP.js";
11
+ import "../lookup-3czM5mmU.js";
12
+ import { 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, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParamsKeyPath, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-CnveeHUR.js";
13
13
  import { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue } from "../mq-CRGm1e_F.js";
14
14
  import "../mod-g0xFzAP9.js";
15
15
  export { 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, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParamsKeyPath, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };