@fedify/fedify 2.2.0-dev.869 → 2.2.0-pr.695.23
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/README.md +0 -2
- package/dist/{builder-D8YzbzDN.mjs → builder-_3USSkAi.mjs} +7 -57
- 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-BGrYMSTk.d.ts → context-78ecvxf5.d.ts} +1 -143
- package/dist/{context-CMUd4wy0.d.cts → context-DYDPdoCb.d.cts} +1 -143
- package/dist/{context-Dk_tacqz.mjs → context-Juj6bdHC.mjs} +2 -17
- package/dist/{deno-DXdMYkAF.mjs → deno-CALl2W-v.mjs} +1 -1
- package/dist/{docloader-D6GGGkLu.mjs → docloader-Cd_GcKDJ.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -25
- package/dist/federation/handler.test.mjs +8 -369
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +3 -3
- package/dist/federation/middleware.test.mjs +8 -510
- 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/webfinger.test.mjs +2 -2
- package/dist/{http-Bkl65Xah.cjs → http-BmjzD8cM.cjs} +1 -1
- package/dist/{http-kJLVVuQ4.mjs → http-BoYB66uz.mjs} +2 -2
- package/dist/{http-Bwhs9THj.js → http-Co58ywXN.js} +1 -1
- package/dist/inbox-BRn2Zxr4.mjs +179 -0
- package/dist/{key-DY9YAHVK.mjs → key-CrCG-yLH.mjs} +1 -1
- package/dist/{kv-cache-DTEfriBO.js → kv-cache-DWlJLiMn.js} +1 -1
- package/dist/{kv-cache-PqsOT6Ky.cjs → kv-cache-GmvjgIY4.cjs} +1 -1
- package/dist/{ld-Bittq8I7.mjs → ld-Cj_0JVzk.mjs} +3 -26
- package/dist/{middleware-BE03PkEx.mjs → middleware-B-hCoIdY.mjs} +180 -612
- package/dist/{middleware-DVMQdDWr.cjs → middleware-BXCjmWN2.cjs} +1 -1
- package/dist/{middleware-VSA_KWpd.js → middleware-CLVQBjm2.js} +368 -716
- package/dist/{middleware-ChIzhod7.mjs → middleware-Djvz1scF.mjs} +1 -1
- package/dist/{middleware-DMOqJ2rJ.cjs → middleware-SVMhMPsP.cjs} +365 -718
- package/dist/{mod-BcJHeuv1.d.cts → mod-CEohtXhV.d.cts} +1 -1
- package/dist/{mod-CJXfyw7v.d.ts → mod-CokIUYDr.d.ts} +1 -1
- package/dist/{mod-Cr3f-ACa.d.cts → mod-DoJBjjnO.d.cts} +1 -18
- package/dist/{mod-CR8soWa9.d.ts → mod-DvxszxXC.d.ts} +1 -18
- package/dist/mod.cjs +4 -6
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/{owner-BZgNaUac.mjs → owner-CQ0ITJYn.mjs} +2 -2
- package/dist/{proof-DX47G5Fd.js → proof-B2qPm5I4.js} +2 -54
- package/dist/{proof-B5TlVvOq.cjs → proof-Bvs3L21X.cjs} +3 -61
- package/dist/{proof-41DPsEcO.mjs → proof-OOosrRgx.mjs} +3 -32
- package/dist/{send-m-XUlhVD.mjs → send-CP34W1Zh.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 -44
- package/dist/sig/mod.cjs +2 -4
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +3 -3
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +2 -46
- package/dist/testing/mod.d.mts +1 -149
- package/dist/testing/mod.mjs +2 -2
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +5 -5
- package/dist/activity-listener-Ck3JZ_hR.mjs +0 -40
|
@@ -10,19 +10,18 @@ import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.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
12
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
13
|
-
import { l as verifyRequest, s as signRequest } from "../http-
|
|
13
|
+
import { l as verifyRequest, s as signRequest } from "../http-BoYB66uz.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 signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-
|
|
17
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
18
|
-
import {
|
|
15
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-Cd_GcKDJ.mjs";
|
|
16
|
+
import { a as signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-Cj_0JVzk.mjs";
|
|
17
|
+
import { t as doesActorOwnKey } from "../owner-CQ0ITJYn.mjs";
|
|
18
|
+
import { n as signObject, r as verifyObject } from "../proof-OOosrRgx.mjs";
|
|
19
19
|
import { t as MemoryKvStore } from "../kv-tL2TOE9X.mjs";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-B-hCoIdY.mjs";
|
|
21
|
+
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
22
22
|
import * as vocab from "@fedify/vocab";
|
|
23
23
|
import { getTypeId, lookupObject } from "@fedify/vocab";
|
|
24
24
|
import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
25
|
-
import { configure, reset } from "@logtape/logtape";
|
|
26
25
|
//#region ../fixture/src/fixtures/example.com/create.json
|
|
27
26
|
var id$2 = "https://example.com/create";
|
|
28
27
|
var create_default = {
|
|
@@ -88,12 +87,6 @@ var person2_default = {
|
|
|
88
87
|
//#endregion
|
|
89
88
|
//#region src/federation/middleware.test.ts
|
|
90
89
|
const documentLoader = getDocumentLoader();
|
|
91
|
-
let logtapeLock = Promise.resolve();
|
|
92
|
-
async function withLogtapeLock(fn) {
|
|
93
|
-
const run = logtapeLock.then(fn, fn);
|
|
94
|
-
logtapeLock = run.then(() => void 0, () => void 0);
|
|
95
|
-
return await run;
|
|
96
|
-
}
|
|
97
90
|
test("createFederation()", async (t) => {
|
|
98
91
|
const kv = new MemoryKvStore();
|
|
99
92
|
await t.step("allowPrivateAddress", () => {
|
|
@@ -1319,418 +1312,6 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
1319
1312
|
});
|
|
1320
1313
|
esm_default.hardReset();
|
|
1321
1314
|
});
|
|
1322
|
-
test("Federation.setOutboxListeners()", async (t) => {
|
|
1323
|
-
const kv = new MemoryKvStore();
|
|
1324
|
-
await t.step("path match", () => {
|
|
1325
|
-
const federation = createFederation({
|
|
1326
|
-
kv,
|
|
1327
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1328
|
-
});
|
|
1329
|
-
federation.setOutboxDispatcher("/users/{identifier}/outbox", () => ({ items: [] }));
|
|
1330
|
-
assertThrows(() => federation.setOutboxListeners("/users/{identifier}/outbox2"), RouterError);
|
|
1331
|
-
});
|
|
1332
|
-
await t.step("on() and authorize()", async () => {
|
|
1333
|
-
const postedFixture = {
|
|
1334
|
-
...create_default,
|
|
1335
|
-
actor: "https://example.com/users/john"
|
|
1336
|
-
};
|
|
1337
|
-
const federation = createFederation({
|
|
1338
|
-
kv,
|
|
1339
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1340
|
-
});
|
|
1341
|
-
const received = [];
|
|
1342
|
-
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1343
|
-
privateKey: rsaPrivateKey2,
|
|
1344
|
-
publicKey: rsaPublicKey2.publicKey
|
|
1345
|
-
}]);
|
|
1346
|
-
federation.setOutboxDispatcher("/users/{identifier}/outbox", () => ({ items: [] })).authorize((_ctx, identifier) => identifier === "john");
|
|
1347
|
-
federation.setOutboxListeners("/users/{identifier}/outbox").on(vocab.Activity, (ctx, activity) => {
|
|
1348
|
-
received.push(`${ctx.identifier}:${activity.id?.href}`);
|
|
1349
|
-
}).authorize((ctx, identifier) => {
|
|
1350
|
-
return identifier === "john" && ctx.request.headers.get("authorization") === "Bearer token";
|
|
1351
|
-
});
|
|
1352
|
-
let response = await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1353
|
-
method: "POST",
|
|
1354
|
-
body: JSON.stringify(postedFixture),
|
|
1355
|
-
headers: { "content-type": "application/activity+json" }
|
|
1356
|
-
}), { contextData: void 0 });
|
|
1357
|
-
assertEquals(response.status, 401);
|
|
1358
|
-
assertEquals(received, []);
|
|
1359
|
-
response = await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1360
|
-
method: "POST",
|
|
1361
|
-
body: JSON.stringify(postedFixture),
|
|
1362
|
-
headers: {
|
|
1363
|
-
authorization: "Bearer token",
|
|
1364
|
-
"content-type": "application/activity+json"
|
|
1365
|
-
}
|
|
1366
|
-
}), { contextData: void 0 });
|
|
1367
|
-
assertEquals([response.status, await response.text()], [202, ""]);
|
|
1368
|
-
assertEquals(received, [`john:${id$2}`]);
|
|
1369
|
-
response = await federation.fetch(new Request("https://example.com/users/no-one/outbox", {
|
|
1370
|
-
method: "POST",
|
|
1371
|
-
body: JSON.stringify(create_default),
|
|
1372
|
-
headers: {
|
|
1373
|
-
authorization: "Bearer token",
|
|
1374
|
-
"content-type": "application/activity+json"
|
|
1375
|
-
}
|
|
1376
|
-
}), { contextData: void 0 });
|
|
1377
|
-
assertEquals(response.status, 401);
|
|
1378
|
-
});
|
|
1379
|
-
await t.step("POST without listeners returns 405", async () => {
|
|
1380
|
-
const federation = createFederation({
|
|
1381
|
-
kv,
|
|
1382
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1383
|
-
});
|
|
1384
|
-
federation.setActorDispatcher("/users/{identifier}", () => new vocab.Person({}));
|
|
1385
|
-
federation.setOutboxDispatcher("/users/{identifier}/outbox", () => ({ items: [] }));
|
|
1386
|
-
const response = await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1387
|
-
method: "POST",
|
|
1388
|
-
body: JSON.stringify(create_default),
|
|
1389
|
-
headers: { "content-type": "application/activity+json" }
|
|
1390
|
-
}), { contextData: void 0 });
|
|
1391
|
-
assertEquals(response.status, 405);
|
|
1392
|
-
assertEquals(response.headers.get("allow"), "GET, HEAD");
|
|
1393
|
-
});
|
|
1394
|
-
await t.step("falls back to outbox dispatcher authorize when listener authorize is unset", async () => {
|
|
1395
|
-
const postedFixture = {
|
|
1396
|
-
...create_default,
|
|
1397
|
-
actor: "https://example.com/users/john"
|
|
1398
|
-
};
|
|
1399
|
-
const federation = createFederation({
|
|
1400
|
-
kv,
|
|
1401
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1402
|
-
});
|
|
1403
|
-
const received = [];
|
|
1404
|
-
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1405
|
-
privateKey: rsaPrivateKey2,
|
|
1406
|
-
publicKey: rsaPublicKey2.publicKey
|
|
1407
|
-
}]);
|
|
1408
|
-
federation.setOutboxDispatcher("/users/{identifier}/outbox", () => ({ items: [] })).authorize((ctx, identifier) => {
|
|
1409
|
-
return identifier === "john" && ctx.request.headers.get("authorization") === "Bearer token";
|
|
1410
|
-
});
|
|
1411
|
-
federation.setOutboxListeners("/users/{identifier}/outbox").on(vocab.Activity, (ctx, activity) => {
|
|
1412
|
-
received.push(`${ctx.identifier}:${activity.id?.href}`);
|
|
1413
|
-
});
|
|
1414
|
-
let response = await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1415
|
-
method: "POST",
|
|
1416
|
-
body: JSON.stringify(postedFixture),
|
|
1417
|
-
headers: { "content-type": "application/activity+json" }
|
|
1418
|
-
}), { contextData: void 0 });
|
|
1419
|
-
assertEquals(response.status, 401);
|
|
1420
|
-
assertEquals(received, []);
|
|
1421
|
-
response = await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1422
|
-
method: "POST",
|
|
1423
|
-
body: JSON.stringify(postedFixture),
|
|
1424
|
-
headers: {
|
|
1425
|
-
authorization: "Bearer token",
|
|
1426
|
-
"content-type": "application/activity+json"
|
|
1427
|
-
}
|
|
1428
|
-
}), { contextData: void 0 });
|
|
1429
|
-
assertEquals([response.status, await response.text()], [202, ""]);
|
|
1430
|
-
assertEquals(received, [`john:${id$2}`]);
|
|
1431
|
-
});
|
|
1432
|
-
await t.step("warns when listener omits delivery", async () => {
|
|
1433
|
-
await withLogtapeLock(async () => {
|
|
1434
|
-
const postedFixture = {
|
|
1435
|
-
...create_default,
|
|
1436
|
-
actor: "https://example.com/users/john"
|
|
1437
|
-
};
|
|
1438
|
-
const records = [];
|
|
1439
|
-
await reset();
|
|
1440
|
-
try {
|
|
1441
|
-
await configure({
|
|
1442
|
-
sinks: { buffer(record) {
|
|
1443
|
-
records.push(record);
|
|
1444
|
-
} },
|
|
1445
|
-
filters: {},
|
|
1446
|
-
loggers: [{
|
|
1447
|
-
category: [],
|
|
1448
|
-
sinks: ["buffer"]
|
|
1449
|
-
}]
|
|
1450
|
-
});
|
|
1451
|
-
const federation = createFederation({
|
|
1452
|
-
kv,
|
|
1453
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1454
|
-
});
|
|
1455
|
-
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1456
|
-
privateKey: rsaPrivateKey2,
|
|
1457
|
-
publicKey: rsaPublicKey2.publicKey
|
|
1458
|
-
}]);
|
|
1459
|
-
federation.setOutboxListeners("/users/{identifier}/outbox").on(vocab.Activity, () => {}).authorize((ctx, identifier) => {
|
|
1460
|
-
return identifier === "john" && ctx.request.headers.get("authorization") === "Bearer token";
|
|
1461
|
-
});
|
|
1462
|
-
assertEquals((await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1463
|
-
method: "POST",
|
|
1464
|
-
body: JSON.stringify(postedFixture),
|
|
1465
|
-
headers: {
|
|
1466
|
-
authorization: "Bearer token",
|
|
1467
|
-
"content-type": "application/activity+json"
|
|
1468
|
-
}
|
|
1469
|
-
}), { contextData: void 0 })).status, 202);
|
|
1470
|
-
assertEquals(records.some((record) => record.rawMessage === "Outbox listener for {identifier} returned without delivering the posted activity; ctx.sendActivity() or ctx.forwardActivity() may have been skipped or resulted in no delivery." && record.properties.identifier === "john"), true);
|
|
1471
|
-
} finally {
|
|
1472
|
-
await reset();
|
|
1473
|
-
}
|
|
1474
|
-
});
|
|
1475
|
-
});
|
|
1476
|
-
await t.step("does not warn when listener calls sendActivity()", async () => {
|
|
1477
|
-
await withLogtapeLock(async () => {
|
|
1478
|
-
const postedFixture = {
|
|
1479
|
-
...create_default,
|
|
1480
|
-
actor: "https://example.com/users/john"
|
|
1481
|
-
};
|
|
1482
|
-
const records = [];
|
|
1483
|
-
await reset();
|
|
1484
|
-
esm_default.spyGlobal();
|
|
1485
|
-
esm_default.post("https://remote.example/inbox", {
|
|
1486
|
-
status: 202,
|
|
1487
|
-
body: "Accepted"
|
|
1488
|
-
});
|
|
1489
|
-
try {
|
|
1490
|
-
await configure({
|
|
1491
|
-
sinks: { buffer(record) {
|
|
1492
|
-
records.push(record);
|
|
1493
|
-
} },
|
|
1494
|
-
filters: {},
|
|
1495
|
-
loggers: [{
|
|
1496
|
-
category: [],
|
|
1497
|
-
sinks: ["buffer"]
|
|
1498
|
-
}]
|
|
1499
|
-
});
|
|
1500
|
-
const federation = createFederation({
|
|
1501
|
-
kv,
|
|
1502
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1503
|
-
});
|
|
1504
|
-
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1505
|
-
privateKey: rsaPrivateKey2,
|
|
1506
|
-
publicKey: rsaPublicKey2.publicKey
|
|
1507
|
-
}]);
|
|
1508
|
-
federation.setOutboxListeners("/users/{identifier}/outbox").on(vocab.Activity, async (ctx, activity) => {
|
|
1509
|
-
await ctx.sendActivity({ identifier: ctx.identifier }, new vocab.Person({
|
|
1510
|
-
id: new URL("https://remote.example/users/alice"),
|
|
1511
|
-
inbox: new URL("https://remote.example/inbox")
|
|
1512
|
-
}), activity);
|
|
1513
|
-
}).authorize((ctx, identifier) => {
|
|
1514
|
-
return identifier === "john" && ctx.request.headers.get("authorization") === "Bearer token";
|
|
1515
|
-
});
|
|
1516
|
-
assertEquals((await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1517
|
-
method: "POST",
|
|
1518
|
-
body: JSON.stringify(postedFixture),
|
|
1519
|
-
headers: {
|
|
1520
|
-
authorization: "Bearer token",
|
|
1521
|
-
"content-type": "application/activity+json"
|
|
1522
|
-
}
|
|
1523
|
-
}), { contextData: void 0 })).status, 202);
|
|
1524
|
-
assertEquals(records.some((record) => record.rawMessage === "Outbox listener for {identifier} returned without delivering the posted activity; ctx.sendActivity() or ctx.forwardActivity() may have been skipped or resulted in no delivery."), false);
|
|
1525
|
-
} finally {
|
|
1526
|
-
esm_default.hardReset();
|
|
1527
|
-
await reset();
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1530
|
-
});
|
|
1531
|
-
await t.step("warns when listener calls sendActivity() with zero inboxes", async () => {
|
|
1532
|
-
await withLogtapeLock(async () => {
|
|
1533
|
-
const postedFixture = {
|
|
1534
|
-
...create_default,
|
|
1535
|
-
actor: "https://example.com/users/john"
|
|
1536
|
-
};
|
|
1537
|
-
const records = [];
|
|
1538
|
-
await reset();
|
|
1539
|
-
try {
|
|
1540
|
-
await configure({
|
|
1541
|
-
sinks: { buffer(record) {
|
|
1542
|
-
records.push(record);
|
|
1543
|
-
} },
|
|
1544
|
-
filters: {},
|
|
1545
|
-
loggers: [{
|
|
1546
|
-
category: [],
|
|
1547
|
-
sinks: ["buffer"]
|
|
1548
|
-
}]
|
|
1549
|
-
});
|
|
1550
|
-
const federation = createFederation({
|
|
1551
|
-
kv,
|
|
1552
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1553
|
-
});
|
|
1554
|
-
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1555
|
-
privateKey: rsaPrivateKey2,
|
|
1556
|
-
publicKey: rsaPublicKey2.publicKey
|
|
1557
|
-
}]);
|
|
1558
|
-
federation.setOutboxListeners("/users/{identifier}/outbox").on(vocab.Activity, async (ctx, activity) => {
|
|
1559
|
-
await ctx.sendActivity({ identifier: ctx.identifier }, [], activity);
|
|
1560
|
-
}).authorize((ctx, identifier) => {
|
|
1561
|
-
return identifier === "john" && ctx.request.headers.get("authorization") === "Bearer token";
|
|
1562
|
-
});
|
|
1563
|
-
assertEquals((await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1564
|
-
method: "POST",
|
|
1565
|
-
body: JSON.stringify(postedFixture),
|
|
1566
|
-
headers: {
|
|
1567
|
-
authorization: "Bearer token",
|
|
1568
|
-
"content-type": "application/activity+json"
|
|
1569
|
-
}
|
|
1570
|
-
}), { contextData: void 0 })).status, 202);
|
|
1571
|
-
assertEquals(records.some((record) => record.rawMessage === "Outbox listener for {identifier} returned without delivering the posted activity; ctx.sendActivity() or ctx.forwardActivity() may have been skipped or resulted in no delivery." && record.properties.identifier === "john"), true);
|
|
1572
|
-
} finally {
|
|
1573
|
-
await reset();
|
|
1574
|
-
}
|
|
1575
|
-
});
|
|
1576
|
-
});
|
|
1577
|
-
await t.step("does not warn when listener calls forwardActivity()", async () => {
|
|
1578
|
-
await withLogtapeLock(async () => {
|
|
1579
|
-
const postedFixture = await signJsonLd({
|
|
1580
|
-
...create_default,
|
|
1581
|
-
actor: "https://example.com/person2"
|
|
1582
|
-
}, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader });
|
|
1583
|
-
const records = [];
|
|
1584
|
-
let ldsVerified = false;
|
|
1585
|
-
await reset();
|
|
1586
|
-
esm_default.spyGlobal();
|
|
1587
|
-
esm_default.post("https://remote.example/inbox", async (cl) => {
|
|
1588
|
-
const verifyOptions = {
|
|
1589
|
-
documentLoader: mockDocumentLoader,
|
|
1590
|
-
contextLoader: mockDocumentLoader
|
|
1591
|
-
};
|
|
1592
|
-
ldsVerified = await verifyJsonLd(await cl.request.json(), verifyOptions);
|
|
1593
|
-
return new Response(null, { status: ldsVerified ? 202 : 401 });
|
|
1594
|
-
});
|
|
1595
|
-
try {
|
|
1596
|
-
await configure({
|
|
1597
|
-
sinks: { buffer(record) {
|
|
1598
|
-
records.push(record);
|
|
1599
|
-
} },
|
|
1600
|
-
filters: {},
|
|
1601
|
-
loggers: [{
|
|
1602
|
-
category: [],
|
|
1603
|
-
sinks: ["buffer"]
|
|
1604
|
-
}]
|
|
1605
|
-
});
|
|
1606
|
-
const federation = createFederation({
|
|
1607
|
-
kv,
|
|
1608
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1609
|
-
});
|
|
1610
|
-
federation.setActorDispatcher("/{identifier}", (_ctx, identifier) => identifier === "person2" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1611
|
-
privateKey: rsaPrivateKey2,
|
|
1612
|
-
publicKey: rsaPublicKey2.publicKey
|
|
1613
|
-
}]);
|
|
1614
|
-
federation.setOutboxListeners("/users/{identifier}/outbox").on(vocab.Activity, async (ctx) => {
|
|
1615
|
-
await ctx.forwardActivity([{
|
|
1616
|
-
privateKey: rsaPrivateKey2,
|
|
1617
|
-
keyId: rsaPublicKey2.id
|
|
1618
|
-
}], {
|
|
1619
|
-
id: new URL("https://remote.example/users/alice"),
|
|
1620
|
-
inboxId: new URL("https://remote.example/inbox")
|
|
1621
|
-
}, { skipIfUnsigned: true });
|
|
1622
|
-
}).authorize((ctx, identifier) => {
|
|
1623
|
-
return identifier === "person2" && ctx.request.headers.get("authorization") === "Bearer token";
|
|
1624
|
-
});
|
|
1625
|
-
assertEquals((await federation.fetch(new Request("https://example.com/users/person2/outbox", {
|
|
1626
|
-
method: "POST",
|
|
1627
|
-
body: JSON.stringify(postedFixture),
|
|
1628
|
-
headers: {
|
|
1629
|
-
authorization: "Bearer token",
|
|
1630
|
-
"content-type": "application/activity+json"
|
|
1631
|
-
}
|
|
1632
|
-
}), { contextData: void 0 })).status, 202);
|
|
1633
|
-
assertEquals(ldsVerified, true);
|
|
1634
|
-
assertEquals(records.some((record) => record.rawMessage === "Outbox listener for {identifier} returned without delivering the posted activity; ctx.sendActivity() or ctx.forwardActivity() may have been skipped or resulted in no delivery."), false);
|
|
1635
|
-
} finally {
|
|
1636
|
-
esm_default.hardReset();
|
|
1637
|
-
await reset();
|
|
1638
|
-
}
|
|
1639
|
-
});
|
|
1640
|
-
});
|
|
1641
|
-
await t.step("warns when forwardActivity resolves to zero inboxes", async () => {
|
|
1642
|
-
await withLogtapeLock(async () => {
|
|
1643
|
-
const postedFixture = {
|
|
1644
|
-
...create_default,
|
|
1645
|
-
actor: "https://example.com/users/john"
|
|
1646
|
-
};
|
|
1647
|
-
const records = [];
|
|
1648
|
-
await reset();
|
|
1649
|
-
try {
|
|
1650
|
-
await configure({
|
|
1651
|
-
sinks: { buffer(record) {
|
|
1652
|
-
records.push(record);
|
|
1653
|
-
} },
|
|
1654
|
-
filters: {},
|
|
1655
|
-
loggers: [{
|
|
1656
|
-
category: [],
|
|
1657
|
-
sinks: ["buffer"]
|
|
1658
|
-
}]
|
|
1659
|
-
});
|
|
1660
|
-
const federation = createFederation({
|
|
1661
|
-
kv,
|
|
1662
|
-
documentLoaderFactory: () => mockDocumentLoader
|
|
1663
|
-
});
|
|
1664
|
-
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1665
|
-
privateKey: rsaPrivateKey2,
|
|
1666
|
-
publicKey: rsaPublicKey2.publicKey
|
|
1667
|
-
}]);
|
|
1668
|
-
federation.setOutboxListeners("/users/{identifier}/outbox").on(vocab.Activity, async (ctx) => {
|
|
1669
|
-
await ctx.forwardActivity({ identifier: ctx.identifier }, []);
|
|
1670
|
-
}).authorize((ctx, identifier) => {
|
|
1671
|
-
return identifier === "john" && ctx.request.headers.get("authorization") === "Bearer token";
|
|
1672
|
-
});
|
|
1673
|
-
assertEquals((await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1674
|
-
method: "POST",
|
|
1675
|
-
body: JSON.stringify(postedFixture),
|
|
1676
|
-
headers: {
|
|
1677
|
-
authorization: "Bearer token",
|
|
1678
|
-
"content-type": "application/activity+json"
|
|
1679
|
-
}
|
|
1680
|
-
}), { contextData: void 0 })).status, 202);
|
|
1681
|
-
assertEquals(records.some((record) => record.rawMessage === "Outbox listener for {identifier} returned without delivering the posted activity; ctx.sendActivity() or ctx.forwardActivity() may have been skipped or resulted in no delivery." && record.properties.identifier === "john"), true);
|
|
1682
|
-
} finally {
|
|
1683
|
-
await reset();
|
|
1684
|
-
}
|
|
1685
|
-
});
|
|
1686
|
-
});
|
|
1687
|
-
await t.step("forwardActivity starts the outbox queue automatically", async () => {
|
|
1688
|
-
const postedFixture = {
|
|
1689
|
-
...create_default,
|
|
1690
|
-
actor: "https://example.com/users/john"
|
|
1691
|
-
};
|
|
1692
|
-
let listenCalled = false;
|
|
1693
|
-
const enqueued = [];
|
|
1694
|
-
const federation = new FederationImpl({
|
|
1695
|
-
kv,
|
|
1696
|
-
contextLoaderFactory: () => mockDocumentLoader,
|
|
1697
|
-
queue: {
|
|
1698
|
-
enqueue(message) {
|
|
1699
|
-
enqueued.push(message);
|
|
1700
|
-
return Promise.resolve();
|
|
1701
|
-
},
|
|
1702
|
-
listen() {
|
|
1703
|
-
listenCalled = true;
|
|
1704
|
-
return Promise.resolve();
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
});
|
|
1708
|
-
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1709
|
-
privateKey: rsaPrivateKey2,
|
|
1710
|
-
publicKey: rsaPublicKey2.publicKey
|
|
1711
|
-
}]);
|
|
1712
|
-
federation.setOutboxListeners("/users/{identifier}/outbox").on(vocab.Activity, async (ctx) => {
|
|
1713
|
-
await ctx.forwardActivity({ identifier: ctx.identifier }, {
|
|
1714
|
-
id: new URL("https://remote.example/users/alice"),
|
|
1715
|
-
inboxId: new URL("https://remote.example/inbox")
|
|
1716
|
-
});
|
|
1717
|
-
}).authorize((ctx, identifier) => {
|
|
1718
|
-
return identifier === "john" && ctx.request.headers.get("authorization") === "Bearer token";
|
|
1719
|
-
});
|
|
1720
|
-
assertEquals((await federation.fetch(new Request("https://example.com/users/john/outbox", {
|
|
1721
|
-
method: "POST",
|
|
1722
|
-
body: JSON.stringify(postedFixture),
|
|
1723
|
-
headers: {
|
|
1724
|
-
authorization: "Bearer token",
|
|
1725
|
-
"content-type": "application/activity+json"
|
|
1726
|
-
}
|
|
1727
|
-
}), { contextData: void 0 })).status, 202);
|
|
1728
|
-
assertEquals(listenCalled, true);
|
|
1729
|
-
assertEquals(enqueued.length, 1);
|
|
1730
|
-
assertEquals(enqueued[0].type, "outbox");
|
|
1731
|
-
assertEquals(enqueued[0].actorIds, ["https://remote.example/users/alice"]);
|
|
1732
|
-
});
|
|
1733
|
-
});
|
|
1734
1315
|
test("Federation.setInboxDispatcher()", async (t) => {
|
|
1735
1316
|
const kv = new MemoryKvStore();
|
|
1736
1317
|
await t.step("path match", () => {
|
|
@@ -2317,33 +1898,6 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
2317
1898
|
inboxId: new URL("https://example.com/inbox")
|
|
2318
1899
|
}, activity.clone({ actor: ctx.getActorUri("1") })));
|
|
2319
1900
|
});
|
|
2320
|
-
await t.step("records recipient span attributes correctly", async () => {
|
|
2321
|
-
const [tracerProvider, exporter] = createTestTracerProvider();
|
|
2322
|
-
const ctx = new FederationImpl({
|
|
2323
|
-
kv,
|
|
2324
|
-
contextLoaderFactory: () => mockDocumentLoader,
|
|
2325
|
-
tracerProvider
|
|
2326
|
-
}).createContext(new URL("https://example.com/"), void 0);
|
|
2327
|
-
const activity = new vocab.Create({
|
|
2328
|
-
id: new URL("https://example.com/activity/telemetry"),
|
|
2329
|
-
actor: new URL("https://example.com/person"),
|
|
2330
|
-
to: new URL("https://example.com/to"),
|
|
2331
|
-
cc: new URL("https://example.com/cc"),
|
|
2332
|
-
bto: new URL("https://example.com/bto"),
|
|
2333
|
-
bcc: new URL("https://example.com/bcc")
|
|
2334
|
-
});
|
|
2335
|
-
await ctx.sendActivity([{
|
|
2336
|
-
privateKey: rsaPrivateKey2,
|
|
2337
|
-
keyId: rsaPublicKey2.id
|
|
2338
|
-
}], {
|
|
2339
|
-
id: new URL("https://example.com/recipient"),
|
|
2340
|
-
inboxId: new URL("https://example.com/inbox")
|
|
2341
|
-
}, activity);
|
|
2342
|
-
const span = exporter.getSpan("activitypub.outbox");
|
|
2343
|
-
assert(span != null);
|
|
2344
|
-
assertEquals(span.attributes["activitypub.activity.cc"], ["https://example.com/cc"]);
|
|
2345
|
-
assertEquals(span.attributes["activitypub.activity.bcc"], ["https://example.com/bcc"]);
|
|
2346
|
-
});
|
|
2347
1901
|
const queue = {
|
|
2348
1902
|
messages: [],
|
|
2349
1903
|
enqueue(message) {
|
|
@@ -2744,9 +2298,8 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
2744
2298
|
if (verified.length > 0) return new Response(null, { status: 202 });
|
|
2745
2299
|
return new Response(null, { status: 401 });
|
|
2746
2300
|
});
|
|
2747
|
-
const kv = new MemoryKvStore();
|
|
2748
2301
|
const federation = new FederationImpl({
|
|
2749
|
-
kv,
|
|
2302
|
+
kv: new MemoryKvStore(),
|
|
2750
2303
|
contextLoaderFactory: () => mockDocumentLoader
|
|
2751
2304
|
});
|
|
2752
2305
|
await t.step("skip", async () => {
|
|
@@ -2836,61 +2389,6 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
2836
2389
|
}, { skipIfUnsigned: true });
|
|
2837
2390
|
assertEquals(verified, ["ld"]);
|
|
2838
2391
|
});
|
|
2839
|
-
await t.step("alternate LD signature shapes", async () => {
|
|
2840
|
-
const ctx = new InboxContextImpl(null, {
|
|
2841
|
-
"@context": "https://www.w3.org/ns/activitystreams",
|
|
2842
|
-
"type": "Create",
|
|
2843
|
-
"id": "https://example.com/activity",
|
|
2844
|
-
"actor": "https://example.com/person2",
|
|
2845
|
-
"signature": {
|
|
2846
|
-
"type": "Ed25519Signature2020",
|
|
2847
|
-
"verificationMethod": { "id": "https://example.com/person2#main-key" },
|
|
2848
|
-
"jws": "signature"
|
|
2849
|
-
}
|
|
2850
|
-
}, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
2851
|
-
data: void 0,
|
|
2852
|
-
federation,
|
|
2853
|
-
url: new URL("https://example.com/"),
|
|
2854
|
-
documentLoader,
|
|
2855
|
-
contextLoader: documentLoader
|
|
2856
|
-
});
|
|
2857
|
-
await assertRejects(() => ctx.forwardActivity([{
|
|
2858
|
-
privateKey: rsaPrivateKey2,
|
|
2859
|
-
keyId: rsaPublicKey2.id
|
|
2860
|
-
}], {
|
|
2861
|
-
id: new URL("https://example.com/recipient"),
|
|
2862
|
-
inboxId: new URL("https://example.com/inbox")
|
|
2863
|
-
}, { skipIfUnsigned: true }));
|
|
2864
|
-
assertEquals(verified, []);
|
|
2865
|
-
});
|
|
2866
|
-
await t.step("records inbox forwarding span name", async () => {
|
|
2867
|
-
const [tracerProvider, exporter] = createTestTracerProvider();
|
|
2868
|
-
const federationWithTracing = new FederationImpl({
|
|
2869
|
-
kv,
|
|
2870
|
-
contextLoaderFactory: () => mockDocumentLoader,
|
|
2871
|
-
tracerProvider
|
|
2872
|
-
});
|
|
2873
|
-
await new InboxContextImpl(null, await signJsonLd({
|
|
2874
|
-
"@context": "https://www.w3.org/ns/activitystreams",
|
|
2875
|
-
"type": "Create",
|
|
2876
|
-
"id": "https://example.com/activity",
|
|
2877
|
-
"actor": "https://example.com/person2"
|
|
2878
|
-
}, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader }), "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
2879
|
-
data: void 0,
|
|
2880
|
-
federation: federationWithTracing,
|
|
2881
|
-
url: new URL("https://example.com/"),
|
|
2882
|
-
documentLoader,
|
|
2883
|
-
contextLoader: documentLoader
|
|
2884
|
-
}).forwardActivity([{
|
|
2885
|
-
privateKey: rsaPrivateKey2,
|
|
2886
|
-
keyId: rsaPublicKey2.id
|
|
2887
|
-
}], {
|
|
2888
|
-
id: new URL("https://example.com/recipient"),
|
|
2889
|
-
inboxId: new URL("https://example.com/inbox")
|
|
2890
|
-
}, { skipIfUnsigned: true });
|
|
2891
|
-
assertEquals(exporter.getSpans("activitypub.inbox").length, 1);
|
|
2892
|
-
assertEquals(exporter.getSpans("activitypub.outbox").length, 0);
|
|
2893
|
-
});
|
|
2894
2392
|
esm_default.hardReset();
|
|
2895
2393
|
});
|
|
2896
2394
|
test("KvSpecDeterminer", async (t) => {
|
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-SVMhMPsP.cjs");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
//#region src/federation/kv.ts
|
|
8
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as ActorHandleMapper, A as FederationQueueOptions, B as RouterOptions, C as IdempotencyStrategy, Ct as digest, D as Rfc6570Expression, E as ObjectCallbackSetters, F as createExponentialBackoffPolicy, G as InProcessMessageQueue, H as RespondWithObjectOptions, I as Message, J as MessageQueueEnqueueOptions, K as InProcessMessageQueueOptions, L as createFederationBuilder, M as CreateExponentialBackoffPolicyOptions, N as RetryContext, O as FederationKvPrefixes, P as RetryPolicy, Q as ActorDispatcher, R as Router, S as IdempotencyKeyCallback, St as buildCollectionSynchronizationHeader, T as InboxListenerSetters, U as respondWithObject, V as RouterRouteResult, W as respondWithObjectIfAcceptable, X as ParallelMessageQueue, Y as MessageQueueListenOptions, Z as ActorAliasMapper, _ as Federation, _t as UnverifiedActivityReason, a as GetSignedKeyOptions, at as CustomCollectionCounter, b as FederationOptions, bt as SenderKeyPair, c as RequestContext, ct as InboxErrorHandler, d as SendActivityOptionsForCollection, dt as ObjectAuthorizePredicate, et as ActorKeyPairsDispatcher, f as ActorCallbackSetters, ft as ObjectDispatcher, g as Federatable, gt as UnverifiedActivityHandler, h as CustomCollectionCallbackSetters, ht as SharedInboxKeyDispatcher, i as GetActorOptions, it as CollectionDispatcher, j as createFederation, k as FederationOrigin, l as RouteActivityOptions, lt as InboxListener, m as ConstructorWithTypeId, mt as OutboxPermanentFailureHandler, n as Context, nt as CollectionCounter, o as InboxContext, ot as CustomCollectionCursor, p as CollectionCallbackSetters, pt as OutboxErrorHandler, q as MessageQueue, r as ForwardActivityOptions, rt as CollectionCursor, s as ParseUriResult, st as CustomCollectionDispatcher, t as ActorKeyPair, tt as AuthorizePredicate, u as SendActivityOptions, ut as NodeInfoDispatcher, v as FederationBuilder, vt as WebFingerLinksDispatcher, w as InboxChallengePolicy, x as FederationStartQueueOptions, xt as PageItems, y as FederationFetchOptions, yt as SendActivityError, z as RouterError } from "../context-DYDPdoCb.cjs";
|
|
2
2
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CbLNp3zQ.cjs";
|
|
3
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-
|
|
4
|
-
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, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher,
|
|
3
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-CEohtXhV.cjs";
|
|
4
|
+
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, GetActorOptions, 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,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as ActorHandleMapper, A as FederationQueueOptions, B as RouterOptions, C as IdempotencyStrategy, Ct as digest, D as Rfc6570Expression, E as ObjectCallbackSetters, F as createExponentialBackoffPolicy, G as InProcessMessageQueue, H as RespondWithObjectOptions, I as Message, J as MessageQueueEnqueueOptions, K as InProcessMessageQueueOptions, L as createFederationBuilder, M as CreateExponentialBackoffPolicyOptions, N as RetryContext, O as FederationKvPrefixes, P as RetryPolicy, Q as ActorDispatcher, R as Router, S as IdempotencyKeyCallback, St as buildCollectionSynchronizationHeader, T as InboxListenerSetters, U as respondWithObject, V as RouterRouteResult, W as respondWithObjectIfAcceptable, X as ParallelMessageQueue, Y as MessageQueueListenOptions, Z as ActorAliasMapper, _ as Federation, _t as UnverifiedActivityReason, a as GetSignedKeyOptions, at as CustomCollectionCounter, b as FederationOptions, bt as SenderKeyPair, c as RequestContext, ct as InboxErrorHandler, d as SendActivityOptionsForCollection, dt as ObjectAuthorizePredicate, et as ActorKeyPairsDispatcher, f as ActorCallbackSetters, ft as ObjectDispatcher, g as Federatable, gt as UnverifiedActivityHandler, h as CustomCollectionCallbackSetters, ht as SharedInboxKeyDispatcher, i as GetActorOptions, it as CollectionDispatcher, j as createFederation, k as FederationOrigin, l as RouteActivityOptions, lt as InboxListener, m as ConstructorWithTypeId, mt as OutboxPermanentFailureHandler, n as Context, nt as CollectionCounter, o as InboxContext, ot as CustomCollectionCursor, p as CollectionCallbackSetters, pt as OutboxErrorHandler, q as MessageQueue, r as ForwardActivityOptions, rt as CollectionCursor, s as ParseUriResult, st as CustomCollectionDispatcher, t as ActorKeyPair, tt as AuthorizePredicate, u as SendActivityOptions, ut as NodeInfoDispatcher, v as FederationBuilder, vt as WebFingerLinksDispatcher, w as InboxChallengePolicy, x as FederationStartQueueOptions, xt as PageItems, y as FederationFetchOptions, yt as SendActivityError, z as RouterError } from "../context-78ecvxf5.js";
|
|
4
4
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-GFYnFoOl.js";
|
|
5
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-
|
|
6
|
-
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, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher,
|
|
5
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-CokIUYDr.js";
|
|
6
|
+
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, GetActorOptions, 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-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-CLVQBjm2.js";
|
|
4
4
|
import { isEqual } from "es-toolkit";
|
|
5
5
|
//#region src/federation/kv.ts
|
|
6
6
|
/**
|
|
@@ -8,10 +8,10 @@ import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z
|
|
|
8
8
|
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
9
9
|
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
10
10
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
11
|
-
import { l as verifyRequest } from "../http-
|
|
11
|
+
import { l as verifyRequest } from "../http-BoYB66uz.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
13
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
14
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-
|
|
13
|
+
import { t as doesActorOwnKey } from "../owner-CQ0ITJYn.mjs";
|
|
14
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-CP34W1Zh.mjs";
|
|
15
15
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
16
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
17
17
|
//#region src/federation/send.test.ts
|