@fedify/fedify 2.3.0-dev.1069 → 2.3.0-dev.1099

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 (113) hide show
  1. package/dist/{builder-DQ2zYTeA.mjs → builder-BkRRjxzb.mjs} +4 -4
  2. package/dist/{chunk-nlSIicah.js → chunk-CRNNMoPX.js} +2 -2
  3. package/dist/{chunk-QSgtlS85.mjs → chunk-DNRtMIoB.mjs} +1 -1
  4. package/dist/{client-z-8dc-e1.d.cts → client-CAM_bQXx.d.cts} +1 -0
  5. package/dist/{client-AtlibPOU.d.ts → client-CSddvgWN.d.ts} +1 -2
  6. package/dist/compat/mod.d.cts +2 -1
  7. package/dist/compat/mod.d.ts +2 -3
  8. package/dist/compat/mod.js +3 -3
  9. package/dist/compat/outgoing-jsonld.test.mjs +2 -2
  10. package/dist/compat/public-audience.test.mjs +2 -2
  11. package/dist/compat/transformers.test.mjs +2 -2
  12. package/dist/{context-7Azky82W.mjs → context-BAE7AKLA.mjs} +61 -3
  13. package/dist/{context-DrNqYkPw.d.ts → context-C0C_sRha.d.cts} +6 -7
  14. package/dist/{context-BKLGj9QO.d.cts → context-Dqgt8saU.d.ts} +6 -5
  15. package/dist/{deno-CFXqOz6w.mjs → deno-DBabeupC.mjs} +1 -1
  16. package/dist/{docloader-QNtAtTZF.mjs → docloader-DA5FzJOR.mjs} +3 -3
  17. package/dist/{esm-DhnRLoG9.mjs → esm-sdtqOUPu.mjs} +5 -7
  18. package/dist/{execAsync-eck5rbtb.mjs → execAsync-DCBrgFiV.mjs} +2 -2
  19. package/dist/federation/builder.test.mjs +3 -3
  20. package/dist/federation/handler.test.mjs +86 -4
  21. package/dist/federation/idempotency.test.mjs +3 -3
  22. package/dist/federation/inbox.test.mjs +1 -1
  23. package/dist/federation/keycache.test.mjs +1 -1
  24. package/dist/federation/middleware.test.mjs +387 -20
  25. package/dist/federation/mod.cjs +1 -1
  26. package/dist/federation/mod.d.cts +4 -3
  27. package/dist/federation/mod.d.ts +4 -5
  28. package/dist/federation/mod.js +2 -2
  29. package/dist/federation/mq.test.mjs +1 -1
  30. package/dist/federation/negotiation.test.mjs +1 -1
  31. package/dist/federation/router.test.mjs +1 -1
  32. package/dist/federation/send.test.mjs +133 -139
  33. package/dist/federation/webfinger.test.mjs +3 -3
  34. package/dist/{getMachineId-bsd-DqZ4QRFp.mjs → getMachineId-bsd-etIyxDet.mjs} +3 -3
  35. package/dist/{getMachineId-darwin-DMbbW3m7.mjs → getMachineId-darwin-D23zTf4g.mjs} +3 -3
  36. package/dist/{getMachineId-linux-lyeD2ug3.mjs → getMachineId-linux-ObI47Hql.mjs} +2 -2
  37. package/dist/{getMachineId-unsupported-JuKr57jY.mjs → getMachineId-unsupported-Ddu-PFeh.mjs} +2 -2
  38. package/dist/{getMachineId-win-Dxyf5pJq.mjs → getMachineId-win-Dpap6v5i.mjs} +3 -3
  39. package/dist/{http-QHJGzUe8.mjs → http-5G18W3NP.mjs} +59 -11
  40. package/dist/{http-CrGuipxe.d.cts → http-BDZeS5om.d.ts} +2 -1
  41. package/dist/{http-aQzN9Ayi.d.ts → http-C87EWkO0.d.cts} +2 -3
  42. package/dist/{http-D2EDlTr2.js → http-Dzy5c472.js} +58 -10
  43. package/dist/{http-e1wtIlFo.cjs → http-W2u_KBoQ.cjs} +57 -9
  44. package/dist/{key-CpAxygvh.mjs → key-D9dUsyow.mjs} +2 -2
  45. package/dist/{kv-CbLNp3zQ.d.cts → kv-D6hNiMTK.d.ts} +1 -0
  46. package/dist/{kv-cache-B3GfB70S.cjs → kv-cache-BygrlQ1c.cjs} +2 -2
  47. package/dist/{kv-cache-KLjvIlKt.js → kv-cache-CBSgxEsZ.js} +2 -2
  48. package/dist/{kv-cache-Bmv7tUzz.mjs → kv-cache-CiiNwT6W.mjs} +2 -2
  49. package/dist/{kv-GFYnFoOl.d.ts → kv-gJ8LYbxX.d.cts} +1 -3
  50. package/dist/{ld-Ce_vkKjG.mjs → ld-hbxDLO1k.mjs} +3 -3
  51. package/dist/{middleware-DsGmXfXz.mjs → middleware-BXnhAGF9.mjs} +201 -119
  52. package/dist/{middleware-DOLrvK_b.cjs → middleware-Caj827xW.cjs} +358 -139
  53. package/dist/{middleware-BJMPv7_l.mjs → middleware-DZQsPMZb.mjs} +1 -1
  54. package/dist/{middleware-De241etq.js → middleware-vCF_cKAq.js} +346 -111
  55. package/dist/{mod-CLgIXe9w.d.ts → mod-B0rWmfW5.d.cts} +4 -5
  56. package/dist/{mod-CMEbIaNh.d.cts → mod-BhU_H1I_.d.ts} +4 -3
  57. package/dist/{mod-B8Z8mBLk.d.ts → mod-CLPnQPsv.d.cts} +2 -3
  58. package/dist/{mod-Cr3f-ACa.d.cts → mod-DHO9lk3D.d.ts} +3 -2
  59. package/dist/{mod-CR8soWa9.d.ts → mod-DXY9JF28.d.cts} +3 -4
  60. package/dist/{mod-DClCOv0M.d.cts → mod-Dx3-hqyo.d.ts} +2 -1
  61. package/dist/mod.cjs +4 -4
  62. package/dist/mod.d.cts +9 -8
  63. package/dist/mod.d.ts +9 -10
  64. package/dist/mod.js +9 -9
  65. package/dist/{negotiation-VnHNB0Q5.mjs → negotiation-DDstyBvc.mjs} +29 -0
  66. package/dist/nodeinfo/client.test.mjs +2 -2
  67. package/dist/nodeinfo/handler.test.mjs +2 -2
  68. package/dist/nodeinfo/mod.d.cts +2 -1
  69. package/dist/nodeinfo/mod.d.ts +2 -3
  70. package/dist/nodeinfo/mod.js +3 -3
  71. package/dist/otel/exporter.test.mjs +2 -2
  72. package/dist/otel/mod.d.cts +2 -1
  73. package/dist/otel/mod.d.ts +2 -3
  74. package/dist/otel/mod.js +2 -2
  75. package/dist/{outgoing-jsonld-Bi7n-dEy.mjs → outgoing-jsonld-BgFLCJQ_.mjs} +2 -2
  76. package/dist/{owner-CptqhsOy.d.cts → owner-CnngXDNJ.d.ts} +2 -1
  77. package/dist/{owner-74ARJ5TL.d.ts → owner-DEvZuyOE.d.cts} +2 -3
  78. package/dist/{owner-DmgzyItA.mjs → owner-DwJe0BH9.mjs} +2 -2
  79. package/dist/{proof-BU1TpFYI.cjs → proof-CZCaAURh.cjs} +3 -3
  80. package/dist/{proof-DLDsFYfD.js → proof-DMJJZnKd.js} +2 -2
  81. package/dist/{proof-C3q2IhUr.mjs → proof-erpV_J_n.mjs} +5 -5
  82. package/dist/runtime/mod.d.cts +1 -0
  83. package/dist/runtime/mod.d.ts +1 -2
  84. package/dist/runtime/mod.js +3 -3
  85. package/dist/{send-CTi2iPXp.mjs → send-BOwz4Hw5.mjs} +128 -4
  86. package/dist/sig/http.test.mjs +140 -27
  87. package/dist/sig/key.test.mjs +2 -2
  88. package/dist/sig/ld.test.mjs +3 -3
  89. package/dist/sig/mod.cjs +2 -2
  90. package/dist/sig/mod.d.cts +4 -3
  91. package/dist/sig/mod.d.ts +4 -5
  92. package/dist/sig/mod.js +4 -4
  93. package/dist/sig/owner.test.mjs +2 -2
  94. package/dist/sig/proof.test.mjs +3 -3
  95. package/dist/testing/mod.d.mts +6 -1
  96. package/dist/testing/mod.mjs +1 -2
  97. package/dist/{transformers-ve6e2xcg.js → transformers-BGMIq1cs.js} +2 -2
  98. package/dist/{types-hvL8ElAs.js → types-CAY3OdLq.js} +2 -2
  99. package/dist/utils/docloader.test.mjs +3 -3
  100. package/dist/utils/kv-cache.test.mjs +2 -2
  101. package/dist/utils/mod.cjs +1 -1
  102. package/dist/utils/mod.d.cts +2 -1
  103. package/dist/utils/mod.d.ts +2 -3
  104. package/dist/utils/mod.js +3 -3
  105. package/dist/vocab/cjs.test.mjs +1 -1
  106. package/dist/vocab/mod.d.cts +1 -0
  107. package/dist/vocab/mod.d.ts +1 -2
  108. package/dist/vocab/mod.js +2 -2
  109. package/package.json +15 -15
  110. package/dist/middleware-CibncbiT.cjs +0 -4
  111. package/dist/{client-CIiz1WX7.mjs → client-B_A6mfn3.mjs} +1 -1
  112. package/dist/{public-audience-PVTwU_Ex.mjs → public-audience-N3pyOx2p.mjs} +1 -1
  113. /package/dist/{router-CrMLXoOr.mjs → router-BT_F5748.mjs} +0 -0
@@ -1,12 +1,12 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as RouterError, t as Router } from "./router-CrMLXoOr.mjs";
5
- import { n as version, t as name } from "./deno-CFXqOz6w.mjs";
4
+ import { n as RouterError, t as Router } from "./router-BT_F5748.mjs";
5
+ import { n as version, t as name } from "./deno-DBabeupC.mjs";
6
6
  import { t as ActivityListenerSet } from "./activity-listener-tztVvlNb.mjs";
7
+ import { getLogger } from "@logtape/logtape";
7
8
  import { Tombstone, getTypeId } from "@fedify/vocab";
8
9
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
- import { getLogger } from "@logtape/logtape";
10
10
  //#region src/federation/builder.ts
11
11
  const ACTOR_ALIAS_PREFIX = "actorAlias:";
12
12
  function validateSingleIdentifierVariablePath(path, errorMessage) {
@@ -59,7 +59,7 @@ var FederationBuilderImpl = class {
59
59
  this.collectionTypeIds = {};
60
60
  }
61
61
  async build(options) {
62
- const { FederationImpl } = await import("./middleware-BJMPv7_l.mjs");
62
+ const { FederationImpl } = await import("./middleware-DZQsPMZb.mjs");
63
63
  const f = new FederationImpl(options);
64
64
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
65
65
  f.router = this.router.clone();
@@ -1,5 +1,5 @@
1
- import "@js-temporal/polyfill";
2
- import "urlpattern-polyfill";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
3
  //#region \0rolldown/runtime.js
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -9,7 +9,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
9
  var __getOwnPropNames = Object.getOwnPropertyNames;
10
10
  var __getProtoOf = Object.getPrototypeOf;
11
11
  var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
12
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
13
13
  var __copyProps = (to, from, except, desc) => {
14
14
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
15
  key = keys[i];
@@ -1,3 +1,4 @@
1
+ /// <reference lib="esnext.temporal" />
1
2
  import { GetUserAgentOptions } from "@fedify/vocab-runtime";
2
3
 
3
4
  //#region src/nodeinfo/types.d.ts
@@ -1,5 +1,4 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
1
+ /// <reference lib="esnext.temporal" />
3
2
  import { GetUserAgentOptions } from "@fedify/vocab-runtime";
4
3
 
5
4
  //#region src/nodeinfo/types.d.ts
@@ -1,4 +1,5 @@
1
- import { kt as ActivityTransformer, n as Context } from "../context-BKLGj9QO.cjs";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { kt as ActivityTransformer, n as Context } from "../context-C0C_sRha.cjs";
2
3
  import { Activity } from "@fedify/vocab";
3
4
 
4
5
  //#region src/compat/transformers.d.ts
@@ -1,6 +1,5 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { kt as ActivityTransformer, n as Context } from "../context-DrNqYkPw.js";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { kt as ActivityTransformer, n as Context } from "../context-Dqgt8saU.js";
4
3
  import { Activity } from "@fedify/vocab";
5
4
 
6
5
  //#region src/compat/transformers.d.ts
@@ -1,4 +1,4 @@
1
- import "@js-temporal/polyfill";
2
- import "urlpattern-polyfill";
3
- import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "../transformers-ve6e2xcg.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
+ import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "../transformers-BGMIq1cs.js";
4
4
  export { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { t as assertStrictEquals } from "../assert_strict_equals-Dmjbg-bA.mjs";
6
- import { n as normalizeAttachmentArrays, r as normalizeOutgoingActivityJsonLd, t as isPreloadedContextAttachmentSafe } from "../outgoing-jsonld-Bi7n-dEy.mjs";
7
- import { mockDocumentLoader, test } from "@fedify/fixture";
6
+ import { n as normalizeAttachmentArrays, r as normalizeOutgoingActivityJsonLd, t as isPreloadedContextAttachmentSafe } from "../outgoing-jsonld-BgFLCJQ_.mjs";
8
7
  import { Create, Document, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
8
+ import { mockDocumentLoader, test } from "@fedify/fixture";
9
9
  //#region src/compat/outgoing-jsonld.test.ts
10
10
  test("normalizeAttachmentArrays() wraps scalar attachments", async () => {
11
11
  const object = (await normalizeAttachmentArrays({
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
6
- import { t as normalizePublicAudience } from "../public-audience-PVTwU_Ex.mjs";
7
- import { test } from "@fedify/fixture";
6
+ import { t as normalizePublicAudience } from "../public-audience-N3pyOx2p.mjs";
8
7
  import { Create, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
8
+ import { test } from "@fedify/fixture";
9
9
  import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
10
10
  //#region src/compat/public-audience.test.ts
11
11
  const PUBLIC_URI = PUBLIC_COLLECTION.href;
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
6
6
  import { t as assert } from "../assert-DikXweDx.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
8
- import { n as FederationImpl, v as actorDehydrator, y as autoIdAssigner } from "../middleware-DsGmXfXz.mjs";
9
- import { test } from "@fedify/fixture";
8
+ import { n as FederationImpl, v as actorDehydrator, y as autoIdAssigner } from "../middleware-BXnhAGF9.mjs";
10
9
  import { Follow, Person } from "@fedify/vocab";
10
+ import { test } from "@fedify/fixture";
11
11
  //#region src/compat/transformers.test.ts
12
12
  const context = new FederationImpl({ kv: new MemoryKvStore() }).createContext(new URL("http://example.com/"));
13
13
  test("autoIdAssigner", async () => {
@@ -1,11 +1,69 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as RouterError } from "./router-CrMLXoOr.mjs";
5
- import { mockDocumentLoader } from "@fedify/fixture";
4
+ import { n as RouterError } from "./router-BT_F5748.mjs";
5
+ import { getLogger } from "@logtape/logtape";
6
+ import "@opentelemetry/sdk-trace-base";
7
+ import "@opentelemetry/core";
6
8
  import { lookupObject, traverseCollection } from "@fedify/vocab";
7
9
  import { lookupWebFinger } from "@fedify/webfinger";
8
10
  import { metrics, trace } from "@opentelemetry/api";
11
+ //#region ../fixture/dist/mod.js
12
+ const logger = getLogger(["fixture", "docloader"]);
13
+ /**
14
+ * A mock of the document loader. This does not make any actual HTTP requests
15
+ * towards the remote server, but looks up the local fixture files instead.
16
+ *
17
+ * For instance, `mockDocumentLoader("http://example.com/foo/bar")` will look up
18
+ * the file `testing/fixtures/http/example.com/foo/bar` (no suffix) and return
19
+ * its content as the response.
20
+ */
21
+ async function mockDocumentLoader(resource, _options) {
22
+ const url = new URL(resource);
23
+ if ("navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers") {
24
+ const testUrl = new URL(url);
25
+ testUrl.hostname += ".test";
26
+ const resp = await fetch(testUrl);
27
+ if (resp.ok) {
28
+ const document = await resp.json();
29
+ logger.debug("Successfully fetched fixture {resource}: {status} {statusText}\n{body}", {
30
+ resource,
31
+ status: resp.status,
32
+ statusText: resp.statusText,
33
+ body: document
34
+ });
35
+ return {
36
+ contextUrl: null,
37
+ document,
38
+ documentUrl: resource
39
+ };
40
+ }
41
+ const error = await resp.text();
42
+ logger.error("Failed to fetch fixture {resource}: {error}", {
43
+ resource,
44
+ error
45
+ });
46
+ throw new Error(error);
47
+ }
48
+ const fixturePath = `${"Deno" in globalThis ? "." : "@fedify/fixture"}/fixtures/${url.host}${url.pathname}.json`;
49
+ let document;
50
+ try {
51
+ document = (await import(fixturePath, { with: { type: "json" } })).default;
52
+ } catch (error) {
53
+ logger.error("Failed to read fixture file {path}: {error}", {
54
+ path: fixturePath,
55
+ error
56
+ });
57
+ throw error;
58
+ }
59
+ return {
60
+ contextUrl: null,
61
+ document,
62
+ documentUrl: resource
63
+ };
64
+ }
65
+ const testDefinitions = [];
66
+ //#endregion
9
67
  //#region src/testing/context.ts
10
68
  function createContext(values) {
11
69
  const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
@@ -118,4 +176,4 @@ function createOutboxContext(args) {
118
176
  };
119
177
  }
120
178
  //#endregion
121
- export { createOutboxContext as n, createRequestContext as r, createInboxContext as t };
179
+ export { testDefinitions as i, createOutboxContext as n, createRequestContext as r, createInboxContext as t };
@@ -1,13 +1,12 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-AtlibPOU.js";
4
- import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-aQzN9Ayi.js";
5
- import { n as GetKeyOwnerOptions } from "./owner-74ARJ5TL.js";
6
- import { n as KvStore, t as KvKey } from "./kv-GFYnFoOl.js";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CAM_bQXx.cjs";
3
+ import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-C87EWkO0.cjs";
4
+ import { n as GetKeyOwnerOptions } from "./owner-DEvZuyOE.cjs";
5
+ import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
7
6
  import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
8
- import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
9
7
  import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
10
8
  import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
9
+ import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
11
10
 
12
11
  //#region src/compat/types.d.ts
13
12
  /**
@@ -1,11 +1,12 @@
1
- import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-z-8dc-e1.cjs";
2
- import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-CrGuipxe.cjs";
3
- import { n as GetKeyOwnerOptions } from "./owner-CptqhsOy.cjs";
4
- import { n as KvStore, t as KvKey } from "./kv-CbLNp3zQ.cjs";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CSddvgWN.js";
3
+ import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-BDZeS5om.js";
4
+ import { n as GetKeyOwnerOptions } from "./owner-CnngXDNJ.js";
5
+ import { n as KvStore, t as KvKey } from "./kv-D6hNiMTK.js";
5
6
  import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
7
+ import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
6
8
  import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
7
9
  import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
8
- import { MeterProvider, Span, Tracer, TracerProvider } from "@opentelemetry/api";
9
10
 
10
11
  //#region src/compat/types.d.ts
11
12
  /**
@@ -3,6 +3,6 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  //#region deno.json
5
5
  var name = "@fedify/fedify";
6
- var version = "2.3.0-dev.1069+81e910ce";
6
+ var version = "2.3.0-dev.1099+fafcfa78";
7
7
  //#endregion
8
8
  export { version as n, name as t };
@@ -1,11 +1,11 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { o as validateCryptoKey } from "./key-CpAxygvh.mjs";
5
- import { n as doubleKnock } from "./http-QHJGzUe8.mjs";
4
+ import { o as validateCryptoKey } from "./key-D9dUsyow.mjs";
5
+ import { n as doubleKnock } from "./http-5G18W3NP.mjs";
6
+ import { getLogger } from "@logtape/logtape";
6
7
  import { curry } from "es-toolkit";
7
8
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
8
- import { getLogger } from "@logtape/logtape";
9
9
  //#region src/utils/docloader.ts
10
10
  const logger = getLogger([
11
11
  "fedify",
@@ -1,9 +1,10 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { r as __toESM, t as __commonJSMin } from "./chunk-QSgtlS85.mjs";
5
- //#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
6
- var require_glob_to_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ import { r as __toESM, t as __commonJSMin } from "./chunk-DNRtMIoB.mjs";
5
+ //#endregion
6
+ //#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
7
+ var import_glob_to_regexp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
7
8
  module.exports = function(glob, opts) {
8
9
  if (typeof glob !== "string") throw new TypeError("Expected a string");
9
10
  var str = String(glob);
@@ -74,9 +75,7 @@ var require_glob_to_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) =>
74
75
  if (!flags || !~flags.indexOf("g")) reStr = "^" + reStr + "$";
75
76
  return new RegExp(reStr, flags);
76
77
  };
77
- }));
78
- //#endregion
79
- //#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
78
+ })))(), 1);
80
79
  /**
81
80
  * @param {string|RegExp} input The route pattern
82
81
  * @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.
@@ -431,7 +430,6 @@ function normalizeHeaders(headers) {
431
430
  }
432
431
  //#endregion
433
432
  //#region ../../node_modules/.pnpm/fetch-mock@12.6.0/node_modules/fetch-mock/dist/esm/Matchers.js
434
- var import_glob_to_regexp = /* @__PURE__ */ __toESM(require_glob_to_regexp(), 1);
435
433
  const isUrlMatcher = (matcher) => matcher instanceof RegExp || typeof matcher === "string" || typeof matcher === "object" && "href" in matcher;
436
434
  const isFunctionMatcher = (matcher) => typeof matcher === "function";
437
435
  const stringMatchers = {
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as __require, t as __commonJSMin } from "./chunk-QSgtlS85.mjs";
5
- //#region ../../node_modules/.pnpm/@opentelemetry+resources@2.5.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.js
4
+ import { n as __require, t as __commonJSMin } from "./chunk-DNRtMIoB.mjs";
5
+ //#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/execAsync.js
6
6
  var require_execAsync = /* @__PURE__ */ __commonJSMin(((exports) => {
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.execAsync = void 0;
@@ -1,14 +1,14 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as RouterError } from "../router-CrMLXoOr.mjs";
4
+ import { n as RouterError } from "../router-BT_F5748.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import { i as assertExists } from "../std__assert-CRDpx_HF.mjs";
7
7
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
9
- import { r as createFederationBuilder } from "../builder-DQ2zYTeA.mjs";
10
- import { test } from "@fedify/fixture";
9
+ import { r as createFederationBuilder } from "../builder-BkRRjxzb.mjs";
11
10
  import { Activity, Note, Person } from "@fedify/vocab";
11
+ import { test } from "@fedify/fixture";
12
12
  //#region src/federation/builder.test.ts
13
13
  test("FederationBuilder", async (t) => {
14
14
  await t.step("should build a Federation object with registered components", async () => {
@@ -1,19 +1,19 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-7Azky82W.mjs";
4
+ import { n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-BAE7AKLA.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import { r as assertGreaterOrEqual } from "../std__assert-CRDpx_HF.mjs";
7
7
  import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
8
8
  import { t as assert } from "../assert-DikXweDx.mjs";
9
9
  import { r as parseAcceptSignature } from "../accept-CceiKpCy.mjs";
10
- import { s as signRequest } from "../http-QHJGzUe8.mjs";
10
+ import { s as signRequest } from "../http-5G18W3NP.mjs";
11
11
  import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-C3kae-6B.mjs";
12
12
  import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
13
- import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-DsGmXfXz.mjs";
13
+ import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-BXnhAGF9.mjs";
14
14
  import { t as ActivityListenerSet } from "../activity-listener-tztVvlNb.mjs";
15
- import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
15
  import { Activity, Create, Note, Person, Tombstone } from "@fedify/vocab";
16
+ import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
17
17
  import { FetchError } from "@fedify/vocab-runtime";
18
18
  //#region src/federation/handler.test.ts
19
19
  const QUOTE_CONTEXT_TERMS = {
@@ -2001,6 +2001,88 @@ test("handleInbox() records OpenTelemetry span events", async () => {
2001
2001
  assertGreaterOrEqual(durations[0].value, 0);
2002
2002
  assertEquals(durations[0].attributes["activitypub.activity.type"], "https://www.w3.org/ns/activitystreams#Create");
2003
2003
  });
2004
+ test("handleInbox() records fedify.queue.task.enqueued when queued", async () => {
2005
+ const [meterProvider, recorder] = createTestMeterProvider();
2006
+ const kv = new MemoryKvStore();
2007
+ const federation = createFederation({
2008
+ kv,
2009
+ meterProvider
2010
+ });
2011
+ const activity = new Create({
2012
+ id: new URL("https://example.com/activities/queued"),
2013
+ actor: new URL("https://example.com/users/someone"),
2014
+ object: new Note({
2015
+ id: new URL("https://example.com/note-queued"),
2016
+ content: "Queue me up"
2017
+ })
2018
+ });
2019
+ const signed = await signRequest(new Request("https://example.com/users/someone/inbox", {
2020
+ method: "POST",
2021
+ headers: { "Content-Type": "application/activity+json" },
2022
+ body: JSON.stringify(await activity.toJsonLd())
2023
+ }), rsaPrivateKey3, new URL("https://example.com/users/someone#main-key"));
2024
+ const context = createRequestContext({
2025
+ federation,
2026
+ request: signed,
2027
+ url: new URL(signed.url),
2028
+ data: void 0,
2029
+ documentLoader: mockDocumentLoader,
2030
+ contextLoader: mockDocumentLoader,
2031
+ getActorUri(identifier) {
2032
+ return new URL(`https://example.com/users/${identifier}`);
2033
+ }
2034
+ });
2035
+ const actorDispatcher = (ctx, identifier) => {
2036
+ if (identifier !== "someone") return null;
2037
+ return new Person({
2038
+ id: ctx.getActorUri(identifier),
2039
+ name: "Someone",
2040
+ inbox: new URL("https://example.com/users/someone/inbox"),
2041
+ publicKey: rsaPublicKey2
2042
+ });
2043
+ };
2044
+ const queuedMessages = [];
2045
+ assertEquals((await handleInbox(signed, {
2046
+ recipient: "someone",
2047
+ context,
2048
+ inboxContextFactory(_activity) {
2049
+ return createInboxContext({
2050
+ ...context,
2051
+ clone: void 0
2052
+ });
2053
+ },
2054
+ kv,
2055
+ kvPrefixes: {
2056
+ activityIdempotence: ["activityIdempotence"],
2057
+ publicKey: ["publicKey"],
2058
+ acceptSignatureNonce: ["acceptSignatureNonce"]
2059
+ },
2060
+ actorDispatcher,
2061
+ inboxListeners: new ActivityListenerSet(),
2062
+ inboxErrorHandler: void 0,
2063
+ onNotFound: (_request) => new Response("Not found", { status: 404 }),
2064
+ signatureTimeWindow: false,
2065
+ skipSignatureVerification: true,
2066
+ queue: {
2067
+ enqueue(message, _options) {
2068
+ queuedMessages.push(message);
2069
+ return Promise.resolve();
2070
+ },
2071
+ listen(_handler, _options) {
2072
+ return Promise.resolve();
2073
+ }
2074
+ },
2075
+ meterProvider
2076
+ })).status, 202);
2077
+ assertEquals(queuedMessages.length, 1);
2078
+ const enqueued = recorder.getMeasurements("fedify.queue.task.enqueued");
2079
+ assertEquals(enqueued.length, 1);
2080
+ assertEquals(enqueued[0].type, "counter");
2081
+ assertEquals(enqueued[0].attributes["fedify.queue.role"], "inbox");
2082
+ assertEquals(enqueued[0].attributes["fedify.queue.task.attempt"], 0);
2083
+ assertEquals(enqueued[0].attributes["activitypub.activity.type"], "https://www.w3.org/ns/activitystreams#Create");
2084
+ assertEquals(enqueued[0].attributes["fedify.queue.backend"], void 0);
2085
+ });
2004
2086
  test("handleInbox() records unverified HTTP signature details", async () => {
2005
2087
  const [tracerProvider, exporter] = createTestTracerProvider();
2006
2088
  const [meterProvider, recorder] = createTestMeterProvider();
@@ -4,11 +4,11 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import "../std__assert-CRDpx_HF.mjs";
6
6
  import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
7
- import { r as signObject } from "../proof-C3q2IhUr.mjs";
7
+ import { r as signObject } from "../proof-erpV_J_n.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
9
- import { o as createFederation } from "../middleware-DsGmXfXz.mjs";
10
- import { mockDocumentLoader, test } from "@fedify/fixture";
9
+ import { o as createFederation } from "../middleware-BXnhAGF9.mjs";
11
10
  import { Create, Follow, Person } from "@fedify/vocab";
11
+ import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  //#region src/federation/idempotency.test.ts
13
13
  const kv = new MemoryKvStore();
14
14
  const federationOptions = {
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
6
6
  import { t as ActivityListenerSet } from "../activity-listener-tztVvlNb.mjs";
7
- import { test } from "@fedify/fixture";
8
7
  import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
8
+ import { test } from "@fedify/fixture";
9
9
  //#region src/federation/inbox.test.ts
10
10
  test("ActivityListenerSet", () => {
11
11
  const listeners = new ActivityListenerSet();
@@ -6,8 +6,8 @@ import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
6
6
  import { t as assert } from "../assert-DikXweDx.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
8
8
  import { t as KvKeyCache } from "../keycache-BeU0LCII.mjs";
9
- import { test } from "@fedify/fixture";
10
9
  import { CryptographicKey, Multikey } from "@fedify/vocab";
10
+ import { test } from "@fedify/fixture";
11
11
  //#region src/federation/keycache.test.ts
12
12
  test("KvKeyCache.set()", async () => {
13
13
  const kv = new MemoryKvStore();