@fedify/fedify 2.2.0-pr.695.16 → 2.2.0-pr.697.17
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/activity-listener-Ck3JZ_hR.mjs +40 -0
- package/dist/{builder-7PVCiLiR.mjs → builder-0VkYL-Be.mjs} +57 -7
- 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-78ecvxf5.d.ts → context-BGrYMSTk.d.ts} +143 -1
- package/dist/{context-DYDPdoCb.d.cts → context-CMUd4wy0.d.cts} +143 -1
- package/dist/{context-Juj6bdHC.mjs → context-Dk_tacqz.mjs} +17 -2
- package/dist/{deno-vxcWcxQS.mjs → deno-ZTLy21O_.mjs} +1 -1
- package/dist/{docloader-D7q0-Xef.mjs → docloader-qLB9fFVV.mjs} +2 -2
- package/dist/federation/builder.test.mjs +25 -1
- package/dist/federation/handler.test.mjs +369 -8
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +3 -3
- package/dist/federation/middleware.test.mjs +510 -8
- 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-JxF7bG0o.cjs → http-BLuuf-Rt.cjs} +1 -1
- package/dist/{http-RZPxDWq5.mjs → http-CFmrJbuT.mjs} +2 -2
- package/dist/{http-D-MhhYUF.js → http-CqkZgsp_.js} +1 -1
- package/dist/{key-CGx_dDkX.mjs → key-DVFCI5om.mjs} +1 -1
- package/dist/{kv-cache-C2gdVgvb.cjs → kv-cache-BlXew67e.cjs} +1 -1
- package/dist/{kv-cache-D84Mk0fZ.js → kv-cache-Dgsvz3PC.js} +1 -1
- package/dist/{ld-wup-liFO.mjs → ld-N69KBAlI.mjs} +26 -3
- package/dist/{middleware-Bn75dPug.cjs → middleware-B0BqhA1u.cjs} +676 -323
- package/dist/{middleware-RF-sUfTr.js → middleware-BpSfJf2S.js} +670 -322
- package/dist/{middleware-CXOVT4Ph.cjs → middleware-CUe96Oxe.cjs} +1 -1
- package/dist/{middleware-wdfeWjRJ.mjs → middleware-DDXN5eBU.mjs} +1 -1
- package/dist/{middleware-BjVx-_bv.mjs → middleware-DbCHS-GH.mjs} +612 -180
- package/dist/{mod-CEohtXhV.d.cts → mod-BcJHeuv1.d.cts} +1 -1
- package/dist/{mod-CokIUYDr.d.ts → mod-CJXfyw7v.d.ts} +1 -1
- package/dist/{mod-DvxszxXC.d.ts → mod-CR8soWa9.d.ts} +18 -1
- package/dist/{mod-DoJBjjnO.d.cts → mod-Cr3f-ACa.d.cts} +18 -1
- package/dist/mod.cjs +6 -4
- 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-q2mUMM9a.mjs → owner-DGdkXeF5.mjs} +2 -2
- package/dist/{proof-CirP9OSd.js → proof-BtFhWZuV.js} +54 -2
- package/dist/{proof--CpZsF_p.mjs → proof-C50gFNxj.mjs} +32 -3
- package/dist/{proof-_Zyfqyce.cjs → proof-DwRcU3OF.cjs} +61 -3
- package/dist/{send-CVJfx7bF.mjs → send-BlHiNsZI.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 +44 -2
- package/dist/sig/mod.cjs +4 -2
- 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 +46 -2
- package/dist/testing/mod.d.mts +149 -1
- 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/inbox-CmYvcSMM.mjs +0 -179
|
@@ -10,18 +10,19 @@ 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-CFmrJbuT.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-qLB9fFVV.mjs";
|
|
16
|
+
import { a as signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-N69KBAlI.mjs";
|
|
17
|
+
import { t as doesActorOwnKey } from "../owner-DGdkXeF5.mjs";
|
|
18
|
+
import { i as verifyObject, r as signObject } from "../proof-C50gFNxj.mjs";
|
|
19
19
|
import { t as MemoryKvStore } from "../kv-tL2TOE9X.mjs";
|
|
20
|
-
import {
|
|
21
|
-
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
20
|
+
import { i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-DbCHS-GH.mjs";
|
|
21
|
+
import { createTestTracerProvider, 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";
|
|
25
26
|
//#region ../fixture/src/fixtures/example.com/create.json
|
|
26
27
|
var id$2 = "https://example.com/create";
|
|
27
28
|
var create_default = {
|
|
@@ -87,6 +88,12 @@ var person2_default = {
|
|
|
87
88
|
//#endregion
|
|
88
89
|
//#region src/federation/middleware.test.ts
|
|
89
90
|
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
|
+
}
|
|
90
97
|
test("createFederation()", async (t) => {
|
|
91
98
|
const kv = new MemoryKvStore();
|
|
92
99
|
await t.step("allowPrivateAddress", () => {
|
|
@@ -1312,6 +1319,418 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
1312
1319
|
});
|
|
1313
1320
|
esm_default.hardReset();
|
|
1314
1321
|
});
|
|
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
|
+
});
|
|
1315
1734
|
test("Federation.setInboxDispatcher()", async (t) => {
|
|
1316
1735
|
const kv = new MemoryKvStore();
|
|
1317
1736
|
await t.step("path match", () => {
|
|
@@ -1898,6 +2317,33 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1898
2317
|
inboxId: new URL("https://example.com/inbox")
|
|
1899
2318
|
}, activity.clone({ actor: ctx.getActorUri("1") })));
|
|
1900
2319
|
});
|
|
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
|
+
});
|
|
1901
2347
|
const queue = {
|
|
1902
2348
|
messages: [],
|
|
1903
2349
|
enqueue(message) {
|
|
@@ -2298,8 +2744,9 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
2298
2744
|
if (verified.length > 0) return new Response(null, { status: 202 });
|
|
2299
2745
|
return new Response(null, { status: 401 });
|
|
2300
2746
|
});
|
|
2747
|
+
const kv = new MemoryKvStore();
|
|
2301
2748
|
const federation = new FederationImpl({
|
|
2302
|
-
kv
|
|
2749
|
+
kv,
|
|
2303
2750
|
contextLoaderFactory: () => mockDocumentLoader
|
|
2304
2751
|
});
|
|
2305
2752
|
await t.step("skip", async () => {
|
|
@@ -2389,6 +2836,61 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
2389
2836
|
}, { skipIfUnsigned: true });
|
|
2390
2837
|
assertEquals(verified, ["ld"]);
|
|
2391
2838
|
});
|
|
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
|
+
});
|
|
2392
2894
|
esm_default.hardReset();
|
|
2393
2895
|
});
|
|
2394
2896
|
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-B0BqhA1u.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 ActorAliasMapper, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as SendActivityError, D as ObjectCallbackSetters, Dt as digest, E as InboxListenerSetters, Et as buildCollectionSynchronizationHeader, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as ParallelMessageQueue, R as Message, S as FederationStartQueueOptions, St as WebFingerLinksDispatcher, T as InboxChallengePolicy, Tt as PageItems, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueEnqueueOptions, Y as MessageQueue, Z as MessageQueueListenOptions, _ as Federatable, _t as OutboxListenerErrorHandler, a as GetSignedKeyOptions, at as CollectionCursor, b as FederationFetchOptions, bt as UnverifiedActivityHandler, c as ParseUriResult, ct as CustomCollectionCursor, d as SendActivityOptions, dt as InboxListener, et as ActorDispatcher, f as SendActivityOptionsForCollection, ft as NodeInfoDispatcher, g as CustomCollectionCallbackSetters, gt as OutboxListener, h as ConstructorWithTypeId, ht as OutboxErrorHandler, i as GetActorOptions, it as CollectionCounter, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as CustomCollectionDispatcher, m as CollectionCallbackSetters, mt as ObjectDispatcher, n as Context, nt as ActorKeyPairsDispatcher, o as InboxContext, ot as CollectionDispatcher, p as ActorCallbackSetters, pt as ObjectAuthorizePredicate, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as AuthorizePredicate, s as OutboxContext, st as CustomCollectionCounter, t as ActorKeyPair, tt as ActorHandleMapper, u as RouteActivityOptions, ut as InboxErrorHandler, v as Federation, vt as OutboxPermanentFailureHandler, w as IdempotencyStrategy, wt as SenderKeyPair, x as FederationOptions, xt as UnverifiedActivityReason, y as FederationBuilder, yt as SharedInboxKeyDispatcher, z as createFederationBuilder } from "../context-CMUd4wy0.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, 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 };
|
|
3
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-BcJHeuv1.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, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, 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 ActorAliasMapper, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as SendActivityError, D as ObjectCallbackSetters, Dt as digest, E as InboxListenerSetters, Et as buildCollectionSynchronizationHeader, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as ParallelMessageQueue, R as Message, S as FederationStartQueueOptions, St as WebFingerLinksDispatcher, T as InboxChallengePolicy, Tt as PageItems, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueEnqueueOptions, Y as MessageQueue, Z as MessageQueueListenOptions, _ as Federatable, _t as OutboxListenerErrorHandler, a as GetSignedKeyOptions, at as CollectionCursor, b as FederationFetchOptions, bt as UnverifiedActivityHandler, c as ParseUriResult, ct as CustomCollectionCursor, d as SendActivityOptions, dt as InboxListener, et as ActorDispatcher, f as SendActivityOptionsForCollection, ft as NodeInfoDispatcher, g as CustomCollectionCallbackSetters, gt as OutboxListener, h as ConstructorWithTypeId, ht as OutboxErrorHandler, i as GetActorOptions, it as CollectionCounter, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as CustomCollectionDispatcher, m as CollectionCallbackSetters, mt as ObjectDispatcher, n as Context, nt as ActorKeyPairsDispatcher, o as InboxContext, ot as CollectionDispatcher, p as ActorCallbackSetters, pt as ObjectAuthorizePredicate, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as AuthorizePredicate, s as OutboxContext, st as CustomCollectionCounter, t as ActorKeyPair, tt as ActorHandleMapper, u as RouteActivityOptions, ut as InboxErrorHandler, v as Federation, vt as OutboxPermanentFailureHandler, w as IdempotencyStrategy, wt as SenderKeyPair, x as FederationOptions, xt as UnverifiedActivityReason, y as FederationBuilder, yt as SharedInboxKeyDispatcher, z as createFederationBuilder } from "../context-BGrYMSTk.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, 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 };
|
|
5
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-CJXfyw7v.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, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, 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-BpSfJf2S.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-CFmrJbuT.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-DGdkXeF5.mjs";
|
|
14
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-BlHiNsZI.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
|