@fedify/fedify 2.0.29-dev.2143 → 2.0.30-dev.2188

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 (47) hide show
  1. package/dist/{builder-CuFZFNTx.mjs → builder-Cqe70CNU.mjs} +11 -3
  2. package/dist/compat/transformers.test.mjs +1 -1
  3. package/dist/{deno-gzW01cMG.mjs → deno-BsD15fKn.mjs} +1 -1
  4. package/dist/{docloader-DW-UgR6o.mjs → docloader-CE__4Qj3.mjs} +2 -2
  5. package/dist/federation/builder.test.mjs +37 -2
  6. package/dist/federation/handler.test.mjs +6 -6
  7. package/dist/federation/idempotency.test.mjs +2 -2
  8. package/dist/federation/inbox.test.mjs +1 -1
  9. package/dist/federation/middleware.test.mjs +47 -6
  10. package/dist/federation/mod.cjs +1 -1
  11. package/dist/federation/mod.js +1 -1
  12. package/dist/federation/send.test.mjs +3 -3
  13. package/dist/federation/temporal.test.mjs +1 -1
  14. package/dist/federation/webfinger.test.mjs +1 -1
  15. package/dist/{http-DCMS1UsO.js → http-BtJKFrZy.js} +1 -1
  16. package/dist/{http-BjfKj845.cjs → http-OnBi3XC0.cjs} +1 -1
  17. package/dist/{http-KxgJKEhF.mjs → http-rTMkknPp.mjs} +2 -2
  18. package/dist/{inbox-ByhUuvHp.mjs → inbox-6VCFv55P.mjs} +1 -1
  19. package/dist/{key-DK65oVQg.mjs → key-D8Osvomp.mjs} +1 -1
  20. package/dist/{kv-cache-4PJQF26S.cjs → kv-cache-3xwWysXy.cjs} +1 -1
  21. package/dist/{kv-cache-CnJnTcyv.js → kv-cache-CxlZoYUf.js} +1 -1
  22. package/dist/{ld-CkhxuQKE.mjs → ld-inJTyOFb.mjs} +2 -2
  23. package/dist/{middleware-BrhLLYbZ.cjs → middleware-AYpiVPOt.cjs} +1 -1
  24. package/dist/{middleware-Kd08zJtj.mjs → middleware-ByI05pM6.mjs} +1 -1
  25. package/dist/{middleware-s7WxQ4ac.cjs → middleware-CNHi9xWP.cjs} +19 -9
  26. package/dist/{middleware-fe8Y1tqE.js → middleware-CTVodxyp.js} +18 -8
  27. package/dist/{middleware-CT46Re-o.mjs → middleware-DQINgr9t.mjs} +18 -16
  28. package/dist/mod.cjs +4 -4
  29. package/dist/mod.js +4 -4
  30. package/dist/nodeinfo/handler.test.mjs +1 -1
  31. package/dist/{owner-DOeeThGK.mjs → owner-D2-e-1Ni.mjs} +2 -2
  32. package/dist/{proof-dP19tIYO.cjs → proof-BZBpDiWm.cjs} +1 -1
  33. package/dist/{proof-CIp6SzLJ.js → proof-D5OKiIO7.js} +1 -1
  34. package/dist/{proof-CX04YEdf.mjs → proof-DTpedXfN.mjs} +2 -2
  35. package/dist/{send-Ce-4x3da.mjs → send-pVpOxvSY.mjs} +2 -2
  36. package/dist/sig/http.test.mjs +2 -2
  37. package/dist/sig/key.test.mjs +1 -1
  38. package/dist/sig/ld.test.mjs +2 -2
  39. package/dist/sig/mod.cjs +2 -2
  40. package/dist/sig/mod.js +2 -2
  41. package/dist/sig/owner.test.mjs +1 -1
  42. package/dist/sig/proof.test.mjs +1 -1
  43. package/dist/{temporal-DFEjA29B.mjs → temporal-olrG5C1U.mjs} +1 -1
  44. package/dist/utils/docloader.test.mjs +2 -2
  45. package/dist/utils/mod.cjs +1 -1
  46. package/dist/utils/mod.js +1 -1
  47. package/package.json +6 -6
@@ -2,8 +2,8 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as RouterError, t as Router } from "./router-CrMLXoOr.mjs";
5
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
6
- import { t as InboxListenerSet } from "./inbox-ByhUuvHp.mjs";
5
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-6VCFv55P.mjs";
7
7
  import { getTypeId } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { getLogger } from "@logtape/logtape";
@@ -34,6 +34,7 @@ var FederationBuilderImpl = class {
34
34
  * Symbol registry for unique identification of unnamed symbols.
35
35
  */
36
36
  #symbolRegistry = /* @__PURE__ */ new Map();
37
+ #collectionNames = /* @__PURE__ */ new Map();
37
38
  constructor() {
38
39
  this.router = new Router();
39
40
  this.objectCallbacks = {};
@@ -42,7 +43,7 @@ var FederationBuilderImpl = class {
42
43
  this.collectionTypeIds = {};
43
44
  }
44
45
  async build(options) {
45
- const { FederationImpl } = await import("./middleware-Kd08zJtj.mjs");
46
+ const { FederationImpl } = await import("./middleware-ByI05pM6.mjs");
46
47
  const f = new FederationImpl(options);
47
48
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
48
49
  f.router = this.router.clone();
@@ -55,6 +56,8 @@ var FederationBuilderImpl = class {
55
56
  f.objectTypeIds = { ...this.objectTypeIds };
56
57
  f.collectionCallbacks = { ...this.collectionCallbacks };
57
58
  f.collectionTypeIds = { ...this.collectionTypeIds };
59
+ f.#symbolRegistry = new Map(this.#symbolRegistry);
60
+ f.#collectionNames = new Map(this.#collectionNames);
58
61
  f.inboxPath = this.inboxPath;
59
62
  f.inboxCallbacks = this.inboxCallbacks == null ? void 0 : { ...this.inboxCallbacks };
60
63
  f.outboxCallbacks = this.outboxCallbacks == null ? void 0 : { ...this.outboxCallbacks };
@@ -462,6 +465,7 @@ var FederationBuilderImpl = class {
462
465
  if (this.router.has(routeName)) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
463
466
  if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
464
467
  if (this.router.add(path, routeName).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
468
+ this.#collectionNames.set(routeName, name);
465
469
  const callbacks = { dispatcher };
466
470
  this.collectionCallbacks[name] = callbacks;
467
471
  this.collectionTypeIds[name] = itemType;
@@ -498,6 +502,10 @@ var FederationBuilderImpl = class {
498
502
  const routeName = this.#uniqueCollectionId(name);
499
503
  return this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
500
504
  }
505
+ /** Resolves a custom collection route to its original name. */
506
+ getCollectionName(routeName) {
507
+ return this.#collectionNames.get(routeName) ?? routeName.replace(/^(collection|orderedCollection):/, "");
508
+ }
501
509
  setOutboxPermanentFailureHandler(handler) {
502
510
  this.outboxPermanentFailureHandler = handler;
503
511
  }
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
6
6
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
7
- import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-CT46Re-o.mjs";
7
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-DQINgr9t.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  import { Follow, Person } from "@fedify/vocab";
10
10
  //#region src/compat/transformers.test.ts
@@ -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.0.29-dev.2143+bbbfea55";
6
+ var version = "2.0.30-dev.2188+c9867532";
7
7
  //#endregion
8
8
  export { version as n, name as t };
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { o as validateCryptoKey } from "./key-DK65oVQg.mjs";
5
- import { n as doubleKnock } from "./http-KxgJKEhF.mjs";
4
+ import { o as validateCryptoKey } from "./key-D8Osvomp.mjs";
5
+ import { n as doubleKnock } from "./http-rTMkknPp.mjs";
6
6
  import { curry } from "es-toolkit";
7
7
  import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -2,10 +2,10 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import { i as assertExists } from "../std__assert-BUOJXi-Z.mjs";
5
+ import { i as assertExists, n as assertStrictEquals } from "../std__assert-BUOJXi-Z.mjs";
6
6
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { n as createFederationBuilder } from "../builder-CuFZFNTx.mjs";
8
+ import { n as createFederationBuilder } from "../builder-Cqe70CNU.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Activity, Note, Person } from "@fedify/vocab";
11
11
  //#region src/federation/builder.test.ts
@@ -161,6 +161,41 @@ test("FederationBuilder", async (t) => {
161
161
  assertEquals(impl.collectionTypeIds["test"], Note);
162
162
  assertEquals((await impl.fetch(new Request("https://example.com/c/x", { headers: { accept: "application/activity+json" } }), { contextData: void 0 })).status, 200);
163
163
  });
164
+ await t.step("preserves symbol-named collections through build()", async () => {
165
+ const builder = createFederationBuilder();
166
+ const collection = Symbol("saved");
167
+ const ordered = Symbol("saved");
168
+ builder.setCollectionDispatcher(collection, Note, "/users/{identifier}/saved", () => ({ items: [] }));
169
+ builder.setOrderedCollectionDispatcher(ordered, Note, "/users/{identifier}/ordered-saved", () => ({ items: [] }));
170
+ for (let build = 0; build < 2; build++) {
171
+ const federation = await builder.build({ kv: new MemoryKvStore() });
172
+ const ctx = federation.createContext(new URL("https://example.com/"));
173
+ for (const [name, path, type] of [[
174
+ collection,
175
+ "/users/alice/saved",
176
+ "collection"
177
+ ], [
178
+ ordered,
179
+ "/users/alice/ordered-saved",
180
+ "orderedCollection"
181
+ ]]) {
182
+ const uri = ctx.getCollectionUri(name, { identifier: "alice" });
183
+ assertEquals(uri.pathname, path);
184
+ const parsed = ctx.parseUri(uri);
185
+ assertEquals(parsed?.type, type);
186
+ if (parsed?.type !== "collection" && parsed?.type !== "orderedCollection") throw new Error("Expected a custom collection URI");
187
+ assertStrictEquals(parsed.name, name);
188
+ assertStrictEquals(parsed.class, Note);
189
+ assertEquals(parsed.values, { identifier: "alice" });
190
+ for (const cursor of [null, "next"]) {
191
+ const pageUri = new URL(uri);
192
+ if (cursor != null) pageUri.searchParams.set("cursor", cursor);
193
+ assertEquals((await federation.fetch(new Request(pageUri, { headers: { accept: "application/activity+json" } }), { contextData: void 0 })).status, 200);
194
+ }
195
+ }
196
+ assertThrows(() => federation.setCollectionDispatcher(collection, Note, "/users/{identifier}/duplicate", () => ({ items: [] })));
197
+ }
198
+ });
164
199
  });
165
200
  //#endregion
166
201
  export {};
@@ -6,14 +6,14 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-BUOJXi-Z.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { t as assert } from "../assert-BhQd8QHP.mjs";
9
- import { i as generateCryptoKeyPair } from "../key-DK65oVQg.mjs";
10
- import { s as signRequest } from "../http-KxgJKEhF.mjs";
9
+ import { i as generateCryptoKeyPair } from "../key-D8Osvomp.mjs";
10
+ import { s as signRequest } from "../http-rTMkknPp.mjs";
11
11
  import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
12
- import { a as compactJsonLd, f as signJsonLd } from "../ld-CkhxuQKE.mjs";
13
- import { n as signObject } from "../proof-CX04YEdf.mjs";
12
+ import { a as compactJsonLd, f as signJsonLd } from "../ld-inJTyOFb.mjs";
13
+ import { n as signObject } from "../proof-DTpedXfN.mjs";
14
14
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
15
- import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-CT46Re-o.mjs";
16
- import { t as InboxListenerSet } from "../inbox-ByhUuvHp.mjs";
15
+ import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-DQINgr9t.mjs";
16
+ import { t as InboxListenerSet } from "../inbox-6VCFv55P.mjs";
17
17
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
18
  import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
19
19
  //#region src/federation/handler.test.ts
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import "../std__assert-BUOJXi-Z.mjs";
6
6
  import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
7
- import { n as signObject } from "../proof-CX04YEdf.mjs";
7
+ import { n as signObject } from "../proof-DTpedXfN.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
9
- import { a as createFederation } from "../middleware-CT46Re-o.mjs";
9
+ import { a as createFederation } from "../middleware-DQINgr9t.mjs";
10
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, Follow, Person } from "@fedify/vocab";
12
12
  //#region src/federation/idempotency.test.ts
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
3
3
  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
- import { t as InboxListenerSet } from "../inbox-ByhUuvHp.mjs";
6
+ import { t as InboxListenerSet } from "../inbox-6VCFv55P.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
9
9
  //#region src/federation/inbox.test.ts
@@ -9,14 +9,14 @@ import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z
9
9
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
10
10
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
11
11
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
12
- import { l as verifyRequest, s as signRequest } from "../http-KxgJKEhF.mjs";
12
+ import { l as verifyRequest, s as signRequest } from "../http-rTMkknPp.mjs";
13
13
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
14
- import { t as getAuthenticatedDocumentLoader } from "../docloader-DW-UgR6o.mjs";
15
- import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-CkhxuQKE.mjs";
16
- import { t as doesActorOwnKey } from "../owner-DOeeThGK.mjs";
17
- import { n as signObject, r as verifyObject } from "../proof-CX04YEdf.mjs";
14
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-CE__4Qj3.mjs";
15
+ import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-inJTyOFb.mjs";
16
+ import { t as doesActorOwnKey } from "../owner-D2-e-1Ni.mjs";
17
+ import { n as signObject, r as verifyObject } from "../proof-DTpedXfN.mjs";
18
18
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
19
- import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-CT46Re-o.mjs";
19
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-DQINgr9t.mjs";
20
20
  import { mockDocumentLoader, test } from "@fedify/fixture";
21
21
  import * as vocab from "@fedify/vocab";
22
22
  import { Create, Offer, Person, getTypeId, lookupObject } from "@fedify/vocab";
@@ -3656,6 +3656,47 @@ test("ContextImpl.getCollectionUri()", () => {
3656
3656
  assertThrows(() => ctx.getCollectionUri(Symbol(notReg), values));
3657
3657
  assertThrows(() => ctx.getCollectionUri(Symbol.for(notReg), values));
3658
3658
  });
3659
+ test("symbol-named custom collections are served and parsed", async () => {
3660
+ const federation = createFederation({ kv: new MemoryKvStore() });
3661
+ const names = [Symbol("bookmarks"), Symbol("bookmarks")];
3662
+ const paths = ["bookmarks", "ordered-bookmarks"];
3663
+ const calls = [];
3664
+ federation.setCollectionDispatcher(names[0], vocab.Object, "/users/{identifier}/bookmarks", (_ctx, _values, cursor) => {
3665
+ calls.push([0, cursor]);
3666
+ return { items: [] };
3667
+ });
3668
+ federation.setOrderedCollectionDispatcher(names[1], vocab.Object, "/users/{identifier}/ordered-bookmarks", (_ctx, _values, cursor) => {
3669
+ calls.push([1, cursor]);
3670
+ return { items: [] };
3671
+ });
3672
+ const ctx = federation.createContext(new URL("https://example.com/"));
3673
+ for (const [index, name] of names.entries()) {
3674
+ const uri = ctx.getCollectionUri(name, { identifier: "alice" });
3675
+ assertEquals(uri.pathname, `/users/alice/${paths[index]}`);
3676
+ const parsed = ctx.parseUri(uri);
3677
+ assertEquals(parsed?.type, index === 0 ? "collection" : "orderedCollection");
3678
+ if (parsed?.type !== "collection" && parsed?.type !== "orderedCollection") throw new Error("Expected a custom collection URI");
3679
+ assertStrictEquals(parsed.name, name);
3680
+ assertStrictEquals(parsed.class, vocab.Object);
3681
+ assertEquals(parsed.typeId, vocab.Object.typeId);
3682
+ assertEquals(parsed.values, { identifier: "alice" });
3683
+ for (const cursor of [null, "next"]) {
3684
+ const pageUri = new URL(uri);
3685
+ if (cursor != null) pageUri.searchParams.set("cursor", cursor);
3686
+ const response = await federation.fetch(new Request(pageUri, { headers: { accept: "application/activity+json" } }), { contextData: void 0 });
3687
+ assertEquals(response.status, 200);
3688
+ const body = await response.json();
3689
+ assert(body !== null && typeof body === "object" && "type" in body);
3690
+ assertEquals(body.type, `${index === 0 ? "Collection" : "OrderedCollection"}${cursor == null ? "" : "Page"}`);
3691
+ }
3692
+ }
3693
+ assertEquals(calls, [
3694
+ [0, null],
3695
+ [0, "next"],
3696
+ [1, null],
3697
+ [1, "next"]
3698
+ ]);
3699
+ });
3659
3700
  test("InboxContextImpl.forwardActivity()", async (t) => {
3660
3701
  esm_default.spyGlobal();
3661
3702
  let verified = null;
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("../chunk-DDcVe30Y.cjs");
5
- const require_middleware = require("../middleware-s7WxQ4ac.cjs");
5
+ const require_middleware = require("../middleware-CNHi9xWP.cjs");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  //#region src/federation/kv.ts
8
8
  /**
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-fe8Y1tqE.js";
3
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-CTVodxyp.js";
4
4
  import { isEqual } from "es-toolkit";
5
5
  //#region src/federation/kv.ts
6
6
  /**
@@ -7,10 +7,10 @@ import "../std__assert-BUOJXi-Z.mjs";
7
7
  import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
10
- import { l as verifyRequest } from "../http-KxgJKEhF.mjs";
10
+ import { l as verifyRequest } from "../http-rTMkknPp.mjs";
11
11
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
12
- import { t as doesActorOwnKey } from "../owner-DOeeThGK.mjs";
13
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-Ce-4x3da.mjs";
12
+ import { t as doesActorOwnKey } from "../owner-D2-e-1Ni.mjs";
13
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-pVpOxvSY.mjs";
14
14
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
15
15
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
16
16
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-BUOJXi-Z.mjs";
5
5
  import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
6
6
  import { t as assert } from "../assert-BhQd8QHP.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-DFEjA29B.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-olrG5C1U.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/temporal.test.ts
10
10
  test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-BUOJXi-Z.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-CT46Re-o.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-DQINgr9t.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Image, Link, Person } from "@fedify/vocab";
11
11
  //#region src/federation/webfinger.test.ts
@@ -10,7 +10,7 @@ import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
10
10
  import { Item, decodeDict, encodeItem } from "structured-field-values";
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "2.0.29-dev.2143+bbbfea55";
13
+ var version = "2.0.30-dev.2188+c9867532";
14
14
  //#endregion
15
15
  //#region src/sig/key.ts
16
16
  /**
@@ -11,7 +11,7 @@ let byte_encodings_base64 = require("byte-encodings/base64");
11
11
  let structured_field_values = require("structured-field-values");
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "2.0.29-dev.2143+bbbfea55";
14
+ var version = "2.0.30-dev.2188+c9867532";
15
15
  //#endregion
16
16
  //#region src/sig/key.ts
17
17
  /**
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-DK65oVQg.mjs";
4
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-D8Osvomp.mjs";
6
6
  import { CryptographicKey } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { FetchError } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
4
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
5
5
  import { Activity, getTypeId } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
7
7
  import { getLogger } from "@logtape/logtape";
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
4
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
5
5
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-BjfKj845.cjs");
4
+ const require_http = require("./http-OnBi3XC0.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { l as validateCryptoKey, t as doubleKnock } from "./http-DCMS1UsO.js";
3
+ import { l as validateCryptoKey, t as doubleKnock } from "./http-BtJKFrZy.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { curry } from "es-toolkit";
6
6
  import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-DK65oVQg.mjs";
4
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-D8Osvomp.mjs";
6
6
  import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -1,4 +1,4 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_middleware = require("./middleware-s7WxQ4ac.cjs");
3
+ const require_middleware = require("./middleware-CNHi9xWP.cjs");
4
4
  exports.FederationImpl = require_middleware.FederationImpl;
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-CT46Re-o.mjs";
4
+ import { n as FederationImpl } from "./middleware-DQINgr9t.mjs";
5
5
  export { FederationImpl };
@@ -2,10 +2,10 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
4
  const require_transformers = require("./transformers-NeAONrAq.cjs");
5
- const require_http = require("./http-BjfKj845.cjs");
5
+ const require_http = require("./http-OnBi3XC0.cjs");
6
6
  const require_types = require("./types-DRPjmHVV.cjs");
7
- const require_proof = require("./proof-dP19tIYO.cjs");
8
- const require_kv_cache = require("./kv-cache-4PJQF26S.cjs");
7
+ const require_proof = require("./proof-BZBpDiWm.cjs");
8
+ const require_kv_cache = require("./kv-cache-3xwWysXy.cjs");
9
9
  let _logtape_logtape = require("@logtape/logtape");
10
10
  let _fedify_vocab = require("@fedify/vocab");
11
11
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -327,6 +327,7 @@ var FederationBuilderImpl = class {
327
327
  * Symbol registry for unique identification of unnamed symbols.
328
328
  */
329
329
  #symbolRegistry = /* @__PURE__ */ new Map();
330
+ #collectionNames = /* @__PURE__ */ new Map();
330
331
  constructor() {
331
332
  this.router = new Router();
332
333
  this.objectCallbacks = {};
@@ -335,7 +336,7 @@ var FederationBuilderImpl = class {
335
336
  this.collectionTypeIds = {};
336
337
  }
337
338
  async build(options) {
338
- const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-BrhLLYbZ.cjs"));
339
+ const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-AYpiVPOt.cjs"));
339
340
  const f = new FederationImpl(options);
340
341
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
341
342
  f.router = this.router.clone();
@@ -348,6 +349,8 @@ var FederationBuilderImpl = class {
348
349
  f.objectTypeIds = { ...this.objectTypeIds };
349
350
  f.collectionCallbacks = { ...this.collectionCallbacks };
350
351
  f.collectionTypeIds = { ...this.collectionTypeIds };
352
+ f.#symbolRegistry = new Map(this.#symbolRegistry);
353
+ f.#collectionNames = new Map(this.#collectionNames);
351
354
  f.inboxPath = this.inboxPath;
352
355
  f.inboxCallbacks = this.inboxCallbacks == null ? void 0 : { ...this.inboxCallbacks };
353
356
  f.outboxCallbacks = this.outboxCallbacks == null ? void 0 : { ...this.outboxCallbacks };
@@ -755,6 +758,7 @@ var FederationBuilderImpl = class {
755
758
  if (this.router.has(routeName)) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
756
759
  if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
757
760
  if (this.router.add(path, routeName).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
761
+ this.#collectionNames.set(routeName, name);
758
762
  const callbacks = { dispatcher };
759
763
  this.collectionCallbacks[name] = callbacks;
760
764
  this.collectionTypeIds[name] = itemType;
@@ -791,6 +795,10 @@ var FederationBuilderImpl = class {
791
795
  const routeName = this.#uniqueCollectionId(name);
792
796
  return this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
793
797
  }
798
+ /** Resolves a custom collection route to its original name. */
799
+ getCollectionName(routeName) {
800
+ return this.#collectionNames.get(routeName) ?? routeName.replace(/^(collection|orderedCollection):/, "");
801
+ }
794
802
  setOutboxPermanentFailureHandler(handler) {
795
803
  this.outboxPermanentFailureHandler = handler;
796
804
  }
@@ -3606,10 +3614,10 @@ var FederationImpl = class extends FederationBuilderImpl {
3606
3614
  onNotFound
3607
3615
  });
3608
3616
  case "collection": {
3609
- const name = route.name.replace(/^collection:/, "");
3617
+ const name = this.getCollectionName(route.name);
3610
3618
  const callbacks = this.collectionCallbacks[name];
3611
3619
  return await handleCustomCollection(request, {
3612
- name,
3620
+ name: String(name),
3613
3621
  context,
3614
3622
  values: route.values,
3615
3623
  collectionCallbacks: callbacks,
@@ -3619,10 +3627,10 @@ var FederationImpl = class extends FederationBuilderImpl {
3619
3627
  });
3620
3628
  }
3621
3629
  case "orderedCollection": {
3622
- const name = route.name.replace(/^orderedCollection:/, "");
3630
+ const name = this.getCollectionName(route.name);
3623
3631
  const callbacks = this.collectionCallbacks[name];
3624
3632
  return await handleOrderedCollection(request, {
3625
- name,
3633
+ name: String(name),
3626
3634
  context,
3627
3635
  values: route.values,
3628
3636
  collectionCallbacks: callbacks,
@@ -3805,8 +3813,10 @@ var ContextImpl = class ContextImpl {
3805
3813
  const collectionRegex = new RegExp(`^(${["collection", "orderedCollection"].join("|")}):(.*)$`);
3806
3814
  const match = route.name.match(collectionRegex);
3807
3815
  if (match !== null) {
3808
- const [, type, name] = match;
3816
+ const [, type] = match;
3817
+ const name = this.federation.getCollectionName(route.name);
3809
3818
  const cls = this.federation.collectionTypeIds[name];
3819
+ if (cls == null) return null;
3810
3820
  return {
3811
3821
  type,
3812
3822
  name,
@@ -2,10 +2,10 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./chunk-CRNNMoPX.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-BGMIq1cs.js";
5
- import { c as importJwk, d as name, f as version, i as exportJwk, l as validateCryptoKey, r as verifyRequest, t as doubleKnock } from "./http-DCMS1UsO.js";
5
+ import { c as importJwk, d as name, f as version, i as exportJwk, l as validateCryptoKey, r as verifyRequest, t as doubleKnock } from "./http-BtJKFrZy.js";
6
6
  import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-miAYfiGO.js";
7
- import { _ as signJsonLd, a as doesActorOwnKey, c as assertSafeJsonLd, f as detachSignature, g as isInvalidUrlTypeError, h as isClearlyMalformedContextReference, m as hasSignature, n as signObject, o as getKeyOwner, p as getNormalizationContextLoader, r as verifyObject, s as InvalidContextReferenceError, u as compactJsonLd, v as verifyCompactJsonLd, x as wrapContextLoaderForJsonLd } from "./proof-CIp6SzLJ.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CnJnTcyv.js";
7
+ import { _ as signJsonLd, a as doesActorOwnKey, c as assertSafeJsonLd, f as detachSignature, g as isInvalidUrlTypeError, h as isClearlyMalformedContextReference, m as hasSignature, n as signObject, o as getKeyOwner, p as getNormalizationContextLoader, r as verifyObject, s as InvalidContextReferenceError, u as compactJsonLd, v as verifyCompactJsonLd, x as wrapContextLoaderForJsonLd } from "./proof-D5OKiIO7.js";
8
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CxlZoYUf.js";
9
9
  import { getLogger, withContext } from "@logtape/logtape";
10
10
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
11
11
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -326,6 +326,7 @@ var FederationBuilderImpl = class {
326
326
  * Symbol registry for unique identification of unnamed symbols.
327
327
  */
328
328
  #symbolRegistry = /* @__PURE__ */ new Map();
329
+ #collectionNames = /* @__PURE__ */ new Map();
329
330
  constructor() {
330
331
  this.router = new Router$1();
331
332
  this.objectCallbacks = {};
@@ -347,6 +348,8 @@ var FederationBuilderImpl = class {
347
348
  f.objectTypeIds = { ...this.objectTypeIds };
348
349
  f.collectionCallbacks = { ...this.collectionCallbacks };
349
350
  f.collectionTypeIds = { ...this.collectionTypeIds };
351
+ f.#symbolRegistry = new Map(this.#symbolRegistry);
352
+ f.#collectionNames = new Map(this.#collectionNames);
350
353
  f.inboxPath = this.inboxPath;
351
354
  f.inboxCallbacks = this.inboxCallbacks == null ? void 0 : { ...this.inboxCallbacks };
352
355
  f.outboxCallbacks = this.outboxCallbacks == null ? void 0 : { ...this.outboxCallbacks };
@@ -754,6 +757,7 @@ var FederationBuilderImpl = class {
754
757
  if (this.router.has(routeName)) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
755
758
  if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
756
759
  if (this.router.add(path, routeName).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
760
+ this.#collectionNames.set(routeName, name);
757
761
  const callbacks = { dispatcher };
758
762
  this.collectionCallbacks[name] = callbacks;
759
763
  this.collectionTypeIds[name] = itemType;
@@ -790,6 +794,10 @@ var FederationBuilderImpl = class {
790
794
  const routeName = this.#uniqueCollectionId(name);
791
795
  return this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
792
796
  }
797
+ /** Resolves a custom collection route to its original name. */
798
+ getCollectionName(routeName) {
799
+ return this.#collectionNames.get(routeName) ?? routeName.replace(/^(collection|orderedCollection):/, "");
800
+ }
793
801
  setOutboxPermanentFailureHandler(handler) {
794
802
  this.outboxPermanentFailureHandler = handler;
795
803
  }
@@ -3612,10 +3620,10 @@ var FederationImpl = class extends FederationBuilderImpl {
3612
3620
  onNotFound
3613
3621
  });
3614
3622
  case "collection": {
3615
- const name = route.name.replace(/^collection:/, "");
3623
+ const name = this.getCollectionName(route.name);
3616
3624
  const callbacks = this.collectionCallbacks[name];
3617
3625
  return await handleCustomCollection(request, {
3618
- name,
3626
+ name: String(name),
3619
3627
  context,
3620
3628
  values: route.values,
3621
3629
  collectionCallbacks: callbacks,
@@ -3625,10 +3633,10 @@ var FederationImpl = class extends FederationBuilderImpl {
3625
3633
  });
3626
3634
  }
3627
3635
  case "orderedCollection": {
3628
- const name = route.name.replace(/^orderedCollection:/, "");
3636
+ const name = this.getCollectionName(route.name);
3629
3637
  const callbacks = this.collectionCallbacks[name];
3630
3638
  return await handleOrderedCollection(request, {
3631
- name,
3639
+ name: String(name),
3632
3640
  context,
3633
3641
  values: route.values,
3634
3642
  collectionCallbacks: callbacks,
@@ -3811,8 +3819,10 @@ var ContextImpl = class ContextImpl {
3811
3819
  const collectionRegex = new RegExp(`^(${["collection", "orderedCollection"].join("|")}):(.*)$`);
3812
3820
  const match = route.name.match(collectionRegex);
3813
3821
  if (match !== null) {
3814
- const [, type, name] = match;
3822
+ const [, type] = match;
3823
+ const name = this.federation.getCollectionName(route.name);
3815
3824
  const cls = this.federation.collectionTypeIds[name];
3825
+ if (cls == null) return null;
3816
3826
  return {
3817
3827
  type,
3818
3828
  name,
@@ -2,24 +2,24 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as RouterError } from "./router-CrMLXoOr.mjs";
5
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
6
- import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-DK65oVQg.mjs";
7
- import { l as verifyRequest } from "./http-KxgJKEhF.mjs";
8
- import { t as getAuthenticatedDocumentLoader } from "./docloader-DW-UgR6o.mjs";
5
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
6
+ import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-D8Osvomp.mjs";
7
+ import { l as verifyRequest } from "./http-rTMkknPp.mjs";
8
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-CE__4Qj3.mjs";
9
9
  import { n as kvCache } from "./kv-cache-BrjuJue8.mjs";
10
- import { a as compactJsonLd, c as getNormalizationContextLoader, d as isInvalidUrlTypeError, f as signJsonLd, g as wrapContextLoaderForJsonLd, l as hasSignature, p as verifyCompactJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as isClearlyMalformedContextReference } from "./ld-CkhxuQKE.mjs";
11
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-DOeeThGK.mjs";
12
- import { n as signObject, r as verifyObject } from "./proof-CX04YEdf.mjs";
10
+ import { a as compactJsonLd, c as getNormalizationContextLoader, d as isInvalidUrlTypeError, f as signJsonLd, g as wrapContextLoaderForJsonLd, l as hasSignature, p as verifyCompactJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as isClearlyMalformedContextReference } from "./ld-inJTyOFb.mjs";
11
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-D2-e-1Ni.mjs";
12
+ import { n as signObject, r as verifyObject } from "./proof-DTpedXfN.mjs";
13
13
  import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-BUqbea1d.mjs";
14
14
  import { t as nodeInfoToJson } from "./types-MNlFfxjv.mjs";
15
- import { n as routeActivity } from "./inbox-ByhUuvHp.mjs";
16
- import { t as FederationBuilderImpl } from "./builder-CuFZFNTx.mjs";
15
+ import { n as routeActivity } from "./inbox-6VCFv55P.mjs";
16
+ import { t as FederationBuilderImpl } from "./builder-Cqe70CNU.mjs";
17
17
  import { t as buildCollectionSynchronizationHeader } from "./collection-DI6YzYpd.mjs";
18
18
  import { t as KvKeyCache } from "./keycache-D239uGT9.mjs";
19
19
  import { t as acceptsJsonLd } from "./negotiation-TWEs6Cl8.mjs";
20
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-DFEjA29B.mjs";
20
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-olrG5C1U.mjs";
21
21
  import { t as createExponentialBackoffPolicy } from "./retry-Ddbq3AcK.mjs";
22
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-Ce-4x3da.mjs";
22
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-pVpOxvSY.mjs";
23
23
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
24
24
  import { lookupWebFinger } from "@fedify/webfinger";
25
25
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -2379,10 +2379,10 @@ var FederationImpl = class extends FederationBuilderImpl {
2379
2379
  onNotFound
2380
2380
  });
2381
2381
  case "collection": {
2382
- const name = route.name.replace(/^collection:/, "");
2382
+ const name = this.getCollectionName(route.name);
2383
2383
  const callbacks = this.collectionCallbacks[name];
2384
2384
  return await handleCustomCollection(request, {
2385
- name,
2385
+ name: String(name),
2386
2386
  context,
2387
2387
  values: route.values,
2388
2388
  collectionCallbacks: callbacks,
@@ -2392,10 +2392,10 @@ var FederationImpl = class extends FederationBuilderImpl {
2392
2392
  });
2393
2393
  }
2394
2394
  case "orderedCollection": {
2395
- const name = route.name.replace(/^orderedCollection:/, "");
2395
+ const name = this.getCollectionName(route.name);
2396
2396
  const callbacks = this.collectionCallbacks[name];
2397
2397
  return await handleOrderedCollection(request, {
2398
- name,
2398
+ name: String(name),
2399
2399
  context,
2400
2400
  values: route.values,
2401
2401
  collectionCallbacks: callbacks,
@@ -2578,8 +2578,10 @@ var ContextImpl = class ContextImpl {
2578
2578
  const collectionRegex = new RegExp(`^(${["collection", "orderedCollection"].join("|")}):(.*)$`);
2579
2579
  const match = route.name.match(collectionRegex);
2580
2580
  if (match !== null) {
2581
- const [, type, name] = match;
2581
+ const [, type] = match;
2582
+ const name = this.federation.getCollectionName(route.name);
2582
2583
  const cls = this.federation.collectionTypeIds[name];
2584
+ if (cls == null) return null;
2583
2585
  return {
2584
2586
  type,
2585
2587
  name,
package/dist/mod.cjs CHANGED
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("./chunk-DDcVe30Y.cjs");
5
5
  const require_transformers = require("./transformers-NeAONrAq.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_http = require("./http-BjfKj845.cjs");
8
- const require_middleware = require("./middleware-s7WxQ4ac.cjs");
7
+ const require_http = require("./http-OnBi3XC0.cjs");
8
+ const require_middleware = require("./middleware-CNHi9xWP.cjs");
9
9
  const require_types = require("./types-DRPjmHVV.cjs");
10
- const require_proof = require("./proof-dP19tIYO.cjs");
11
- const require_kv_cache = require("./kv-cache-4PJQF26S.cjs");
10
+ const require_proof = require("./proof-BZBpDiWm.cjs");
11
+ const require_kv_cache = require("./kv-cache-3xwWysXy.cjs");
12
12
  const require_federation_mod = require("./federation/mod.cjs");
13
13
  require("./nodeinfo/mod.cjs");
14
14
  require("./runtime/mod.cjs");
package/dist/mod.js CHANGED
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import "./chunk-CRNNMoPX.js";
4
4
  import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
5
5
  import "./compat/mod.js";
6
- import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-DCMS1UsO.js";
7
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-fe8Y1tqE.js";
6
+ import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-BtJKFrZy.js";
7
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-CTVodxyp.js";
8
8
  import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-miAYfiGO.js";
9
- import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-CIp6SzLJ.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CnJnTcyv.js";
9
+ import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-D5OKiIO7.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CxlZoYUf.js";
11
11
  import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
12
12
  import "./nodeinfo/mod.js";
13
13
  import "./runtime/mod.js";
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-BUOJXi-Z.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-CT46Re-o.mjs";
8
+ import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-DQINgr9t.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
5
- import { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-DK65oVQg.mjs";
4
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
5
+ import { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-D8Osvomp.mjs";
6
6
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-BjfKj845.cjs");
4
+ const require_http = require("./http-OnBi3XC0.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _fedify_vocab = require("@fedify/vocab");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-DCMS1UsO.js";
3
+ import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-BtJKFrZy.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-DK65oVQg.mjs";
4
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-D8Osvomp.mjs";
6
6
  import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-gzW01cMG.mjs";
5
- import { n as doubleKnock } from "./http-KxgJKEhF.mjs";
4
+ import { n as version, t as name } from "./deno-BsD15fKn.mjs";
5
+ import { n as doubleKnock } from "./http-rTMkknPp.mjs";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { FetchError, UrlError, validatePublicUrl } from "@fedify/vocab-runtime";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -7,8 +7,8 @@ import { i as assertExists, t as assertStringIncludes } from "../std__assert-BUO
7
7
  import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { t as assert } from "../assert-BhQd8QHP.mjs";
9
9
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
10
- import { t as exportJwk } from "../key-DK65oVQg.mjs";
11
- import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase } from "../http-KxgJKEhF.mjs";
10
+ import { t as exportJwk } from "../key-D8Osvomp.mjs";
11
+ import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase } from "../http-rTMkknPp.mjs";
12
12
  import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
13
13
  import { mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { FetchError, exportSpki } from "@fedify/vocab-runtime";
@@ -6,7 +6,7 @@ import "../std__assert-BUOJXi-Z.mjs";
6
6
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
7
7
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
8
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
9
- import { a as importJwk, i as generateCryptoKeyPair, o as validateCryptoKey, r as fetchKey, t as exportJwk } from "../key-DK65oVQg.mjs";
9
+ import { a as importJwk, i as generateCryptoKeyPair, o as validateCryptoKey, r as fetchKey, t as exportJwk } from "../key-D8Osvomp.mjs";
10
10
  import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { CryptographicKey, Multikey } from "@fedify/vocab";
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
6
6
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
7
7
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
8
- import { i as generateCryptoKeyPair } from "../key-DK65oVQg.mjs";
8
+ import { i as generateCryptoKeyPair } from "../key-D8Osvomp.mjs";
9
9
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
10
- import { a as compactJsonLd, d as isInvalidUrlTypeError, f as signJsonLd, h as verifySignature, i as attachSignature, m as verifyJsonLd, n as UnsafeJsonLdError, o as createSignature, s as detachSignature } from "../ld-CkhxuQKE.mjs";
10
+ import { a as compactJsonLd, d as isInvalidUrlTypeError, f as signJsonLd, h as verifySignature, i as attachSignature, m as verifyJsonLd, n as UnsafeJsonLdError, o as createSignature, s as detachSignature } from "../ld-inJTyOFb.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { CryptographicKey } from "@fedify/vocab";
13
13
  import { encodeBase64 } from "byte-encodings/base64";
package/dist/sig/mod.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_http = require("../http-BjfKj845.cjs");
5
- const require_proof = require("../proof-dP19tIYO.cjs");
4
+ const require_http = require("../http-OnBi3XC0.cjs");
5
+ const require_proof = require("../proof-BZBpDiWm.cjs");
6
6
  exports.attachSignature = require_proof.attachSignature;
7
7
  exports.createProof = require_proof.createProof;
8
8
  exports.createSignature = require_proof.createSignature;
package/dist/sig/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "../http-DCMS1UsO.js";
4
- import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "../proof-CIp6SzLJ.js";
3
+ import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "../http-BtJKFrZy.js";
4
+ import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "../proof-D5OKiIO7.js";
5
5
  export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
@@ -6,7 +6,7 @@ import "../std__assert-BUOJXi-Z.mjs";
6
6
  import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
7
7
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
8
  import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DOeeThGK.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-D2-e-1Ni.mjs";
10
10
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
12
12
  //#region src/sig/owner.test.ts
@@ -6,7 +6,7 @@ import "../std__assert-BUOJXi-Z.mjs";
6
6
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
7
7
  import { n as assertInstanceOf } from "../assert-BhQd8QHP.mjs";
8
8
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
9
- import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-CX04YEdf.mjs";
9
+ import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-DTpedXfN.mjs";
10
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
12
12
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader } from "./ld-CkhxuQKE.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-inJTyOFb.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-DVILvP5e.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-BUOJXi-Z.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
- import { l as verifyRequest } from "../http-KxgJKEhF.mjs";
8
+ import { l as verifyRequest } from "../http-rTMkknPp.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-CCxRJhWa.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-DW-UgR6o.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-CE__4Qj3.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
13
13
  import { configure, reset } from "@logtape/logtape";
@@ -1,6 +1,6 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_kv_cache = require("../kv-cache-4PJQF26S.cjs");
4
+ const require_kv_cache = require("../kv-cache-3xwWysXy.cjs");
5
5
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
6
6
  exports.kvCache = require_kv_cache.kvCache;
package/dist/utils/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-CnJnTcyv.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-CxlZoYUf.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.0.29-dev.2143+bbbfea55",
3
+ "version": "2.0.30-dev.2188+c9867532",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -144,9 +144,9 @@
144
144
  "uri-template-router": "^1.0.0",
145
145
  "url-template": "^3.1.1",
146
146
  "urlpattern-polyfill": "^10.1.0",
147
- "@fedify/vocab-runtime": "2.0.29-dev.2143+bbbfea55",
148
- "@fedify/webfinger": "2.0.29-dev.2143+bbbfea55",
149
- "@fedify/vocab": "2.0.29-dev.2143+bbbfea55"
147
+ "@fedify/vocab": "2.0.30-dev.2188+c9867532",
148
+ "@fedify/webfinger": "2.0.30-dev.2188+c9867532",
149
+ "@fedify/vocab-runtime": "2.0.30-dev.2188+c9867532"
150
150
  },
151
151
  "devDependencies": {
152
152
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -158,8 +158,8 @@
158
158
  "tsx": "^4.19.4",
159
159
  "typescript": "^6.0.0",
160
160
  "wrangler": "^4.17.0",
161
- "@fedify/fixture": "2.0.0",
162
- "@fedify/vocab-tools": "^2.0.29-dev.2143+bbbfea55"
161
+ "@fedify/vocab-tools": "^2.0.30-dev.2188+c9867532",
162
+ "@fedify/fixture": "2.0.0"
163
163
  },
164
164
  "scripts": {
165
165
  "build:self": "tsdown",