@fedify/fedify 2.1.25 → 2.1.26
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-DsBAef6b.mjs → builder-9KbL1CoC.mjs} +11 -3
- 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-D4s0Wk3N.d.cts → context-BNwv9Q1v.d.cts} +1 -1
- package/dist/{context-BgU5UWTx.d.ts → context-DLLaDau8.d.ts} +1 -1
- package/dist/{deno-9AaebKOA.mjs → deno-ChmEXNOv.mjs} +1 -1
- package/dist/{docloader-DX96uPUj.mjs → docloader-DEVImb5e.mjs} +2 -2
- package/dist/federation/builder.test.mjs +37 -2
- package/dist/federation/handler.test.mjs +6 -6
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +121 -6
- 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-BJEMpnnY.cjs → http-BOH-uFLj.cjs} +1 -1
- package/dist/{http-B5qAeoJd.mjs → http-B_M80hBW.mjs} +2 -2
- package/dist/{http-CdJ6n4rA.js → http-CeK9QmL_.js} +1 -1
- package/dist/{inbox-BSyjaFbo.mjs → inbox-B_O6TjZS.mjs} +1 -1
- package/dist/{key-x9f-H7eO.mjs → key-BJcK-1Av.mjs} +1 -1
- 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-BDp2c_QE.cjs → kv-cache-BlOG31SS.cjs} +1 -1
- package/dist/{kv-cache-Dx3QwNBI.js → kv-cache-CEJICY0R.js} +1 -1
- package/dist/{ld-cfUwoi0C.mjs → ld-YAXn6sG8.mjs} +2 -2
- package/dist/{middleware-CP35ElZv.js → middleware-C-45wr85.js} +20 -9
- package/dist/{middleware-DHHRwSZH.mjs → middleware-Co_QOX9H.mjs} +20 -17
- package/dist/{middleware-XXuSt_6b.cjs → middleware-DHGVHIUj.cjs} +21 -10
- package/dist/{middleware-DDT9ljTQ.mjs → middleware-DmTWC5VG.mjs} +1 -1
- package/dist/{middleware-BXJpAXhO.cjs → middleware-dGW2gSDG.cjs} +1 -1
- package/dist/{mod-Bx80LUTA.d.cts → mod-BmlfRBmU.d.cts} +1 -1
- package/dist/{mod-DcAiY74j.d.ts → mod-CWJNbyju.d.ts} +1 -1
- package/dist/{mod-DkE98l_7.d.cts → mod-Cn9GJ5ex.d.cts} +1 -1
- package/dist/{mod-DqkY4FDr.d.ts → mod-DNEgTI8M.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-DklgvZXn.mjs → owner-B3ZkY-Ov.mjs} +2 -2
- package/dist/{proof-Dsa_ZC-M.js → proof-BeGIkK97.js} +1 -1
- package/dist/{proof-CI4rsVLu.mjs → proof-DIGrz49z.mjs} +2 -2
- package/dist/{proof-DzFzyfIc.cjs → proof-DzOl2GlQ.cjs} +1 -1
- package/dist/{send-DJmW6Z-I.mjs → send-N2w1IwXT.mjs} +2 -2
- 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-BanFifxu.mjs → temporal-CpT0u5Mx.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- 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 +6 -6
|
@@ -2,8 +2,8 @@ import "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as RouterError, t as Router } from "./router-CrMLXoOr.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
6
|
-
import { t as InboxListenerSet } from "./inbox-
|
|
5
|
+
import { n as version, t as name } from "./deno-ChmEXNOv.mjs";
|
|
6
|
+
import { t as InboxListenerSet } from "./inbox-B_O6TjZS.mjs";
|
|
7
7
|
import { getTypeId } from "@fedify/vocab";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -35,6 +35,7 @@ var FederationBuilderImpl = class {
|
|
|
35
35
|
* Symbol registry for unique identification of unnamed symbols.
|
|
36
36
|
*/
|
|
37
37
|
#symbolRegistry = /* @__PURE__ */ new Map();
|
|
38
|
+
#collectionNames = /* @__PURE__ */ new Map();
|
|
38
39
|
constructor() {
|
|
39
40
|
this.router = new Router();
|
|
40
41
|
this.objectCallbacks = {};
|
|
@@ -43,7 +44,7 @@ var FederationBuilderImpl = class {
|
|
|
43
44
|
this.collectionTypeIds = {};
|
|
44
45
|
}
|
|
45
46
|
async build(options) {
|
|
46
|
-
const { FederationImpl } = await import("./middleware-
|
|
47
|
+
const { FederationImpl } = await import("./middleware-DmTWC5VG.mjs");
|
|
47
48
|
const f = new FederationImpl(options);
|
|
48
49
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
49
50
|
f.router = this.router.clone();
|
|
@@ -56,6 +57,8 @@ var FederationBuilderImpl = class {
|
|
|
56
57
|
f.objectTypeIds = { ...this.objectTypeIds };
|
|
57
58
|
f.collectionCallbacks = { ...this.collectionCallbacks };
|
|
58
59
|
f.collectionTypeIds = { ...this.collectionTypeIds };
|
|
60
|
+
f.#symbolRegistry = new Map(this.#symbolRegistry);
|
|
61
|
+
f.#collectionNames = new Map(this.#collectionNames);
|
|
59
62
|
f.inboxPath = this.inboxPath;
|
|
60
63
|
f.inboxCallbacks = this.inboxCallbacks == null ? void 0 : { ...this.inboxCallbacks };
|
|
61
64
|
f.outboxCallbacks = this.outboxCallbacks == null ? void 0 : { ...this.outboxCallbacks };
|
|
@@ -468,6 +471,7 @@ var FederationBuilderImpl = class {
|
|
|
468
471
|
if (this.router.has(routeName)) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
|
|
469
472
|
if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
|
|
470
473
|
if (this.router.add(path, routeName).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
|
|
474
|
+
this.#collectionNames.set(routeName, name);
|
|
471
475
|
const callbacks = { dispatcher };
|
|
472
476
|
this.collectionCallbacks[name] = callbacks;
|
|
473
477
|
this.collectionTypeIds[name] = itemType;
|
|
@@ -504,6 +508,10 @@ var FederationBuilderImpl = class {
|
|
|
504
508
|
const routeName = this.#uniqueCollectionId(name);
|
|
505
509
|
return this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
|
|
506
510
|
}
|
|
511
|
+
/** Resolves a custom collection route to its original name. */
|
|
512
|
+
getCollectionName(routeName) {
|
|
513
|
+
return this.#collectionNames.get(routeName) ?? routeName.replace(/^(collection|orderedCollection):/, "");
|
|
514
|
+
}
|
|
507
515
|
setOutboxPermanentFailureHandler(handler) {
|
|
508
516
|
this.outboxPermanentFailureHandler = handler;
|
|
509
517
|
}
|
package/dist/compat/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Ct as ActivityTransformer, n as Context } from "../context-
|
|
2
|
+
import { Ct as ActivityTransformer, n as Context } from "../context-BNwv9Q1v.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 { Ct as ActivityTransformer, n as Context } from "../context-
|
|
2
|
+
import { Ct as ActivityTransformer, n as Context } from "../context-DLLaDau8.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-BrZHNugx.mjs";
|
|
7
|
-
import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-
|
|
7
|
+
import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-Co_QOX9H.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 { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-DqZhyEso.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 { 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 { o as VerifyRequestFailureReason, t as HttpMessageSignaturesSpec } from "./http-Dl00HXr4.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 { 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";
|
|
@@ -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-BJcK-1Av.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-B_M80hBW.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-BrZHNugx.mjs";
|
|
8
|
-
import { n as createFederationBuilder } from "../builder-
|
|
8
|
+
import { n as createFederationBuilder } from "../builder-9KbL1CoC.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
|
|
@@ -168,6 +168,41 @@ test("FederationBuilder", async (t) => {
|
|
|
168
168
|
assertEquals(impl.collectionTypeIds["test"], Note);
|
|
169
169
|
assertEquals((await impl.fetch(new Request("https://example.com/c/x", { headers: { accept: "application/activity+json" } }), { contextData: void 0 })).status, 200);
|
|
170
170
|
});
|
|
171
|
+
await t.step("preserves symbol-named collections through build()", async () => {
|
|
172
|
+
const builder = createFederationBuilder();
|
|
173
|
+
const collection = Symbol("saved");
|
|
174
|
+
const ordered = Symbol("saved");
|
|
175
|
+
builder.setCollectionDispatcher(collection, Note, "/users/{identifier}/saved", () => ({ items: [] }));
|
|
176
|
+
builder.setOrderedCollectionDispatcher(ordered, Note, "/users/{identifier}/ordered-saved", () => ({ items: [] }));
|
|
177
|
+
for (let build = 0; build < 2; build++) {
|
|
178
|
+
const federation = await builder.build({ kv: new MemoryKvStore() });
|
|
179
|
+
const ctx = federation.createContext(new URL("https://example.com/"));
|
|
180
|
+
for (const [name, path, type] of [[
|
|
181
|
+
collection,
|
|
182
|
+
"/users/alice/saved",
|
|
183
|
+
"collection"
|
|
184
|
+
], [
|
|
185
|
+
ordered,
|
|
186
|
+
"/users/alice/ordered-saved",
|
|
187
|
+
"orderedCollection"
|
|
188
|
+
]]) {
|
|
189
|
+
const uri = ctx.getCollectionUri(name, { identifier: "alice" });
|
|
190
|
+
assertEquals(uri.pathname, path);
|
|
191
|
+
const parsed = ctx.parseUri(uri);
|
|
192
|
+
assertEquals(parsed?.type, type);
|
|
193
|
+
if (parsed?.type !== "collection" && parsed?.type !== "orderedCollection") throw new Error("Expected a custom collection URI");
|
|
194
|
+
assertStrictEquals(parsed.name, name);
|
|
195
|
+
assertStrictEquals(parsed.class, Note);
|
|
196
|
+
assertEquals(parsed.values, { identifier: "alice" });
|
|
197
|
+
for (const cursor of [null, "next"]) {
|
|
198
|
+
const pageUri = new URL(uri);
|
|
199
|
+
if (cursor != null) pageUri.searchParams.set("cursor", cursor);
|
|
200
|
+
assertEquals((await federation.fetch(new Request(pageUri, { headers: { accept: "application/activity+json" } }), { contextData: void 0 })).status, 200);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
assertThrows(() => federation.setCollectionDispatcher(collection, Note, "/users/{identifier}/duplicate", () => ({ items: [] })));
|
|
204
|
+
}
|
|
205
|
+
});
|
|
171
206
|
});
|
|
172
207
|
//#endregion
|
|
173
208
|
export {};
|
|
@@ -7,14 +7,14 @@ 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
9
|
import { r as parseAcceptSignature } from "../accept-BavzedPB.mjs";
|
|
10
|
-
import { a as generateCryptoKeyPair } from "../key-
|
|
11
|
-
import { s as signRequest } from "../http-
|
|
10
|
+
import { a as generateCryptoKeyPair } from "../key-BJcK-1Av.mjs";
|
|
11
|
+
import { s as signRequest } from "../http-B_M80hBW.mjs";
|
|
12
12
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-CtZLJq76.mjs";
|
|
13
|
-
import { a as compactJsonLd, f as signJsonLd } from "../ld-
|
|
14
|
-
import { n as signObject } from "../proof-
|
|
13
|
+
import { a as compactJsonLd, f as signJsonLd } from "../ld-YAXn6sG8.mjs";
|
|
14
|
+
import { n as signObject } from "../proof-DIGrz49z.mjs";
|
|
15
15
|
import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
|
|
16
|
-
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-
|
|
17
|
-
import { t as InboxListenerSet } from "../inbox-
|
|
16
|
+
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-Co_QOX9H.mjs";
|
|
17
|
+
import { t as InboxListenerSet } from "../inbox-B_O6TjZS.mjs";
|
|
18
18
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
19
19
|
import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
|
|
20
20
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -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-CtZLJq76.mjs";
|
|
7
|
-
import { n as signObject } from "../proof-
|
|
7
|
+
import { n as signObject } from "../proof-DIGrz49z.mjs";
|
|
8
8
|
import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
|
|
9
|
-
import { a as createFederation } from "../middleware-
|
|
9
|
+
import { a as createFederation } from "../middleware-Co_QOX9H.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-
|
|
6
|
+
import { t as InboxListenerSet } from "../inbox-B_O6TjZS.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-
|
|
12
|
+
import { l as verifyRequest, s as signRequest } from "../http-B_M80hBW.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-CtZLJq76.mjs";
|
|
14
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
15
|
-
import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-
|
|
16
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
17
|
-
import { n as signObject, r as verifyObject } from "../proof-
|
|
14
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-DEVImb5e.mjs";
|
|
15
|
+
import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-YAXn6sG8.mjs";
|
|
16
|
+
import { t as doesActorOwnKey } from "../owner-B3ZkY-Ov.mjs";
|
|
17
|
+
import { n as signObject, r as verifyObject } from "../proof-DIGrz49z.mjs";
|
|
18
18
|
import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
|
|
19
|
-
import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-
|
|
19
|
+
import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-Co_QOX9H.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";
|
|
@@ -3797,6 +3797,80 @@ test({
|
|
|
3797
3797
|
]);
|
|
3798
3798
|
}
|
|
3799
3799
|
});
|
|
3800
|
+
for (const queued of [false, true]) test(`ContextImpl.routeActivity() routes the fetched document (queued: ${queued})`, async () => {
|
|
3801
|
+
const id = new URL("https://example.com/verified-create");
|
|
3802
|
+
const genuine = new Create({
|
|
3803
|
+
id,
|
|
3804
|
+
actor: new URL("https://example.com/person"),
|
|
3805
|
+
object: new vocab.Note({ content: "Genuine content" }),
|
|
3806
|
+
to: new URL("https://example.com/recipient")
|
|
3807
|
+
});
|
|
3808
|
+
const genuineJson = await genuine.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
3809
|
+
const forged = new Create({
|
|
3810
|
+
id,
|
|
3811
|
+
actor: new URL("https://victim.example/actor"),
|
|
3812
|
+
object: new vocab.Note({ content: "Forged content" }),
|
|
3813
|
+
to: new URL("https://attacker.example/recipient")
|
|
3814
|
+
});
|
|
3815
|
+
const messages = [];
|
|
3816
|
+
const queue = {
|
|
3817
|
+
enqueue(message) {
|
|
3818
|
+
messages.push(message);
|
|
3819
|
+
return Promise.resolve();
|
|
3820
|
+
},
|
|
3821
|
+
async listen() {}
|
|
3822
|
+
};
|
|
3823
|
+
const federation = createFederation({
|
|
3824
|
+
kv: new MemoryKvStore(),
|
|
3825
|
+
documentLoaderFactory: () => async (url, options) => url === id.href ? {
|
|
3826
|
+
document: genuineJson,
|
|
3827
|
+
documentUrl: id.href,
|
|
3828
|
+
contextUrl: null
|
|
3829
|
+
} : await mockDocumentLoader(url, options),
|
|
3830
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
3831
|
+
queue: {
|
|
3832
|
+
inbox: queued ? queue : void 0,
|
|
3833
|
+
outbox: queue
|
|
3834
|
+
},
|
|
3835
|
+
manuallyStartQueue: true
|
|
3836
|
+
});
|
|
3837
|
+
const received = [];
|
|
3838
|
+
const contextDocuments = [];
|
|
3839
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, async (ctx, activity) => {
|
|
3840
|
+
received.push(await activity.toJsonLd({ contextLoader: mockDocumentLoader }));
|
|
3841
|
+
assertInstanceOf(ctx, InboxContextImpl);
|
|
3842
|
+
contextDocuments.push(ctx.activity);
|
|
3843
|
+
await ctx.forwardActivity({
|
|
3844
|
+
privateKey: ed25519PrivateKey,
|
|
3845
|
+
keyId: ed25519Multikey.id
|
|
3846
|
+
}, {
|
|
3847
|
+
id: new URL("https://example.com/recipient"),
|
|
3848
|
+
inboxId: new URL("https://example.com/inbox")
|
|
3849
|
+
});
|
|
3850
|
+
});
|
|
3851
|
+
const ctx = federation.createContext(new URL("https://local.example/"));
|
|
3852
|
+
async function processInbox() {
|
|
3853
|
+
const inboxMessages = messages.filter((message) => message.type === "inbox");
|
|
3854
|
+
for (const message of inboxMessages) await federation.processQueuedTask(void 0, message);
|
|
3855
|
+
}
|
|
3856
|
+
assert(await ctx.routeActivity(null, forged));
|
|
3857
|
+
if (queued) {
|
|
3858
|
+
assertEquals(received, []);
|
|
3859
|
+
assertEquals(messages.length, 1);
|
|
3860
|
+
assertEquals(messages[0].activity, genuineJson);
|
|
3861
|
+
await processInbox();
|
|
3862
|
+
}
|
|
3863
|
+
assertEquals(received, [genuineJson]);
|
|
3864
|
+
assertEquals(contextDocuments, [genuineJson]);
|
|
3865
|
+
const forwarded = messages.filter((message) => message.type === "outbox");
|
|
3866
|
+
assertEquals(forwarded.length, 1);
|
|
3867
|
+
assertEquals(forwarded[0].activity, genuineJson);
|
|
3868
|
+
assert(await ctx.routeActivity(null, genuine));
|
|
3869
|
+
if (queued) await processInbox();
|
|
3870
|
+
assertEquals(received, [genuineJson]);
|
|
3871
|
+
assertEquals(contextDocuments, [genuineJson]);
|
|
3872
|
+
assertEquals(messages.filter((message) => message.type === "outbox").length, 1);
|
|
3873
|
+
});
|
|
3800
3874
|
test("ContextImpl.routeActivity() marks queued signed activities as non-LDS", async () => {
|
|
3801
3875
|
let queuedMessage = null;
|
|
3802
3876
|
const federation = new FederationImpl({
|
|
@@ -3856,6 +3930,47 @@ test("ContextImpl.getCollectionUri()", () => {
|
|
|
3856
3930
|
assertThrows(() => ctx.getCollectionUri(Symbol(notReg), values));
|
|
3857
3931
|
assertThrows(() => ctx.getCollectionUri(Symbol.for(notReg), values));
|
|
3858
3932
|
});
|
|
3933
|
+
test("symbol-named custom collections are served and parsed", async () => {
|
|
3934
|
+
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
3935
|
+
const names = [Symbol("bookmarks"), Symbol("bookmarks")];
|
|
3936
|
+
const paths = ["bookmarks", "ordered-bookmarks"];
|
|
3937
|
+
const calls = [];
|
|
3938
|
+
federation.setCollectionDispatcher(names[0], vocab.Object, "/users/{identifier}/bookmarks", (_ctx, _values, cursor) => {
|
|
3939
|
+
calls.push([0, cursor]);
|
|
3940
|
+
return { items: [] };
|
|
3941
|
+
});
|
|
3942
|
+
federation.setOrderedCollectionDispatcher(names[1], vocab.Object, "/users/{identifier}/ordered-bookmarks", (_ctx, _values, cursor) => {
|
|
3943
|
+
calls.push([1, cursor]);
|
|
3944
|
+
return { items: [] };
|
|
3945
|
+
});
|
|
3946
|
+
const ctx = federation.createContext(new URL("https://example.com/"));
|
|
3947
|
+
for (const [index, name] of names.entries()) {
|
|
3948
|
+
const uri = ctx.getCollectionUri(name, { identifier: "alice" });
|
|
3949
|
+
assertEquals(uri.pathname, `/users/alice/${paths[index]}`);
|
|
3950
|
+
const parsed = ctx.parseUri(uri);
|
|
3951
|
+
assertEquals(parsed?.type, index === 0 ? "collection" : "orderedCollection");
|
|
3952
|
+
if (parsed?.type !== "collection" && parsed?.type !== "orderedCollection") throw new Error("Expected a custom collection URI");
|
|
3953
|
+
assertStrictEquals(parsed.name, name);
|
|
3954
|
+
assertStrictEquals(parsed.class, vocab.Object);
|
|
3955
|
+
assertEquals(parsed.typeId, vocab.Object.typeId);
|
|
3956
|
+
assertEquals(parsed.values, { identifier: "alice" });
|
|
3957
|
+
for (const cursor of [null, "next"]) {
|
|
3958
|
+
const pageUri = new URL(uri);
|
|
3959
|
+
if (cursor != null) pageUri.searchParams.set("cursor", cursor);
|
|
3960
|
+
const response = await federation.fetch(new Request(pageUri, { headers: { accept: "application/activity+json" } }), { contextData: void 0 });
|
|
3961
|
+
assertEquals(response.status, 200);
|
|
3962
|
+
const body = await response.json();
|
|
3963
|
+
assert(body !== null && typeof body === "object" && "type" in body);
|
|
3964
|
+
assertEquals(body.type, `${index === 0 ? "Collection" : "OrderedCollection"}${cursor == null ? "" : "Page"}`);
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
assertEquals(calls, [
|
|
3968
|
+
[0, null],
|
|
3969
|
+
[0, "next"],
|
|
3970
|
+
[1, null],
|
|
3971
|
+
[1, "next"]
|
|
3972
|
+
]);
|
|
3973
|
+
});
|
|
3859
3974
|
test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
3860
3975
|
esm_default.spyGlobal();
|
|
3861
3976
|
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-DHGVHIUj.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 ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "../context-
|
|
3
|
-
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-
|
|
4
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-
|
|
2
|
+
import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "../context-BNwv9Q1v.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-BmlfRBmU.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, InboxChallengePolicy, 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, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "../context-
|
|
3
|
-
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-
|
|
4
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-
|
|
2
|
+
import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "../context-DLLaDau8.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-CWJNbyju.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, InboxChallengePolicy, 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, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, 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 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-
|
|
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-C-45wr85.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-
|
|
10
|
+
import { l as verifyRequest } from "../http-B_M80hBW.mjs";
|
|
11
11
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.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-B3ZkY-Ov.mjs";
|
|
13
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-N2w1IwXT.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-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-CpT0u5Mx.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-BrZHNugx.mjs";
|
|
8
|
-
import { a as createFederation, o as handleWebFinger } from "../middleware-
|
|
8
|
+
import { a as createFederation, o as handleWebFinger } from "../middleware-Co_QOX9H.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
|
|
@@ -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.1.
|
|
14
|
+
var version = "2.1.26";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/sig/accept.ts
|
|
17
17
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
4
|
+
import { n as version, t as name } from "./deno-ChmEXNOv.mjs";
|
|
5
5
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-BavzedPB.mjs";
|
|
6
|
-
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-
|
|
6
|
+
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-BJcK-1Av.mjs";
|
|
7
7
|
import { CryptographicKey } from "@fedify/vocab";
|
|
8
8
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -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.1.
|
|
13
|
+
var version = "2.1.26";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/sig/accept.ts
|
|
16
16
|
/**
|
|
@@ -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-
|
|
4
|
+
import { n as version, t as name } from "./deno-ChmEXNOv.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-
|
|
4
|
+
import { n as version, t as name } from "./deno-ChmEXNOv.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 { FetchError, 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,
|
|
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
|
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-BOH-uFLj.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 { f as validateCryptoKey, t as doubleKnock } from "./http-
|
|
3
|
+
import { f as validateCryptoKey, t as doubleKnock } from "./http-CeK9QmL_.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-
|
|
5
|
-
import { r as fetchKey, s as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-ChmEXNOv.mjs";
|
|
5
|
+
import { r as fetchKey, s as validateCryptoKey } from "./key-BJcK-1Av.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";
|