@fedify/fedify 2.0.29 → 2.0.30-dev.2199

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 (65) hide show
  1. package/dist/{builder-Dhpme9wI.mjs → builder-XLcD7aGE.mjs} +11 -3
  2. package/dist/compat/mod.d.cts +1 -1
  3. package/dist/compat/mod.d.ts +1 -1
  4. package/dist/compat/transformers.test.mjs +1 -1
  5. package/dist/{context-M_MxoQgC.d.cts → context-C-KTxW8v.d.cts} +1 -1
  6. package/dist/{context-B21klrfz.d.ts → context-DDPUfQkR.d.ts} +1 -1
  7. package/dist/{deno-DXKnk3mg.mjs → deno-fv5vVsFR.mjs} +1 -1
  8. package/dist/{docloader-TLfFY18X.mjs → docloader-BTh9dffN.mjs} +2 -2
  9. package/dist/federation/builder.test.mjs +37 -2
  10. package/dist/federation/handler.test.mjs +6 -6
  11. package/dist/federation/idempotency.test.mjs +2 -2
  12. package/dist/federation/inbox.test.mjs +1 -1
  13. package/dist/federation/middleware.test.mjs +47 -6
  14. package/dist/federation/mod.cjs +1 -1
  15. package/dist/federation/mod.d.cts +3 -3
  16. package/dist/federation/mod.d.ts +3 -3
  17. package/dist/federation/mod.js +1 -1
  18. package/dist/federation/send.test.mjs +3 -3
  19. package/dist/federation/temporal.test.mjs +1 -1
  20. package/dist/federation/webfinger.test.mjs +1 -1
  21. package/dist/{http-qOVfi1pX.js → http-CzghaflQ.js} +1 -1
  22. package/dist/{http-DGxA8Jc_.mjs → http-DHG5-c4g.mjs} +2 -2
  23. package/dist/{http-C6a2FDKp.cjs → http-sY1NeVIr.cjs} +1 -1
  24. package/dist/{inbox-Do-x8Yi2.mjs → inbox-q7G2wOYG.mjs} +1 -1
  25. package/dist/{key-DxmDE_u6.mjs → key-BE-S9FQ9.mjs} +1 -1
  26. package/dist/{kv-D6hNiMTK.d.ts → kv-CZKl1IUS.d.cts} +3 -2
  27. package/dist/{kv-gJ8LYbxX.d.cts → kv-CxaI4eGo.d.ts} +3 -2
  28. package/dist/{kv-cache-CLzl9mS9.cjs → kv-cache-CmC98ZjO.cjs} +1 -1
  29. package/dist/{kv-cache-CYab-dCL.js → kv-cache-DP2SFUDJ.js} +1 -1
  30. package/dist/{ld-mXzk1IDb.mjs → ld-xNTQFkd6.mjs} +2 -2
  31. package/dist/{middleware-DmhTcmI9.mjs → middleware-B5PkKty8.mjs} +18 -16
  32. package/dist/{middleware-BmiR8Kq2.mjs → middleware-Cf7DDhkx.mjs} +1 -1
  33. package/dist/{middleware-DQ3Dll3d.cjs → middleware-DLoeVfOi.cjs} +19 -9
  34. package/dist/{middleware-DdPHI6lF.js → middleware-DSJy8AiN.js} +18 -8
  35. package/dist/{middleware-DQH6Ubkw.cjs → middleware-kbOGJZvE.cjs} +1 -1
  36. package/dist/{mod-PD3bZZ5j.d.ts → mod-BKJyD7nk.d.ts} +1 -1
  37. package/dist/{mod-D3xVy8Yy.d.cts → mod-BkPB4hPe.d.cts} +1 -1
  38. package/dist/{mod-D24V_w-K.d.ts → mod-CI9TwVC1.d.ts} +1 -1
  39. package/dist/{mod-Dp5dfH-i.d.cts → mod-CgIgPN_a.d.cts} +1 -1
  40. package/dist/mod.cjs +4 -4
  41. package/dist/mod.d.cts +4 -4
  42. package/dist/mod.d.ts +4 -4
  43. package/dist/mod.js +4 -4
  44. package/dist/nodeinfo/handler.test.mjs +1 -1
  45. package/dist/otel/mod.d.cts +1 -1
  46. package/dist/otel/mod.d.ts +1 -1
  47. package/dist/{owner-nO2m9LVJ.mjs → owner-Co11LaDN.mjs} +2 -2
  48. package/dist/{proof-C0IrQE_q.cjs → proof-Bqpm1G-l.cjs} +1 -1
  49. package/dist/{proof-B2aeZkKq.js → proof-C6JvFaz6.js} +1 -1
  50. package/dist/{proof-BmyzXtXx.mjs → proof-DU86M9UY.mjs} +2 -2
  51. package/dist/{send-KghvwKEq.mjs → send-Bnw7HZWT.mjs} +2 -2
  52. package/dist/sig/http.test.mjs +2 -2
  53. package/dist/sig/key.test.mjs +1 -1
  54. package/dist/sig/ld.test.mjs +2 -2
  55. package/dist/sig/mod.cjs +2 -2
  56. package/dist/sig/mod.js +2 -2
  57. package/dist/sig/owner.test.mjs +1 -1
  58. package/dist/sig/proof.test.mjs +1 -1
  59. package/dist/{temporal-DxFovElT.mjs → temporal-BCe9BNkQ.mjs} +1 -1
  60. package/dist/utils/docloader.test.mjs +2 -2
  61. package/dist/utils/mod.cjs +1 -1
  62. package/dist/utils/mod.d.cts +1 -1
  63. package/dist/utils/mod.d.ts +1 -1
  64. package/dist/utils/mod.js +1 -1
  65. package/package.json +5 -5
@@ -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-DXKnk3mg.mjs";
6
- import { t as InboxListenerSet } from "./inbox-Do-x8Yi2.mjs";
5
+ import { n as version, t as name } from "./deno-fv5vVsFR.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-q7G2wOYG.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-BmiR8Kq2.mjs");
46
+ const { FederationImpl } = await import("./middleware-Cf7DDhkx.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
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { bt as ActivityTransformer, n as Context } from "../context-M_MxoQgC.cjs";
2
+ import { bt as ActivityTransformer, n as Context } from "../context-C-KTxW8v.cjs";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { bt as ActivityTransformer, n as Context } from "../context-B21klrfz.js";
2
+ import { bt as ActivityTransformer, n as Context } from "../context-DDPUfQkR.js";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -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-DmhTcmI9.mjs";
7
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-B5PkKty8.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  import { Follow, Person } from "@fedify/vocab";
10
10
  //#region src/compat/transformers.test.ts
@@ -2,7 +2,7 @@
2
2
  import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CAM_bQXx.cjs";
3
3
  import { t as HttpMessageSignaturesSpec } from "./http-Bs6thuCC.cjs";
4
4
  import { n as GetKeyOwnerOptions } from "./owner-B3hNQCG8.cjs";
5
- import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
5
+ import { n as KvStore, t as KvKey } from "./kv-CZKl1IUS.cjs";
6
6
  import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/vocab";
7
7
  import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
8
8
  import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
@@ -2,7 +2,7 @@
2
2
  import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CSddvgWN.js";
3
3
  import { t as HttpMessageSignaturesSpec } from "./http-CDupyfOc.js";
4
4
  import { n as GetKeyOwnerOptions } from "./owner-CiBPcC6F.js";
5
- import { n as KvStore, t as KvKey } from "./kv-D6hNiMTK.js";
5
+ import { n as KvStore, t as KvKey } from "./kv-CxaI4eGo.js";
6
6
  import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/vocab";
7
7
  import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
8
8
  import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
@@ -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";
6
+ var version = "2.0.30-dev.2199+d247ed25";
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-DxmDE_u6.mjs";
5
- import { n as doubleKnock } from "./http-DGxA8Jc_.mjs";
4
+ import { o as validateCryptoKey } from "./key-BE-S9FQ9.mjs";
5
+ import { n as doubleKnock } from "./http-DHG5-c4g.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-Dhpme9wI.mjs";
8
+ import { n as createFederationBuilder } from "../builder-XLcD7aGE.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-DxmDE_u6.mjs";
10
- import { s as signRequest } from "../http-DGxA8Jc_.mjs";
9
+ import { i as generateCryptoKeyPair } from "../key-BE-S9FQ9.mjs";
10
+ import { s as signRequest } from "../http-DHG5-c4g.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-mXzk1IDb.mjs";
13
- import { n as signObject } from "../proof-BmyzXtXx.mjs";
12
+ import { a as compactJsonLd, f as signJsonLd } from "../ld-xNTQFkd6.mjs";
13
+ import { n as signObject } from "../proof-DU86M9UY.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-DmhTcmI9.mjs";
16
- import { t as InboxListenerSet } from "../inbox-Do-x8Yi2.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-B5PkKty8.mjs";
16
+ import { t as InboxListenerSet } from "../inbox-q7G2wOYG.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-BmyzXtXx.mjs";
7
+ import { n as signObject } from "../proof-DU86M9UY.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
9
- import { a as createFederation } from "../middleware-DmhTcmI9.mjs";
9
+ import { a as createFederation } from "../middleware-B5PkKty8.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-Do-x8Yi2.mjs";
6
+ import { t as InboxListenerSet } from "../inbox-q7G2wOYG.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-DGxA8Jc_.mjs";
12
+ import { l as verifyRequest, s as signRequest } from "../http-DHG5-c4g.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-TLfFY18X.mjs";
15
- import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-mXzk1IDb.mjs";
16
- import { t as doesActorOwnKey } from "../owner-nO2m9LVJ.mjs";
17
- import { n as signObject, r as verifyObject } from "../proof-BmyzXtXx.mjs";
14
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-BTh9dffN.mjs";
15
+ import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-xNTQFkd6.mjs";
16
+ import { t as doesActorOwnKey } from "../owner-Co11LaDN.mjs";
17
+ import { n as signObject, r as verifyObject } from "../proof-DU86M9UY.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-DmhTcmI9.mjs";
19
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-B5PkKty8.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-DQ3Dll3d.cjs");
5
+ const require_middleware = require("../middleware-DLoeVfOi.cjs");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  //#region src/federation/kv.ts
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-M_MxoQgC.cjs";
3
- import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-gJ8LYbxX.cjs";
4
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-Dp5dfH-i.cjs";
2
+ import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-C-KTxW8v.cjs";
3
+ import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CZKl1IUS.cjs";
4
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-CgIgPN_a.cjs";
5
5
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-B21klrfz.js";
3
- import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-D6hNiMTK.js";
4
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-D24V_w-K.js";
2
+ import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-DDPUfQkR.js";
3
+ import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CxaI4eGo.js";
4
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-CI9TwVC1.js";
5
5
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -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-DdPHI6lF.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-DSJy8AiN.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-DGxA8Jc_.mjs";
10
+ import { l as verifyRequest } from "../http-DHG5-c4g.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-nO2m9LVJ.mjs";
13
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-KghvwKEq.mjs";
12
+ import { t as doesActorOwnKey } from "../owner-Co11LaDN.mjs";
13
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-Bnw7HZWT.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-DxFovElT.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-BCe9BNkQ.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-DmhTcmI9.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-B5PkKty8.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";
13
+ var version = "2.0.30-dev.2199+d247ed25";
14
14
  //#endregion
15
15
  //#region src/sig/key.ts
16
16
  /**
@@ -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-DXKnk3mg.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-DxmDE_u6.mjs";
4
+ import { n as version, t as name } from "./deno-fv5vVsFR.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-BE-S9FQ9.mjs";
6
6
  import { CryptographicKey } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { FetchError } from "@fedify/vocab-runtime";
@@ -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";
14
+ var version = "2.0.30-dev.2199+d247ed25";
15
15
  //#endregion
16
16
  //#region src/sig/key.ts
17
17
  /**
@@ -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-DXKnk3mg.mjs";
4
+ import { n as version, t as name } from "./deno-fv5vVsFR.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-DXKnk3mg.mjs";
4
+ import { n as version, t as name } from "./deno-fv5vVsFR.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";
@@ -41,14 +41,15 @@ interface KvStore {
41
41
  /**
42
42
  * Gets the value for the given key.
43
43
  * @param key The key to get the value for.
44
- * @returns The value for the key, or `undefined` if the key does not exist.
44
+ * @returns The value for the key, including `null` if stored, or `undefined`
45
+ * if the key does not exist.
45
46
  * @template T The type of the value to get.
46
47
  */
47
48
  get<T = unknown>(key: KvKey): Promise<T | undefined>;
48
49
  /**
49
50
  * Sets the value for the given key.
50
51
  * @param key The key to set the value for.
51
- * @param value The value to set.
52
+ * @param value The value to set. `null` is a storable value.
52
53
  * @param options Additional options for setting the value.
53
54
  */
54
55
  set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
@@ -41,14 +41,15 @@ interface KvStore {
41
41
  /**
42
42
  * Gets the value for the given key.
43
43
  * @param key The key to get the value for.
44
- * @returns The value for the key, or `undefined` if the key does not exist.
44
+ * @returns The value for the key, including `null` if stored, or `undefined`
45
+ * if the key does not exist.
45
46
  * @template T The type of the value to get.
46
47
  */
47
48
  get<T = unknown>(key: KvKey): Promise<T | undefined>;
48
49
  /**
49
50
  * Sets the value for the given key.
50
51
  * @param key The key to set the value for.
51
- * @param value The value to set.
52
+ * @param value The value to set. `null` is a storable value.
52
53
  * @param options Additional options for setting the value.
53
54
  */
54
55
  set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
@@ -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-C6a2FDKp.cjs");
4
+ const require_http = require("./http-sY1NeVIr.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-qOVfi1pX.js";
3
+ import { l as validateCryptoKey, t as doubleKnock } from "./http-CzghaflQ.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-DXKnk3mg.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-DxmDE_u6.mjs";
4
+ import { n as version, t as name } from "./deno-fv5vVsFR.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-BE-S9FQ9.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";
@@ -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-DXKnk3mg.mjs";
6
- import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-DxmDE_u6.mjs";
7
- import { l as verifyRequest } from "./http-DGxA8Jc_.mjs";
8
- import { t as getAuthenticatedDocumentLoader } from "./docloader-TLfFY18X.mjs";
5
+ import { n as version, t as name } from "./deno-fv5vVsFR.mjs";
6
+ import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-BE-S9FQ9.mjs";
7
+ import { l as verifyRequest } from "./http-DHG5-c4g.mjs";
8
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-BTh9dffN.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-mXzk1IDb.mjs";
11
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-nO2m9LVJ.mjs";
12
- import { n as signObject, r as verifyObject } from "./proof-BmyzXtXx.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-xNTQFkd6.mjs";
11
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-Co11LaDN.mjs";
12
+ import { n as signObject, r as verifyObject } from "./proof-DU86M9UY.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-Do-x8Yi2.mjs";
16
- import { t as FederationBuilderImpl } from "./builder-Dhpme9wI.mjs";
15
+ import { n as routeActivity } from "./inbox-q7G2wOYG.mjs";
16
+ import { t as FederationBuilderImpl } from "./builder-XLcD7aGE.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-DxFovElT.mjs";
20
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-BCe9BNkQ.mjs";
21
21
  import { t as createExponentialBackoffPolicy } from "./retry-Ddbq3AcK.mjs";
22
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-KghvwKEq.mjs";
22
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-Bnw7HZWT.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,
@@ -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-DmhTcmI9.mjs";
4
+ import { n as FederationImpl } from "./middleware-B5PkKty8.mjs";
5
5
  export { FederationImpl };