@fedify/fedify 2.3.9 → 2.3.10
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.
- package/dist/{builder-Dm72xfCy.mjs → builder-Bal9bfuM.mjs} +10 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-CAKnQy1x.d.ts → context-BWbdE_MZ.d.ts} +1 -1
- package/dist/{context-CSIggG9_.d.cts → context-MOrCC7yl.d.cts} +1 -1
- package/dist/{deno-Deo5dZf_.mjs → deno-DUgFsCmM.mjs} +1 -1
- package/dist/{docloader-BAVVKXPl.mjs → docloader-w72ipM49.mjs} +2 -2
- package/dist/federation/builder.test.mjs +37 -1
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +122 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-BqObaL32.mjs → http-BNDHRNJP.mjs} +3 -3
- package/dist/{http-DuWPL6ic.js → http-BY8PpQzP.js} +1 -1
- package/dist/{http-CjvY7wBM.cjs → http-CTYio50W.cjs} +1 -1
- package/dist/{key-D1TEfV4d.mjs → key-BbuFo4CW.mjs} +2 -2
- package/dist/{kv-D6hNiMTK.d.ts → kv-CZKl1IUS.d.cts} +3 -2
- package/dist/{kv-gJ8LYbxX.d.cts → kv-CxaI4eGo.d.ts} +3 -2
- package/dist/{kv-cache-DGnB9ZX_.mjs → kv-cache-CNZOaZYq.mjs} +1 -1
- package/dist/{kv-cache-C_4ufNbl.cjs → kv-cache-CrcqGkT-.cjs} +1 -1
- package/dist/{kv-cache-w0De7ODp.js → kv-cache-DNnjnc9t.js} +1 -1
- package/dist/{ld-DnGqAKWi.mjs → ld-BYV2Luge.mjs} +3 -3
- package/dist/{metrics-jUJmtE2u.mjs → metrics-QrVsKSG9.mjs} +1 -1
- package/dist/{middleware-C70IPcBw.mjs → middleware-54KSGAQA.mjs} +1 -1
- package/dist/{middleware-A-SjayRO.js → middleware-B4FNnN3W.js} +20 -9
- package/dist/{middleware-XCr66VRe.mjs → middleware-Bj9s3J_0.mjs} +21 -18
- package/dist/{middleware-BW5W0CTK.cjs → middleware-Dv-L7Plm.cjs} +20 -9
- package/dist/{mod-PVR75MeU.d.cts → mod-B6PwkUMU.d.cts} +1 -1
- package/dist/{mod-CQ8EjnN5.d.ts → mod-Br8yJNcE.d.ts} +1 -1
- package/dist/{mod-EbRFjVlY.d.cts → mod-Co1M3Ux0.d.cts} +1 -1
- package/dist/{mod-CFuyfw3c.d.ts → mod-LmD03uRA.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +4 -4
- package/dist/mod.d.ts +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/otel/mod.d.cts +1 -1
- package/dist/otel/mod.d.ts +1 -1
- package/dist/{owner-C4iDnghj.mjs → owner-BsBzJADO.mjs} +2 -2
- package/dist/{proof-DqO9zYcc.js → proof-BxS2Xa8B.js} +1 -1
- package/dist/{proof-DvVA2Bmk.cjs → proof-CGKQFT2M.cjs} +1 -1
- package/dist/{proof-CpU6r25U.mjs → proof-cXVkPBIU.mjs} +3 -3
- package/dist/{send-YVatAj-a.mjs → send-omt23uTA.mjs} +3 -3
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/{temporal-BJ-5wxWU.mjs → temporal-ZUAQe754.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
|
@@ -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-
|
|
4
|
+
import { n as version, t as name } from "./deno-DUgFsCmM.mjs";
|
|
5
5
|
import { t as ActivityListenerSet } from "./activity-listener-ell7W1s9.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
@@ -65,6 +65,7 @@ var FederationBuilderImpl = class {
|
|
|
65
65
|
* Symbol registry for unique identification of unnamed symbols.
|
|
66
66
|
*/
|
|
67
67
|
#symbolRegistry = /* @__PURE__ */ new Map();
|
|
68
|
+
#collectionNames = /* @__PURE__ */ new Map();
|
|
68
69
|
constructor() {
|
|
69
70
|
this.router = new Router();
|
|
70
71
|
this.objectCallbacks = {};
|
|
@@ -80,7 +81,7 @@ var FederationBuilderImpl = class {
|
|
|
80
81
|
* specified.
|
|
81
82
|
*/
|
|
82
83
|
async build(options) {
|
|
83
|
-
const { FederationImpl } = await import("./middleware-
|
|
84
|
+
const { FederationImpl } = await import("./middleware-54KSGAQA.mjs");
|
|
84
85
|
const f = new FederationImpl(options);
|
|
85
86
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
86
87
|
f.router = this.router.clone();
|
|
@@ -93,6 +94,8 @@ var FederationBuilderImpl = class {
|
|
|
93
94
|
f.objectTypeIds = { ...this.objectTypeIds };
|
|
94
95
|
f.collectionCallbacks = { ...this.collectionCallbacks };
|
|
95
96
|
f.collectionTypeIds = { ...this.collectionTypeIds };
|
|
97
|
+
f.#symbolRegistry = new Map(this.#symbolRegistry);
|
|
98
|
+
f.#collectionNames = new Map(this.#collectionNames);
|
|
96
99
|
f.inboxPath = this.inboxPath;
|
|
97
100
|
f.outboxPath = this.outboxPath;
|
|
98
101
|
f.inboxCallbacks = this.inboxCallbacks == null ? void 0 : { ...this.inboxCallbacks };
|
|
@@ -572,6 +575,7 @@ var FederationBuilderImpl = class {
|
|
|
572
575
|
if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
|
|
573
576
|
assertPath(path);
|
|
574
577
|
if (Router.variables(path).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
|
|
578
|
+
this.#collectionNames.set(routeName, name);
|
|
575
579
|
this.router.add(path, routeName);
|
|
576
580
|
const callbacks = { dispatcher };
|
|
577
581
|
this.collectionCallbacks[name] = callbacks;
|
|
@@ -609,6 +613,10 @@ var FederationBuilderImpl = class {
|
|
|
609
613
|
const routeName = this.#uniqueCollectionId(name);
|
|
610
614
|
return this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
|
|
611
615
|
}
|
|
616
|
+
/** Resolves a custom collection route to its original name. */
|
|
617
|
+
getCollectionName(routeName) {
|
|
618
|
+
return this.#collectionNames.get(routeName) ?? routeName.replace(/^(collection|orderedCollection):/, "");
|
|
619
|
+
}
|
|
612
620
|
setOutboxPermanentFailureHandler(handler) {
|
|
613
621
|
this.outboxPermanentFailureHandler = handler;
|
|
614
622
|
}
|
package/dist/compat/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { jt as ActivityTransformer, n as Context } from "../context-
|
|
2
|
+
import { jt as ActivityTransformer, n as Context } from "../context-MOrCC7yl.cjs";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
package/dist/compat/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { jt as ActivityTransformer, n as Context } from "../context-
|
|
2
|
+
import { jt as ActivityTransformer, n as Context } from "../context-BWbdE_MZ.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-C-ZRDbaf.mjs";
|
|
5
5
|
import { n as assertInstanceOf, t as assert } from "../assert-jSdZMYam.mjs";
|
|
6
6
|
import { t as MemoryKvStore } from "../kv-CX8qfaad.mjs";
|
|
7
|
-
import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-
|
|
7
|
+
import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-Bj9s3J_0.mjs";
|
|
8
8
|
import { Follow, Person } from "@fedify/vocab";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
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-CSddvgWN.js";
|
|
3
3
|
import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-DQmNpfym.js";
|
|
4
4
|
import { n as GetKeyOwnerOptions } from "./owner-CiBPcC6F.js";
|
|
5
|
-
import { n as KvStore, t as KvKey } from "./kv-
|
|
5
|
+
import { n as KvStore, t as KvKey } from "./kv-CxaI4eGo.js";
|
|
6
6
|
import { r as MessageQueue } from "./mq-D-nlpY04.js";
|
|
7
7
|
import { Router } from "@fedify/uri-template";
|
|
8
8
|
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-CAM_bQXx.cjs";
|
|
3
3
|
import { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-DiWQB8Mr.cjs";
|
|
4
4
|
import { n as GetKeyOwnerOptions } from "./owner-B3hNQCG8.cjs";
|
|
5
|
-
import { n as KvStore, t as KvKey } from "./kv-
|
|
5
|
+
import { n as KvStore, t as KvKey } from "./kv-CZKl1IUS.cjs";
|
|
6
6
|
import { r as MessageQueue } from "./mq-D8uSFzxe.cjs";
|
|
7
7
|
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
|
|
8
8
|
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } 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 { s as validateCryptoKey } from "./key-
|
|
5
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { s as validateCryptoKey } from "./key-BbuFo4CW.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-BNDHRNJP.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
8
8
|
import { curry } from "es-toolkit";
|
|
@@ -4,8 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
5
5
|
import { n as assertExists } from "../std__assert-BvGuO4xO.mjs";
|
|
6
6
|
import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
|
|
7
|
+
import { t as assertStrictEquals } from "../assert_strict_equals-XEgZAlrj.mjs";
|
|
7
8
|
import { t as MemoryKvStore } from "../kv-CX8qfaad.mjs";
|
|
8
|
-
import { r as createFederationBuilder } from "../builder-
|
|
9
|
+
import { r as createFederationBuilder } from "../builder-Bal9bfuM.mjs";
|
|
9
10
|
import { DisallowedOperatorError, DisallowedVarSpecModifierError, DuplicateRouteVariableError, RouteTemplateOptionsNotMatchedError, RouterError } from "@fedify/uri-template";
|
|
10
11
|
import { Activity, Note, Person } from "@fedify/vocab";
|
|
11
12
|
import { test } from "@fedify/fixture";
|
|
@@ -344,6 +345,41 @@ test("FederationBuilder", async (t) => {
|
|
|
344
345
|
assertEquals(impl.collectionTypeIds["test"], Note);
|
|
345
346
|
assertEquals((await impl.fetch(new Request("https://example.com/c/x", { headers: { accept: "application/activity+json" } }), { contextData: void 0 })).status, 200);
|
|
346
347
|
});
|
|
348
|
+
await t.step("preserves symbol-named collections through build()", async () => {
|
|
349
|
+
const builder = createFederationBuilder();
|
|
350
|
+
const collection = Symbol("saved");
|
|
351
|
+
const ordered = Symbol("saved");
|
|
352
|
+
builder.setCollectionDispatcher(collection, Note, "/users/{identifier}/saved", () => ({ items: [] }));
|
|
353
|
+
builder.setOrderedCollectionDispatcher(ordered, Note, "/users/{identifier}/ordered-saved", () => ({ items: [] }));
|
|
354
|
+
for (let build = 0; build < 2; build++) {
|
|
355
|
+
const federation = await builder.build({ kv: new MemoryKvStore() });
|
|
356
|
+
const ctx = federation.createContext(new URL("https://example.com/"));
|
|
357
|
+
for (const [name, path, type] of [[
|
|
358
|
+
collection,
|
|
359
|
+
"/users/alice/saved",
|
|
360
|
+
"collection"
|
|
361
|
+
], [
|
|
362
|
+
ordered,
|
|
363
|
+
"/users/alice/ordered-saved",
|
|
364
|
+
"orderedCollection"
|
|
365
|
+
]]) {
|
|
366
|
+
const uri = ctx.getCollectionUri(name, { identifier: "alice" });
|
|
367
|
+
assertEquals(uri.pathname, path);
|
|
368
|
+
const parsed = ctx.parseUri(uri);
|
|
369
|
+
assertEquals(parsed?.type, type);
|
|
370
|
+
if (parsed?.type !== "collection" && parsed?.type !== "orderedCollection") throw new Error("Expected a custom collection URI");
|
|
371
|
+
assertStrictEquals(parsed.name, name);
|
|
372
|
+
assertStrictEquals(parsed.class, Note);
|
|
373
|
+
assertEquals(parsed.values, { identifier: "alice" });
|
|
374
|
+
for (const cursor of [null, "next"]) {
|
|
375
|
+
const pageUri = new URL(uri);
|
|
376
|
+
if (cursor != null) pageUri.searchParams.set("cursor", cursor);
|
|
377
|
+
assertEquals((await federation.fetch(new Request(pageUri, { headers: { accept: "application/activity+json" } }), { contextData: void 0 })).status, 200);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
assertThrows(() => federation.setCollectionDispatcher(collection, Note, "/users/{identifier}/duplicate", () => ({ items: [] })));
|
|
381
|
+
}
|
|
382
|
+
});
|
|
347
383
|
});
|
|
348
384
|
//#endregion
|
|
349
385
|
export {};
|
|
@@ -7,13 +7,13 @@ import "../std__assert-BvGuO4xO.mjs";
|
|
|
7
7
|
import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
8
8
|
import { n as assertInstanceOf, t as assert } from "../assert-jSdZMYam.mjs";
|
|
9
9
|
import { r as parseAcceptSignature } from "../accept-Dd__NiUL.mjs";
|
|
10
|
-
import { a as generateCryptoKeyPair } from "../key-
|
|
11
|
-
import { s as signRequest } from "../http-
|
|
10
|
+
import { a as generateCryptoKeyPair } from "../key-BbuFo4CW.mjs";
|
|
11
|
+
import { s as signRequest } from "../http-BNDHRNJP.mjs";
|
|
12
12
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
|
|
13
|
-
import { a as compactJsonLd, p as signJsonLd } from "../ld-
|
|
14
|
-
import { r as signObject } from "../proof-
|
|
13
|
+
import { a as compactJsonLd, p as signJsonLd } from "../ld-BYV2Luge.mjs";
|
|
14
|
+
import { r as signObject } from "../proof-cXVkPBIU.mjs";
|
|
15
15
|
import { t as MemoryKvStore } from "../kv-CX8qfaad.mjs";
|
|
16
|
-
import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-
|
|
16
|
+
import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-Bj9s3J_0.mjs";
|
|
17
17
|
import { t as ActivityListenerSet } from "../activity-listener-ell7W1s9.mjs";
|
|
18
18
|
import { Activity, Create, CryptographicKey, Multikey, Note, Person, Tombstone } from "@fedify/vocab";
|
|
19
19
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
5
5
|
import "../std__assert-BvGuO4xO.mjs";
|
|
6
6
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
7
|
-
import { r as signObject } from "../proof-
|
|
7
|
+
import { r as signObject } from "../proof-cXVkPBIU.mjs";
|
|
8
8
|
import { t as MemoryKvStore } from "../kv-CX8qfaad.mjs";
|
|
9
|
-
import { o as createFederation } from "../middleware-
|
|
9
|
+
import { o as createFederation } from "../middleware-Bj9s3J_0.mjs";
|
|
10
10
|
import { Create, Follow, Person } from "@fedify/vocab";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/federation/idempotency.test.ts
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
5
5
|
import "../std__assert-BvGuO4xO.mjs";
|
|
6
6
|
import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
7
|
-
import { _ as recordKeyLookup, a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, m as recordDocumentFetch, p as recordDocumentCache, r as getFederationMetrics, t as classifyFetchError, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "../metrics-
|
|
7
|
+
import { _ as recordKeyLookup, a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, m as recordDocumentFetch, p as recordDocumentCache, r as getFederationMetrics, t as classifyFetchError, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "../metrics-QrVsKSG9.mjs";
|
|
8
8
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
9
9
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
10
10
|
import { DataPointType, MeterProvider, MetricReader } from "@opentelemetry/sdk-metrics";
|
|
@@ -9,15 +9,15 @@ import { n as assertInstanceOf, t as assert } from "../assert-jSdZMYam.mjs";
|
|
|
9
9
|
import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
|
|
10
10
|
import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
|
|
11
11
|
import { t as assertStrictEquals } from "../assert_strict_equals-XEgZAlrj.mjs";
|
|
12
|
-
import { g as recordInboxActivity } from "../metrics-
|
|
13
|
-
import { l as verifyRequest, s as signRequest } from "../http-
|
|
12
|
+
import { g as recordInboxActivity } from "../metrics-QrVsKSG9.mjs";
|
|
13
|
+
import { l as verifyRequest, s as signRequest } from "../http-BNDHRNJP.mjs";
|
|
14
14
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
15
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
16
|
-
import { a as compactJsonLd, h as verifyJsonLd, p as signJsonLd, s as detachSignature } from "../ld-
|
|
17
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
18
|
-
import { i as verifyObject, r as signObject } from "../proof-
|
|
15
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-w72ipM49.mjs";
|
|
16
|
+
import { a as compactJsonLd, h as verifyJsonLd, p as signJsonLd, s as detachSignature } from "../ld-BYV2Luge.mjs";
|
|
17
|
+
import { t as doesActorOwnKey } from "../owner-BsBzJADO.mjs";
|
|
18
|
+
import { i as verifyObject, r as signObject } from "../proof-cXVkPBIU.mjs";
|
|
19
19
|
import { t as MemoryKvStore } from "../kv-CX8qfaad.mjs";
|
|
20
|
-
import { g as handleBenchmarkTrigger, i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-
|
|
20
|
+
import { g as handleBenchmarkTrigger, i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-Bj9s3J_0.mjs";
|
|
21
21
|
import { t as CircuitBreaker } from "../circuit-breaker-CDABzqVf.mjs";
|
|
22
22
|
import { t as markCircuitBreakerLegacySweepDone } from "../circuit-breaker-test-utils-Dm5MM6l9.mjs";
|
|
23
23
|
import { configure, reset } from "@logtape/logtape";
|
|
@@ -6835,6 +6835,80 @@ test({
|
|
|
6835
6835
|
assertEquals(rejected[1].attributes["activitypub.activity.type"], "https://www.w3.org/ns/activitystreams#Offer");
|
|
6836
6836
|
}
|
|
6837
6837
|
});
|
|
6838
|
+
for (const queued of [false, true]) test(`ContextImpl.routeActivity() routes the fetched document (queued: ${queued})`, async () => {
|
|
6839
|
+
const id = new URL("https://example.com/verified-create");
|
|
6840
|
+
const genuine = new Create({
|
|
6841
|
+
id,
|
|
6842
|
+
actor: new URL("https://example.com/person"),
|
|
6843
|
+
object: new vocab.Note({ content: "Genuine content" }),
|
|
6844
|
+
to: new URL("https://example.com/recipient")
|
|
6845
|
+
});
|
|
6846
|
+
const genuineJson = await genuine.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
6847
|
+
const forged = new Create({
|
|
6848
|
+
id,
|
|
6849
|
+
actor: new URL("https://victim.example/actor"),
|
|
6850
|
+
object: new vocab.Note({ content: "Forged content" }),
|
|
6851
|
+
to: new URL("https://attacker.example/recipient")
|
|
6852
|
+
});
|
|
6853
|
+
const messages = [];
|
|
6854
|
+
const queue = {
|
|
6855
|
+
enqueue(message) {
|
|
6856
|
+
messages.push(message);
|
|
6857
|
+
return Promise.resolve();
|
|
6858
|
+
},
|
|
6859
|
+
async listen() {}
|
|
6860
|
+
};
|
|
6861
|
+
const federation = createFederation({
|
|
6862
|
+
kv: new MemoryKvStore(),
|
|
6863
|
+
documentLoaderFactory: () => async (url, options) => url === id.href ? {
|
|
6864
|
+
document: genuineJson,
|
|
6865
|
+
documentUrl: id.href,
|
|
6866
|
+
contextUrl: null
|
|
6867
|
+
} : await mockDocumentLoader(url, options),
|
|
6868
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
6869
|
+
queue: {
|
|
6870
|
+
inbox: queued ? queue : void 0,
|
|
6871
|
+
outbox: queue
|
|
6872
|
+
},
|
|
6873
|
+
manuallyStartQueue: true
|
|
6874
|
+
});
|
|
6875
|
+
const received = [];
|
|
6876
|
+
const contextDocuments = [];
|
|
6877
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, async (ctx, activity) => {
|
|
6878
|
+
received.push(await activity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
|
6879
|
+
assertInstanceOf(ctx, InboxContextImpl);
|
|
6880
|
+
contextDocuments.push(ctx.activity);
|
|
6881
|
+
await ctx.forwardActivity({
|
|
6882
|
+
privateKey: ed25519PrivateKey,
|
|
6883
|
+
keyId: ed25519Multikey.id
|
|
6884
|
+
}, {
|
|
6885
|
+
id: new URL("https://example.com/recipient"),
|
|
6886
|
+
inboxId: new URL("https://example.com/inbox")
|
|
6887
|
+
});
|
|
6888
|
+
});
|
|
6889
|
+
const ctx = federation.createContext(new URL("https://local.example/"));
|
|
6890
|
+
async function processInbox() {
|
|
6891
|
+
const inboxMessages = messages.filter((message) => message.type === "inbox");
|
|
6892
|
+
for (const message of inboxMessages) await federation.processQueuedTask(void 0, message);
|
|
6893
|
+
}
|
|
6894
|
+
assert(await ctx.routeActivity(null, forged));
|
|
6895
|
+
if (queued) {
|
|
6896
|
+
assertEquals(received, []);
|
|
6897
|
+
assertEquals(messages.length, 1);
|
|
6898
|
+
assertEquals(messages[0].activity, genuineJson);
|
|
6899
|
+
await processInbox();
|
|
6900
|
+
}
|
|
6901
|
+
assertEquals(received, [genuineJson]);
|
|
6902
|
+
assertEquals(contextDocuments, [genuineJson]);
|
|
6903
|
+
const forwarded = messages.filter((message) => message.type === "outbox");
|
|
6904
|
+
assertEquals(forwarded.length, 1);
|
|
6905
|
+
assertEquals(forwarded[0].activity, genuineJson);
|
|
6906
|
+
assert(await ctx.routeActivity(null, genuine));
|
|
6907
|
+
if (queued) await processInbox();
|
|
6908
|
+
assertEquals(received, [genuineJson]);
|
|
6909
|
+
assertEquals(contextDocuments, [genuineJson]);
|
|
6910
|
+
assertEquals(messages.filter((message) => message.type === "outbox").length, 1);
|
|
6911
|
+
});
|
|
6838
6912
|
test("ContextImpl.routeActivity() marks queued signed activities as non-LDS", async () => {
|
|
6839
6913
|
let queuedMessage = null;
|
|
6840
6914
|
const federation = new FederationImpl({
|
|
@@ -6894,6 +6968,47 @@ test("ContextImpl.getCollectionUri()", () => {
|
|
|
6894
6968
|
assertThrows(() => ctx.getCollectionUri(Symbol(notReg), values));
|
|
6895
6969
|
assertThrows(() => ctx.getCollectionUri(Symbol.for(notReg), values));
|
|
6896
6970
|
});
|
|
6971
|
+
test("symbol-named custom collections are served and parsed", async () => {
|
|
6972
|
+
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
6973
|
+
const names = [Symbol("bookmarks"), Symbol("bookmarks")];
|
|
6974
|
+
const paths = ["bookmarks", "ordered-bookmarks"];
|
|
6975
|
+
const calls = [];
|
|
6976
|
+
federation.setCollectionDispatcher(names[0], vocab.Object, "/users/{identifier}/bookmarks", (_ctx, _values, cursor) => {
|
|
6977
|
+
calls.push([0, cursor]);
|
|
6978
|
+
return { items: [] };
|
|
6979
|
+
});
|
|
6980
|
+
federation.setOrderedCollectionDispatcher(names[1], vocab.Object, "/users/{identifier}/ordered-bookmarks", (_ctx, _values, cursor) => {
|
|
6981
|
+
calls.push([1, cursor]);
|
|
6982
|
+
return { items: [] };
|
|
6983
|
+
});
|
|
6984
|
+
const ctx = federation.createContext(new URL("https://example.com/"));
|
|
6985
|
+
for (const [index, name] of names.entries()) {
|
|
6986
|
+
const uri = ctx.getCollectionUri(name, { identifier: "alice" });
|
|
6987
|
+
assertEquals(uri.pathname, `/users/alice/${paths[index]}`);
|
|
6988
|
+
const parsed = ctx.parseUri(uri);
|
|
6989
|
+
assertEquals(parsed?.type, index === 0 ? "collection" : "orderedCollection");
|
|
6990
|
+
if (parsed?.type !== "collection" && parsed?.type !== "orderedCollection") throw new Error("Expected a custom collection URI");
|
|
6991
|
+
assertStrictEquals(parsed.name, name);
|
|
6992
|
+
assertStrictEquals(parsed.class, vocab.Object);
|
|
6993
|
+
assertEquals(parsed.typeId, vocab.Object.typeId);
|
|
6994
|
+
assertEquals(parsed.values, { identifier: "alice" });
|
|
6995
|
+
for (const cursor of [null, "next"]) {
|
|
6996
|
+
const pageUri = new URL(uri);
|
|
6997
|
+
if (cursor != null) pageUri.searchParams.set("cursor", cursor);
|
|
6998
|
+
const response = await federation.fetch(new Request(pageUri, { headers: { accept: "application/activity+json" } }), { contextData: void 0 });
|
|
6999
|
+
assertEquals(response.status, 200);
|
|
7000
|
+
const body = await response.json();
|
|
7001
|
+
assert(body !== null && typeof body === "object" && "type" in body);
|
|
7002
|
+
assertEquals(body.type, `${index === 0 ? "Collection" : "OrderedCollection"}${cursor == null ? "" : "Page"}`);
|
|
7003
|
+
}
|
|
7004
|
+
}
|
|
7005
|
+
assertEquals(calls, [
|
|
7006
|
+
[0, null],
|
|
7007
|
+
[0, "next"],
|
|
7008
|
+
[1, null],
|
|
7009
|
+
[1, "next"]
|
|
7010
|
+
]);
|
|
7011
|
+
});
|
|
6897
7012
|
test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
6898
7013
|
esm_default.spyGlobal();
|
|
6899
7014
|
let verified = null;
|
package/dist/federation/mod.cjs
CHANGED
|
@@ -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-
|
|
5
|
+
const require_middleware = require("../middleware-Dv-L7Plm.cjs");
|
|
6
6
|
let _logtape_logtape = require("@logtape/logtape");
|
|
7
7
|
let _fedify_uri_template = require("@fedify/uri-template");
|
|
8
8
|
let es_toolkit = require("es-toolkit");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "../context-
|
|
3
|
-
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-
|
|
2
|
+
import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "../context-MOrCC7yl.cjs";
|
|
3
|
+
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CZKl1IUS.cjs";
|
|
4
4
|
import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-D8uSFzxe.cjs";
|
|
5
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-
|
|
5
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-B6PwkUMU.cjs";
|
|
6
6
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "../context-
|
|
3
|
-
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-
|
|
2
|
+
import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "../context-BWbdE_MZ.js";
|
|
3
|
+
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CxaI4eGo.js";
|
|
4
4
|
import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-D-nlpY04.js";
|
|
5
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-
|
|
5
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-LmD03uRA.js";
|
|
6
6
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "../middleware-
|
|
3
|
+
import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "../middleware-B4FNnN3W.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { Router as Router$1, RouterError as RouterError$1, assertPath, isPath } from "@fedify/uri-template";
|
|
6
6
|
import { isEqual } from "es-toolkit";
|
|
@@ -7,10 +7,10 @@ import "../std__assert-BvGuO4xO.mjs";
|
|
|
7
7
|
import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
8
8
|
import { n as assertInstanceOf, t as assert } from "../assert-jSdZMYam.mjs";
|
|
9
9
|
import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
|
|
10
|
-
import { l as verifyRequest } from "../http-
|
|
10
|
+
import { l as verifyRequest } from "../http-BNDHRNJP.mjs";
|
|
11
11
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
12
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
13
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-
|
|
12
|
+
import { t as doesActorOwnKey } from "../owner-BsBzJADO.mjs";
|
|
13
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-omt23uTA.mjs";
|
|
14
14
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
15
15
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
16
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import "../std__assert-BvGuO4xO.mjs";
|
|
5
5
|
import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
|
|
6
6
|
import { t as assert } from "../assert-jSdZMYam.mjs";
|
|
7
|
-
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-ZUAQe754.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 () => {
|
|
@@ -6,7 +6,7 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
|
6
6
|
import "../std__assert-BvGuO4xO.mjs";
|
|
7
7
|
import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
|
|
8
8
|
import { t as MemoryKvStore } from "../kv-CX8qfaad.mjs";
|
|
9
|
-
import { o as createFederation, s as handleWebFinger } from "../middleware-
|
|
9
|
+
import { o as createFederation, s as handleWebFinger } from "../middleware-Bj9s3J_0.mjs";
|
|
10
10
|
import { Image, Link, Person, Tombstone } from "@fedify/vocab";
|
|
11
11
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/federation/webfinger.test.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
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-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-DUgFsCmM.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-QrVsKSG9.mjs";
|
|
6
6
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-Dd__NiUL.mjs";
|
|
7
|
-
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-
|
|
7
|
+
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-BbuFo4CW.mjs";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { CryptographicKey } from "@fedify/vocab";
|
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -10,7 +10,7 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } fro
|
|
|
10
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
11
|
//#region deno.json
|
|
12
12
|
var name = "@fedify/fedify";
|
|
13
|
-
var version = "2.3.
|
|
13
|
+
var version = "2.3.10";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/sig/accept.ts
|
|
16
16
|
/**
|
|
@@ -11,7 +11,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
|
|
|
11
11
|
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
12
12
|
//#region deno.json
|
|
13
13
|
var name = "@fedify/fedify";
|
|
14
|
-
var version = "2.3.
|
|
14
|
+
var version = "2.3.10";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/sig/accept.ts
|
|
17
17
|
/**
|
|
@@ -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-
|
|
5
|
-
import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-DUgFsCmM.mjs";
|
|
5
|
+
import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-QrVsKSG9.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -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,
|
|
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,
|
|
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
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { p as recordDocumentCache } from "./metrics-
|
|
4
|
+
import { p as recordDocumentCache } from "./metrics-QrVsKSG9.mjs";
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
|
6
6
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region src/utils/kv-cache.ts
|
|
@@ -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-
|
|
4
|
+
const require_http = require("./http-CTYio50W.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
7
7
|
let es_toolkit = require("es-toolkit");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { T as recordDocumentCache, f as validateCryptoKey, t as doubleKnock } from "./http-
|
|
3
|
+
import { T as recordDocumentCache, f as validateCryptoKey, t as doubleKnock } from "./http-BY8PpQzP.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
6
6
|
import { curry } from "es-toolkit";
|
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
6
|
-
import { r as fetchKey, s as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-DUgFsCmM.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-QrVsKSG9.mjs";
|
|
6
|
+
import { r as fetchKey, s as validateCryptoKey } from "./key-BbuFo4CW.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
|
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|