@fedify/fedify 2.0.1 → 2.0.2-dev.415

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 (98) hide show
  1. package/dist/{builder-CqPrSnE5.js → builder-B55ClH_D.js} +3 -3
  2. package/dist/client-BxMZiQaD.d.ts +224 -0
  3. package/dist/client-C97KOq3x.d.cts +222 -0
  4. package/dist/compat/mod.d.cts +6 -6
  5. package/dist/compat/mod.d.ts +6 -6
  6. package/dist/compat/transformers.test.js +11 -11
  7. package/dist/context-D3QkEtZd.d.cts +2494 -0
  8. package/dist/context-DZJhUmzF.d.ts +2496 -0
  9. package/dist/{deno-CIi8RNND.js → deno-D-Duks4b.js} +1 -1
  10. package/dist/{docloader-CmrEfaGw.js → docloader-Bb4MhBYJ.js} +2 -2
  11. package/dist/federation/builder.test.js +3 -3
  12. package/dist/federation/handler.test.js +19 -19
  13. package/dist/federation/idempotency.test.js +11 -11
  14. package/dist/federation/inbox.test.js +2 -2
  15. package/dist/federation/middleware.test.js +11 -11
  16. package/dist/federation/mod.cjs +4 -4
  17. package/dist/federation/mod.d.cts +6 -6
  18. package/dist/federation/mod.d.ts +6 -6
  19. package/dist/federation/mod.js +4 -4
  20. package/dist/federation/send.test.js +5 -5
  21. package/dist/federation/webfinger.test.js +11 -11
  22. package/dist/{http-CCsNu78I.js → http-C3ipH_7H.js} +1 -1
  23. package/dist/http-Cz3MlXAZ.d.cts +244 -0
  24. package/dist/{http-BjroyS-9.cjs → http-DGYGS8C8.cjs} +1 -1
  25. package/dist/http-DkHdFfrc.d.ts +246 -0
  26. package/dist/{http-Dvox_xrq.js → http-DnP0rGKj.js} +2 -2
  27. package/dist/{inbox-CiTdVhJQ.js → inbox-CbNZlhe6.js} +1 -1
  28. package/dist/{key-C7JS89OH.js → key-DChkqRrm.js} +1 -1
  29. package/dist/kv-BL4nlICN.d.cts +110 -0
  30. package/dist/kv-DXEUEP6z.d.ts +113 -0
  31. package/dist/{kv-cache-BqFnozz0.cjs → kv-cache-Bd2z9in6.cjs} +1 -1
  32. package/dist/{kv-cache-6b2ldIo-.js → kv-cache-CFQBoGCe.js} +1 -1
  33. package/dist/{ld-C8i1kViF.js → ld-CR9Xg8mN.js} +2 -2
  34. package/dist/{middleware-DqJ1cmZE.cjs → middleware-B1XHFs0D.cjs} +8 -83
  35. package/dist/{middleware-B3GuN6Gj.js → middleware-B9frafBa.js} +8 -83
  36. package/dist/middleware-Bt5MUXQg.cjs +12 -0
  37. package/dist/{middleware-0fnsG0v7.js → middleware-ByIcAfxE.js} +11 -11
  38. package/dist/{middleware-CfL_Pd6a.js → middleware-DhlkbIaH.js} +4 -4
  39. package/dist/{middleware-B4Bgz0MJ.js → middleware-OPyIzlKI.js} +14 -89
  40. package/dist/mod-CwZXZJ9d.d.ts +91 -0
  41. package/dist/mod-DPkRU3EK.d.cts +266 -0
  42. package/dist/mod-DUWcVv49.d.ts +268 -0
  43. package/dist/mod-DVwHUI_x.d.cts +80 -0
  44. package/dist/mod-DXsQakeS.d.cts +89 -0
  45. package/dist/mod-Di3W5OdP.d.cts +62 -0
  46. package/dist/mod-DnSsduJF.d.ts +64 -0
  47. package/dist/mod-DosD6NsG.d.ts +82 -0
  48. package/dist/mod.cjs +4 -4
  49. package/dist/mod.d.cts +9 -9
  50. package/dist/mod.d.ts +9 -9
  51. package/dist/mod.js +4 -4
  52. package/dist/nodeinfo/handler.test.js +11 -11
  53. package/dist/nodeinfo/mod.d.cts +1 -1
  54. package/dist/nodeinfo/mod.d.ts +1 -1
  55. package/dist/otel/mod.d.cts +145 -145
  56. package/dist/otel/mod.d.ts +145 -145
  57. package/dist/owner-1AbPBOOZ.d.cts +66 -0
  58. package/dist/{owner-BOSWh-ha.js → owner-DfXg2o90.js} +1 -1
  59. package/dist/owner-gd0Q9FuU.d.ts +68 -0
  60. package/dist/{proof-BeT_MFIx.js → proof-BTvHpR2_.js} +2 -2
  61. package/dist/{proof-D61EYfPl.js → proof-CNhYMIct.js} +1 -1
  62. package/dist/{proof-C8qvlfLD.cjs → proof-DnzISmKI.cjs} +1 -1
  63. package/dist/{send-D7lC06r9.js → send-DaEkUvnr.js} +2 -2
  64. package/dist/sig/http.test.js +3 -3
  65. package/dist/sig/key.test.js +2 -2
  66. package/dist/sig/ld.test.js +3 -3
  67. package/dist/sig/mod.cjs +2 -2
  68. package/dist/sig/mod.d.cts +3 -3
  69. package/dist/sig/mod.d.ts +3 -3
  70. package/dist/sig/mod.js +2 -2
  71. package/dist/sig/owner.test.js +3 -3
  72. package/dist/sig/proof.test.js +3 -3
  73. package/dist/testing/mod.d.ts +4 -23
  74. package/dist/utils/docloader.test.js +4 -4
  75. package/dist/utils/mod.cjs +2 -2
  76. package/dist/utils/mod.d.cts +3 -3
  77. package/dist/utils/mod.d.ts +3 -3
  78. package/dist/utils/mod.js +2 -2
  79. package/package.json +5 -5
  80. package/dist/client-CwkOPN13.d.cts +0 -222
  81. package/dist/client-a7NwzhA2.d.ts +0 -224
  82. package/dist/context-BdNW_8a3.d.cts +0 -2554
  83. package/dist/context-C-GVKcJR.d.ts +0 -2556
  84. package/dist/http-CCEu-x1_.d.cts +0 -253
  85. package/dist/http-CODSJcKx.d.ts +0 -255
  86. package/dist/kv-g9jFc34-.d.cts +0 -110
  87. package/dist/kv-jg_8SMc1.d.ts +0 -113
  88. package/dist/middleware-DILzU8Ot.cjs +0 -12
  89. package/dist/mod-5PNty1K9.d.cts +0 -80
  90. package/dist/mod-BcpEGTWV.d.cts +0 -62
  91. package/dist/mod-COO7VMcm.d.cts +0 -266
  92. package/dist/mod-CevNbUol.d.ts +0 -91
  93. package/dist/mod-CtO31FCx.d.ts +0 -64
  94. package/dist/mod-Da9fNDyC.d.ts +0 -82
  95. package/dist/mod-ErTjUJs9.d.cts +0 -89
  96. package/dist/mod-q2IR8UiH.d.ts +0 -268
  97. package/dist/owner-9yZ5Ibsb.d.cts +0 -66
  98. package/dist/owner-DQYAbVmX.d.ts +0 -68
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
5
  import { getDefaultActivityTransformers } from "./transformers-C3FLHUd6.js";
6
- import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-CCsNu78I.js";
7
- import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-D61EYfPl.js";
6
+ import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-C3ipH_7H.js";
7
+ import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-CNhYMIct.js";
8
8
  import { getNodeInfo, nodeInfoToJson } from "./types-C93Ob9cU.js";
9
- import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-6b2ldIo-.js";
9
+ import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-CFQBoGCe.js";
10
10
  import { getLogger, withContext } from "@logtape/logtape";
11
11
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
12
12
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -338,7 +338,7 @@ var FederationBuilderImpl = class {
338
338
  this.collectionTypeIds = {};
339
339
  }
340
340
  async build(options) {
341
- const { FederationImpl: FederationImpl$1 } = await import("./middleware-CfL_Pd6a.js");
341
+ const { FederationImpl: FederationImpl$1 } = await import("./middleware-DhlkbIaH.js");
342
342
  const f = new FederationImpl$1(options);
343
343
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
344
344
  f.router = this.router.clone();
@@ -993,25 +993,7 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
993
993
  return await onNotFound(request);
994
994
  }
995
995
  if (authorizePredicate != null) {
996
- let key = await context$1.getSignedKey();
997
- key = key?.clone({}, { $warning: {
998
- category: [
999
- "fedify",
1000
- "federation",
1001
- "actor"
1002
- ],
1003
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1004
- } }) ?? null;
1005
- let keyOwner = await context$1.getSignedKeyOwner();
1006
- keyOwner = keyOwner?.clone({}, { $warning: {
1007
- category: [
1008
- "fedify",
1009
- "federation",
1010
- "actor"
1011
- ],
1012
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1013
- } }) ?? null;
1014
- if (!await authorizePredicate(context$1, identifier, key, keyOwner)) return await onUnauthorized(request);
996
+ if (!await authorizePredicate(context$1, identifier)) return await onUnauthorized(request);
1015
997
  }
1016
998
  const jsonLd = await actor.toJsonLd(context$1);
1017
999
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1031,25 +1013,7 @@ async function handleObject(request, { values, context: context$1, objectDispatc
1031
1013
  const object = await objectDispatcher(context$1, values);
1032
1014
  if (object == null) return await onNotFound(request);
1033
1015
  if (authorizePredicate != null) {
1034
- let key = await context$1.getSignedKey();
1035
- key = key?.clone({}, { $warning: {
1036
- category: [
1037
- "fedify",
1038
- "federation",
1039
- "object"
1040
- ],
1041
- message: "The third parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1042
- } }) ?? null;
1043
- let keyOwner = await context$1.getSignedKeyOwner();
1044
- keyOwner = keyOwner?.clone({}, { $warning: {
1045
- category: [
1046
- "fedify",
1047
- "federation",
1048
- "object"
1049
- ],
1050
- message: "The fourth parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1051
- } }) ?? null;
1052
- if (!await authorizePredicate(context$1, values, key, keyOwner)) return await onUnauthorized(request);
1016
+ if (!await authorizePredicate(context$1, values)) return await onUnauthorized(request);
1053
1017
  }
1054
1018
  const jsonLd = await object.toJsonLd(context$1);
1055
1019
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1181,25 +1145,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
1181
1145
  });
1182
1146
  }
1183
1147
  if (collectionCallbacks.authorizePredicate != null) {
1184
- let key = await context$1.getSignedKey();
1185
- key = key?.clone({}, { $warning: {
1186
- category: [
1187
- "fedify",
1188
- "federation",
1189
- "collection"
1190
- ],
1191
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1192
- } }) ?? null;
1193
- let keyOwner = await context$1.getSignedKeyOwner();
1194
- keyOwner = keyOwner?.clone({}, { $warning: {
1195
- category: [
1196
- "fedify",
1197
- "federation",
1198
- "collection"
1199
- ],
1200
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1201
- } }) ?? null;
1202
- if (!await collectionCallbacks.authorizePredicate(context$1, identifier, key, keyOwner)) return await onUnauthorized(request);
1148
+ if (!await collectionCallbacks.authorizePredicate(context$1, identifier)) return await onUnauthorized(request);
1203
1149
  }
1204
1150
  const jsonLd = await collection.toJsonLd(context$1);
1205
1151
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1850,28 +1796,7 @@ const verifyDefined = (callbacks) => {
1850
1796
  */
1851
1797
  const authIfNeeded = async (context$1, values, { authorizePredicate: authorize = void 0 }) => {
1852
1798
  if (authorize === void 0) return;
1853
- const key = (await context$1.getSignedKey())?.clone({}, warning.key) ?? null;
1854
- const keyOwner = (await context$1.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
1855
- if (!await authorize(context$1, values, key, keyOwner)) throw new UnauthorizedError();
1856
- };
1857
- /** Warning messages for `authIfNeeded`. */
1858
- const warning = {
1859
- key: { $warning: {
1860
- category: [
1861
- "fedify",
1862
- "federation",
1863
- "collection"
1864
- ],
1865
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1866
- } },
1867
- keyOwner: { $warning: {
1868
- category: [
1869
- "fedify",
1870
- "federation",
1871
- "collection"
1872
- ],
1873
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1874
- } }
1799
+ if (!await authorize(context$1, values)) throw new UnauthorizedError();
1875
1800
  };
1876
1801
  /**
1877
1802
  * Appends a cursor parameter to a URL if the cursor exists.
@@ -0,0 +1,12 @@
1
+
2
+ const { Temporal } = require("@js-temporal/polyfill");
3
+ const { URLPattern } = require("urlpattern-polyfill");
4
+
5
+ require('./transformers-3g8GZwkZ.cjs');
6
+ require('./http-DGYGS8C8.cjs');
7
+ const require_middleware = require('./middleware-B1XHFs0D.cjs');
8
+ require('./proof-DnzISmKI.cjs');
9
+ require('./types-Cd_hszr_.cjs');
10
+ require('./kv-cache-Bd2z9in6.cjs');
11
+
12
+ exports.FederationImpl = require_middleware.FederationImpl;
@@ -3,24 +3,24 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "./deno-CIi8RNND.js";
7
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-B4Bgz0MJ.js";
6
+ import "./deno-D-Duks4b.js";
7
+ import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-OPyIzlKI.js";
8
8
  import "./client-Dg7OfUDA.js";
9
9
  import "./router-D9eI0s4b.js";
10
10
  import "./types-CPz01LGH.js";
11
- import "./key-C7JS89OH.js";
12
- import "./http-Dvox_xrq.js";
13
- import "./ld-C8i1kViF.js";
14
- import "./owner-BOSWh-ha.js";
15
- import "./proof-BeT_MFIx.js";
16
- import "./docloader-CmrEfaGw.js";
11
+ import "./key-DChkqRrm.js";
12
+ import "./http-DnP0rGKj.js";
13
+ import "./ld-CR9Xg8mN.js";
14
+ import "./owner-DfXg2o90.js";
15
+ import "./proof-BTvHpR2_.js";
16
+ import "./docloader-Bb4MhBYJ.js";
17
17
  import "./kv-cache-B__dHl7g.js";
18
- import "./inbox-CiTdVhJQ.js";
19
- import "./builder-CqPrSnE5.js";
18
+ import "./inbox-CbNZlhe6.js";
19
+ import "./builder-B55ClH_D.js";
20
20
  import "./collection-CcnIw1qY.js";
21
21
  import "./keycache-DRxpZ5r9.js";
22
22
  import "./negotiation-5NPJL6zp.js";
23
23
  import "./retry-D4GJ670a.js";
24
- import "./send-D7lC06r9.js";
24
+ import "./send-DaEkUvnr.js";
25
25
 
26
26
  export { FederationImpl };
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
5
  import "./transformers-C3FLHUd6.js";
6
- import "./http-CCsNu78I.js";
7
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-B3GuN6Gj.js";
8
- import "./proof-D61EYfPl.js";
6
+ import "./http-C3ipH_7H.js";
7
+ import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-B9frafBa.js";
8
+ import "./proof-CNhYMIct.js";
9
9
  import "./types-C93Ob9cU.js";
10
- import "./kv-cache-6b2ldIo-.js";
10
+ import "./kv-cache-CFQBoGCe.js";
11
11
 
12
12
  export { FederationImpl };
@@ -3,24 +3,24 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default } from "./deno-CIi8RNND.js";
6
+ import { deno_default } from "./deno-D-Duks4b.js";
7
7
  import { getNodeInfo } from "./client-Dg7OfUDA.js";
8
8
  import { RouterError } from "./router-D9eI0s4b.js";
9
9
  import { nodeInfoToJson } from "./types-CPz01LGH.js";
10
- import { exportJwk, importJwk, validateCryptoKey } from "./key-C7JS89OH.js";
11
- import { verifyRequest } from "./http-Dvox_xrq.js";
12
- import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-C8i1kViF.js";
13
- import { doesActorOwnKey, getKeyOwner } from "./owner-BOSWh-ha.js";
14
- import { signObject, verifyObject } from "./proof-BeT_MFIx.js";
15
- import { getAuthenticatedDocumentLoader } from "./docloader-CmrEfaGw.js";
10
+ import { exportJwk, importJwk, validateCryptoKey } from "./key-DChkqRrm.js";
11
+ import { verifyRequest } from "./http-DnP0rGKj.js";
12
+ import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-CR9Xg8mN.js";
13
+ import { doesActorOwnKey, getKeyOwner } from "./owner-DfXg2o90.js";
14
+ import { signObject, verifyObject } from "./proof-BTvHpR2_.js";
15
+ import { getAuthenticatedDocumentLoader } from "./docloader-Bb4MhBYJ.js";
16
16
  import { kvCache } from "./kv-cache-B__dHl7g.js";
17
- import { routeActivity } from "./inbox-CiTdVhJQ.js";
18
- import { FederationBuilderImpl } from "./builder-CqPrSnE5.js";
17
+ import { routeActivity } from "./inbox-CbNZlhe6.js";
18
+ import { FederationBuilderImpl } from "./builder-B55ClH_D.js";
19
19
  import { buildCollectionSynchronizationHeader } from "./collection-CcnIw1qY.js";
20
20
  import { KvKeyCache } from "./keycache-DRxpZ5r9.js";
21
21
  import { acceptsJsonLd } from "./negotiation-5NPJL6zp.js";
22
22
  import { createExponentialBackoffPolicy } from "./retry-D4GJ670a.js";
23
- import { SendActivityError, extractInboxes, sendActivity } from "./send-D7lC06r9.js";
23
+ import { SendActivityError, extractInboxes, sendActivity } from "./send-DaEkUvnr.js";
24
24
  import { getLogger, withContext } from "@logtape/logtape";
25
25
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
26
26
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -182,25 +182,7 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
182
182
  return await onNotFound(request);
183
183
  }
184
184
  if (authorizePredicate != null) {
185
- let key = await context$1.getSignedKey();
186
- key = key?.clone({}, { $warning: {
187
- category: [
188
- "fedify",
189
- "federation",
190
- "actor"
191
- ],
192
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
193
- } }) ?? null;
194
- let keyOwner = await context$1.getSignedKeyOwner();
195
- keyOwner = keyOwner?.clone({}, { $warning: {
196
- category: [
197
- "fedify",
198
- "federation",
199
- "actor"
200
- ],
201
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
202
- } }) ?? null;
203
- if (!await authorizePredicate(context$1, identifier, key, keyOwner)) return await onUnauthorized(request);
185
+ if (!await authorizePredicate(context$1, identifier)) return await onUnauthorized(request);
204
186
  }
205
187
  const jsonLd = await actor.toJsonLd(context$1);
206
188
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -220,25 +202,7 @@ async function handleObject(request, { values, context: context$1, objectDispatc
220
202
  const object = await objectDispatcher(context$1, values);
221
203
  if (object == null) return await onNotFound(request);
222
204
  if (authorizePredicate != null) {
223
- let key = await context$1.getSignedKey();
224
- key = key?.clone({}, { $warning: {
225
- category: [
226
- "fedify",
227
- "federation",
228
- "object"
229
- ],
230
- message: "The third parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
231
- } }) ?? null;
232
- let keyOwner = await context$1.getSignedKeyOwner();
233
- keyOwner = keyOwner?.clone({}, { $warning: {
234
- category: [
235
- "fedify",
236
- "federation",
237
- "object"
238
- ],
239
- message: "The fourth parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
240
- } }) ?? null;
241
- if (!await authorizePredicate(context$1, values, key, keyOwner)) return await onUnauthorized(request);
205
+ if (!await authorizePredicate(context$1, values)) return await onUnauthorized(request);
242
206
  }
243
207
  const jsonLd = await object.toJsonLd(context$1);
244
208
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -370,25 +334,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
370
334
  });
371
335
  }
372
336
  if (collectionCallbacks.authorizePredicate != null) {
373
- let key = await context$1.getSignedKey();
374
- key = key?.clone({}, { $warning: {
375
- category: [
376
- "fedify",
377
- "federation",
378
- "collection"
379
- ],
380
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
381
- } }) ?? null;
382
- let keyOwner = await context$1.getSignedKeyOwner();
383
- keyOwner = keyOwner?.clone({}, { $warning: {
384
- category: [
385
- "fedify",
386
- "federation",
387
- "collection"
388
- ],
389
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
390
- } }) ?? null;
391
- if (!await collectionCallbacks.authorizePredicate(context$1, identifier, key, keyOwner)) return await onUnauthorized(request);
337
+ if (!await collectionCallbacks.authorizePredicate(context$1, identifier)) return await onUnauthorized(request);
392
338
  }
393
339
  const jsonLd = await collection.toJsonLd(context$1);
394
340
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1039,28 +985,7 @@ const verifyDefined = (callbacks) => {
1039
985
  */
1040
986
  const authIfNeeded = async (context$1, values, { authorizePredicate: authorize = void 0 }) => {
1041
987
  if (authorize === void 0) return;
1042
- const key = (await context$1.getSignedKey())?.clone({}, warning.key) ?? null;
1043
- const keyOwner = (await context$1.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
1044
- if (!await authorize(context$1, values, key, keyOwner)) throw new UnauthorizedError();
1045
- };
1046
- /** Warning messages for `authIfNeeded`. */
1047
- const warning = {
1048
- key: { $warning: {
1049
- category: [
1050
- "fedify",
1051
- "federation",
1052
- "collection"
1053
- ],
1054
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1055
- } },
1056
- keyOwner: { $warning: {
1057
- category: [
1058
- "fedify",
1059
- "federation",
1060
- "collection"
1061
- ],
1062
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1063
- } }
988
+ if (!await authorize(context$1, values)) throw new UnauthorizedError();
1064
989
  };
1065
990
  /**
1066
991
  * Appends a cursor parameter to a URL if the cursor exists.
@@ -0,0 +1,91 @@
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
+ import { HttpMessageSignaturesSpecDeterminer } from "./http-DkHdFfrc.js";
4
+ import { KvKey, KvStore } from "./kv-DXEUEP6z.js";
5
+ import { TracerProvider } from "@opentelemetry/api";
6
+ import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
7
+
8
+ //#region src/utils/docloader.d.ts
9
+ /**
10
+ * Options for {@link getAuthenticatedDocumentLoader}.
11
+ * @see {@link getAuthenticatedDocumentLoader}
12
+ * @since 1.3.0
13
+ */
14
+ interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
15
+ /**
16
+ * An optional spec determiner for HTTP Message Signatures.
17
+ * It determines the spec to use for signing requests.
18
+ * It is used for double-knocking
19
+ * (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
20
+ * @since 1.6.0
21
+ */
22
+ specDeterminer?: HttpMessageSignaturesSpecDeterminer;
23
+ /**
24
+ * The OpenTelemetry tracer provider. If omitted, the global tracer provider
25
+ * is used.
26
+ * @since 1.6.0
27
+ */
28
+ tracerProvider?: TracerProvider;
29
+ }
30
+ /**
31
+ * Gets an authenticated {@link DocumentLoader} for the given identity.
32
+ * Note that an authenticated document loader intentionally does not cache
33
+ * the fetched documents.
34
+ * @param identity The identity to get the document loader for.
35
+ * The actor's key pair.
36
+ * @param options The options for the document loader.
37
+ * @returns The authenticated document loader.
38
+ * @throws {TypeError} If the key is invalid or unsupported.
39
+ * @since 0.4.0
40
+ */
41
+ declare function getAuthenticatedDocumentLoader(identity: {
42
+ keyId: URL;
43
+ privateKey: CryptoKey;
44
+ }, {
45
+ allowPrivateAddress,
46
+ userAgent,
47
+ specDeterminer,
48
+ tracerProvider
49
+ }?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
50
+ //#endregion
51
+ //#region src/utils/kv-cache.d.ts
52
+ /**
53
+ * The parameters for {@link kvCache} function.
54
+ */
55
+ interface KvCacheParameters {
56
+ /**
57
+ * The document loader to decorate with a cache.
58
+ */
59
+ readonly loader: DocumentLoader;
60
+ /**
61
+ * The key–value store to use for backing the cache.
62
+ */
63
+ readonly kv: KvStore;
64
+ /**
65
+ * The key prefix to use for namespacing the cache.
66
+ * `["_fedify", "remoteDocument"]` by default.
67
+ */
68
+ readonly prefix?: KvKey;
69
+ /**
70
+ * The per-URL cache rules in the array of `[urlPattern, duration]` pairs
71
+ * where `urlPattern` is either a string, a {@link URL}, or
72
+ * a {@link URLPattern} and `duration` is a {@link Temporal.DurationLike}.
73
+ * The `duration` is allowed to be at most 30 days.
74
+ *
75
+ * By default, 5 minutes for all URLs.
76
+ */
77
+ readonly rules?: readonly [string | URL | URLPattern, Temporal.Duration | Temporal.DurationLike][];
78
+ }
79
+ /**
80
+ * Decorates a {@link DocumentLoader} with a cache backed by a {@link KvStore}.
81
+ * @param parameters The parameters for the cache.
82
+ * @returns The decorated document loader which is cache-enabled.
83
+ */
84
+ declare function kvCache({
85
+ loader,
86
+ kv,
87
+ prefix,
88
+ rules
89
+ }: KvCacheParameters): DocumentLoader;
90
+ //#endregion
91
+ export { getAuthenticatedDocumentLoader, kvCache };