@fedify/fedify 2.0.0-pr.559.5 → 2.0.0
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 +8 -0
- package/dist/{builder-BJ8JxPW5.js → builder-DIwRDV19.js} +12 -57
- package/dist/compat/mod.d.cts +2 -2
- package/dist/compat/mod.d.ts +2 -2
- package/dist/compat/transformers.test.js +11 -11
- package/dist/{context-Cf0-LmZC.d.cts → context-BdNW_8a3.d.cts} +19 -46
- package/dist/{context-liIe6DFH.d.ts → context-C-GVKcJR.d.ts} +19 -46
- package/dist/{deno-CQvbJJs6.js → deno-CJgVX6Dr.js} +1 -4
- package/dist/{docloader-C7haPFrm.js → docloader-BMecQIi-.js} +4 -12
- package/dist/federation/builder.test.js +3 -3
- package/dist/federation/handler.test.js +45 -45
- package/dist/federation/idempotency.test.js +11 -11
- package/dist/federation/inbox.test.js +2 -2
- package/dist/federation/middleware.test.js +43 -68
- package/dist/federation/mod.cjs +4 -4
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +4 -4
- package/dist/federation/send.test.js +90 -5
- package/dist/federation/webfinger.test.js +12 -15
- package/dist/{http-D75q_hW-.js → http-CMTBVAxQ.js} +2 -2
- package/dist/{http-D3jnynqJ.cjs → http-CowIBMKY.cjs} +1 -4
- package/dist/{http-BO0w34cM.js → http-DoLgvgZ3.js} +1 -4
- package/dist/{inbox-DHboTK3x.js → inbox-BrQMunLn.js} +1 -1
- package/dist/{key-DzOIwgIi.js → key-BQD4Ef_6.js} +1 -1
- package/dist/{kv-cache-Chn8IE8p.cjs → kv-cache-174yQHE6.cjs} +1 -3
- package/dist/{kv-cache-JQOZpm43.js → kv-cache-CFlvozMZ.js} +2 -4
- package/dist/{ld-BDvJI1Ch.js → ld-DNdCEe6l.js} +2 -2
- package/dist/{middleware-CqxuI8xD.js → middleware-BN-t5M_R.js} +157 -210
- package/dist/middleware-BYNnNj-3.cjs +12 -0
- package/dist/{middleware-C1SMUD_l.js → middleware-D5JdOwAE.js} +193 -260
- package/dist/{middleware-HBYhBAM1.js → middleware-UqzNuf3o.js} +11 -11
- package/dist/{middleware-DATx715C.cjs → middleware-aQr0yVne.cjs} +193 -260
- package/dist/{middleware-BDPlUI8Z.js → middleware-dO1Uzsiv.js} +4 -4
- package/dist/{mod-H3ScYaOb.d.cts → mod-5PNty1K9.d.cts} +1 -1
- package/dist/{mod-Do_sZWAA.d.cts → mod-BcpEGTWV.d.cts} +1 -1
- package/dist/{mod-CvhyLrjX.d.ts → mod-CevNbUol.d.ts} +0 -18
- package/dist/{mod-Dquroqiv.d.ts → mod-CtO31FCx.d.ts} +1 -1
- package/dist/{mod-B9_l3te3.d.ts → mod-Da9fNDyC.d.ts} +1 -1
- package/dist/{mod-DWaA45ef.d.cts → mod-ErTjUJs9.d.cts} +0 -18
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.js +11 -11
- package/dist/{owner-DSRxYIP4.js → owner-DbymvgVI.js} +1 -1
- package/dist/{proof-C_XZU5IE.js → proof-C85CNL5a.js} +1 -1
- package/dist/{proof-CWEkXV08.cjs → proof-DQFAjOse.cjs} +1 -1
- package/dist/{proof-9WkFZv2S.js → proof-DVBdddim.js} +2 -2
- package/dist/{send-qOq9Dgkb.js → send-CkvEc-Tx.js} +35 -4
- package/dist/sig/http.test.js +3 -3
- package/dist/sig/key.test.js +2 -2
- package/dist/sig/ld.test.js +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.js +3 -3
- package/dist/sig/proof.test.js +3 -3
- package/dist/testing/mod.d.ts +13 -33
- package/dist/utils/docloader.test.js +4 -4
- package/dist/utils/mod.cjs +2 -2
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +2 -2
- package/package.json +8 -8
- package/dist/middleware-C3SOA_O_.cjs +0 -12
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default } from "./deno-
|
|
6
|
+
import { deno_default } from "./deno-CJgVX6Dr.js";
|
|
7
7
|
import { getNodeInfo } from "./client-Dg7OfUDA.js";
|
|
8
8
|
import { RouterError } from "./router-D9eI0s4b.js";
|
|
9
9
|
import { nodeInfoToJson } from "./types-CPz01LGH.js";
|
|
10
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
11
|
-
import { verifyRequest } from "./http-
|
|
12
|
-
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-
|
|
13
|
-
import { doesActorOwnKey, getKeyOwner } from "./owner-
|
|
14
|
-
import { signObject, verifyObject } from "./proof-
|
|
15
|
-
import { getAuthenticatedDocumentLoader } from "./docloader-
|
|
10
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-BQD4Ef_6.js";
|
|
11
|
+
import { verifyRequest } from "./http-CMTBVAxQ.js";
|
|
12
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-DNdCEe6l.js";
|
|
13
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-DbymvgVI.js";
|
|
14
|
+
import { signObject, verifyObject } from "./proof-DVBdddim.js";
|
|
15
|
+
import { getAuthenticatedDocumentLoader } from "./docloader-BMecQIi-.js";
|
|
16
16
|
import { kvCache } from "./kv-cache-B__dHl7g.js";
|
|
17
|
-
import { routeActivity } from "./inbox-
|
|
18
|
-
import { FederationBuilderImpl } from "./builder-
|
|
17
|
+
import { routeActivity } from "./inbox-BrQMunLn.js";
|
|
18
|
+
import { FederationBuilderImpl } from "./builder-DIwRDV19.js";
|
|
19
19
|
import { buildCollectionSynchronizationHeader } from "./collection-CcnIw1qY.js";
|
|
20
20
|
import { KvKeyCache } from "./keycache-DRxpZ5r9.js";
|
|
21
21
|
import { acceptsJsonLd } from "./negotiation-5NPJL6zp.js";
|
|
22
22
|
import { createExponentialBackoffPolicy } from "./retry-D4GJ670a.js";
|
|
23
|
-
import { SendActivityError, extractInboxes, sendActivity } from "./send-
|
|
23
|
+
import { SendActivityError, extractInboxes, sendActivity } from "./send-CkvEc-Tx.js";
|
|
24
24
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
25
25
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
26
26
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1313,7 +1313,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1313
1313
|
outboxRetryPolicy;
|
|
1314
1314
|
inboxRetryPolicy;
|
|
1315
1315
|
activityTransformers;
|
|
1316
|
-
|
|
1316
|
+
_tracerProvider;
|
|
1317
1317
|
firstKnock;
|
|
1318
1318
|
constructor(options) {
|
|
1319
1319
|
super();
|
|
@@ -1395,9 +1395,12 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1395
1395
|
this.outboxRetryPolicy = options.outboxRetryPolicy ?? createExponentialBackoffPolicy();
|
|
1396
1396
|
this.inboxRetryPolicy = options.inboxRetryPolicy ?? createExponentialBackoffPolicy();
|
|
1397
1397
|
this.activityTransformers = options.activityTransformers ?? getDefaultActivityTransformers();
|
|
1398
|
-
this.
|
|
1398
|
+
this._tracerProvider = options.tracerProvider;
|
|
1399
1399
|
this.firstKnock = options.firstKnock;
|
|
1400
1400
|
}
|
|
1401
|
+
get tracerProvider() {
|
|
1402
|
+
return this._tracerProvider ?? trace.getTracerProvider();
|
|
1403
|
+
}
|
|
1401
1404
|
_initializeRouter() {
|
|
1402
1405
|
this.router.add("/.well-known/webfinger", "webfinger");
|
|
1403
1406
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
|
@@ -1438,18 +1441,24 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1438
1441
|
kind: SpanKind.CONSUMER,
|
|
1439
1442
|
attributes: { "activitypub.activity.type": message.activityType }
|
|
1440
1443
|
}, extractedContext, async (span) => {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1444
|
+
const spanCtx = span.spanContext();
|
|
1445
|
+
return await withContext({
|
|
1446
|
+
traceId: spanCtx.traceId,
|
|
1447
|
+
spanId: spanCtx.spanId
|
|
1448
|
+
}, async () => {
|
|
1449
|
+
if (message.activityId != null) span.setAttribute("activitypub.activity.id", message.activityId);
|
|
1450
|
+
try {
|
|
1451
|
+
await this.#listenFanoutMessage(contextData, message);
|
|
1452
|
+
} catch (e) {
|
|
1453
|
+
span.setStatus({
|
|
1454
|
+
code: SpanStatusCode.ERROR,
|
|
1455
|
+
message: String(e)
|
|
1456
|
+
});
|
|
1457
|
+
throw e;
|
|
1458
|
+
} finally {
|
|
1459
|
+
span.end();
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1453
1462
|
});
|
|
1454
1463
|
else if (message.type === "outbox") await tracer.startActiveSpan("activitypub.outbox", {
|
|
1455
1464
|
kind: SpanKind.CONSUMER,
|
|
@@ -1458,34 +1467,46 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1458
1467
|
"activitypub.activity.retries": message.attempt
|
|
1459
1468
|
}
|
|
1460
1469
|
}, extractedContext, async (span) => {
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1470
|
+
const spanCtx = span.spanContext();
|
|
1471
|
+
return await withContext({
|
|
1472
|
+
traceId: spanCtx.traceId,
|
|
1473
|
+
spanId: spanCtx.spanId
|
|
1474
|
+
}, async () => {
|
|
1475
|
+
if (message.activityId != null) span.setAttribute("activitypub.activity.id", message.activityId);
|
|
1476
|
+
try {
|
|
1477
|
+
await this.#listenOutboxMessage(contextData, message, span);
|
|
1478
|
+
} catch (e) {
|
|
1479
|
+
span.setStatus({
|
|
1480
|
+
code: SpanStatusCode.ERROR,
|
|
1481
|
+
message: String(e)
|
|
1482
|
+
});
|
|
1483
|
+
throw e;
|
|
1484
|
+
} finally {
|
|
1485
|
+
span.end();
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1473
1488
|
});
|
|
1474
1489
|
else if (message.type === "inbox") await tracer.startActiveSpan("activitypub.inbox", {
|
|
1475
1490
|
kind: SpanKind.CONSUMER,
|
|
1476
1491
|
attributes: { "activitypub.shared_inbox": message.identifier == null }
|
|
1477
1492
|
}, extractedContext, async (span) => {
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1493
|
+
const spanCtx = span.spanContext();
|
|
1494
|
+
return await withContext({
|
|
1495
|
+
traceId: spanCtx.traceId,
|
|
1496
|
+
spanId: spanCtx.spanId
|
|
1497
|
+
}, async () => {
|
|
1498
|
+
try {
|
|
1499
|
+
await this.#listenInboxMessage(contextData, message, span);
|
|
1500
|
+
} catch (e) {
|
|
1501
|
+
span.setStatus({
|
|
1502
|
+
code: SpanStatusCode.ERROR,
|
|
1503
|
+
message: String(e)
|
|
1504
|
+
});
|
|
1505
|
+
throw e;
|
|
1506
|
+
} finally {
|
|
1507
|
+
span.end();
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1489
1510
|
});
|
|
1490
1511
|
});
|
|
1491
1512
|
}
|
|
@@ -1649,7 +1670,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1649
1670
|
if (message.identifier != null) context$1 = this.#createContext(baseUrl, ctxData, { documentLoader: await context$1.getDocumentLoader({ identifier: message.identifier }) });
|
|
1650
1671
|
else if (this.sharedInboxKeyDispatcher != null) {
|
|
1651
1672
|
const identity = await this.sharedInboxKeyDispatcher(context$1);
|
|
1652
|
-
if (identity != null) context$1 = this.#createContext(baseUrl, ctxData, { documentLoader: "identifier" in identity || "username" in identity
|
|
1673
|
+
if (identity != null) context$1 = this.#createContext(baseUrl, ctxData, { documentLoader: "identifier" in identity || "username" in identity ? await context$1.getDocumentLoader(identity) : context$1.getDocumentLoader(identity) });
|
|
1653
1674
|
}
|
|
1654
1675
|
const activity = await Activity.fromJsonLd(message.activity, context$1);
|
|
1655
1676
|
span.setAttribute("activitypub.activity.type", getTypeId(activity).href);
|
|
@@ -1958,54 +1979,60 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1958
1979
|
[ATTR_URL_FULL]: request.url
|
|
1959
1980
|
}
|
|
1960
1981
|
}, async (span) => {
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1982
|
+
const spanCtx = span.spanContext();
|
|
1983
|
+
return await withContext({
|
|
1984
|
+
traceId: spanCtx.traceId,
|
|
1985
|
+
spanId: spanCtx.spanId
|
|
1986
|
+
}, async () => {
|
|
1987
|
+
const logger$2 = getLogger([
|
|
1988
|
+
"fedify",
|
|
1989
|
+
"federation",
|
|
1990
|
+
"http"
|
|
1991
|
+
]);
|
|
1992
|
+
if (span.isRecording()) for (const [k, v] of request.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(k), [v]);
|
|
1993
|
+
let response;
|
|
1994
|
+
try {
|
|
1995
|
+
response = await this.#fetch(request, {
|
|
1996
|
+
...options,
|
|
1997
|
+
span,
|
|
1998
|
+
tracer
|
|
1999
|
+
});
|
|
2000
|
+
if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
|
|
2001
|
+
} catch (error) {
|
|
2002
|
+
span.setStatus({
|
|
2003
|
+
code: SpanStatusCode.ERROR,
|
|
2004
|
+
message: `${error}`
|
|
2005
|
+
});
|
|
2006
|
+
span.end();
|
|
2007
|
+
logger$2.error("An error occurred while serving request {method} {url}: {error}", {
|
|
2008
|
+
method: request.method,
|
|
2009
|
+
url: request.url,
|
|
2010
|
+
error
|
|
2011
|
+
});
|
|
2012
|
+
throw error;
|
|
2013
|
+
}
|
|
2014
|
+
if (span.isRecording()) {
|
|
2015
|
+
span.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE, response.status);
|
|
2016
|
+
for (const [k, v] of response.headers) span.setAttribute(ATTR_HTTP_RESPONSE_HEADER(k), [v]);
|
|
2017
|
+
span.setStatus({
|
|
2018
|
+
code: response.status >= 500 ? SpanStatusCode.ERROR : SpanStatusCode.UNSET,
|
|
2019
|
+
message: response.statusText
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
1980
2022
|
span.end();
|
|
1981
|
-
|
|
2023
|
+
const url = new URL(request.url);
|
|
2024
|
+
const logTpl = "{method} {path}: {status}";
|
|
2025
|
+
const values = {
|
|
1982
2026
|
method: request.method,
|
|
2027
|
+
path: `${url.pathname}${url.search}`,
|
|
1983
2028
|
url: request.url,
|
|
1984
|
-
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
span.setStatus({
|
|
1992
|
-
code: response.status >= 500 ? SpanStatusCode.ERROR : SpanStatusCode.UNSET,
|
|
1993
|
-
message: response.statusText
|
|
1994
|
-
});
|
|
1995
|
-
}
|
|
1996
|
-
span.end();
|
|
1997
|
-
const url = new URL(request.url);
|
|
1998
|
-
const logTpl = "{method} {path}: {status}";
|
|
1999
|
-
const values = {
|
|
2000
|
-
method: request.method,
|
|
2001
|
-
path: `${url.pathname}${url.search}`,
|
|
2002
|
-
url: request.url,
|
|
2003
|
-
status: response.status
|
|
2004
|
-
};
|
|
2005
|
-
if (response.status >= 500) logger$2.error(logTpl, values);
|
|
2006
|
-
else if (response.status >= 400) logger$2.warn(logTpl, values);
|
|
2007
|
-
else logger$2.info(logTpl, values);
|
|
2008
|
-
return response;
|
|
2029
|
+
status: response.status
|
|
2030
|
+
};
|
|
2031
|
+
if (response.status >= 500) logger$2.error(logTpl, values);
|
|
2032
|
+
else if (response.status >= 400) logger$2.warn(logTpl, values);
|
|
2033
|
+
else logger$2.info(logTpl, values);
|
|
2034
|
+
return response;
|
|
2035
|
+
});
|
|
2009
2036
|
});
|
|
2010
2037
|
});
|
|
2011
2038
|
}
|
|
@@ -2039,9 +2066,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2039
2066
|
if (request.method !== "POST" && !acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
2040
2067
|
switch (routeName) {
|
|
2041
2068
|
case "actor":
|
|
2042
|
-
context$1 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier
|
|
2069
|
+
context$1 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier } });
|
|
2043
2070
|
return await handleActor(request, {
|
|
2044
|
-
identifier: route.values.identifier
|
|
2071
|
+
identifier: route.values.identifier,
|
|
2045
2072
|
context: context$1,
|
|
2046
2073
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
2047
2074
|
authorizePredicate: this.actorCallbacks?.authorizePredicate,
|
|
@@ -2067,7 +2094,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2067
2094
|
}
|
|
2068
2095
|
case "outbox": return await handleCollection(request, {
|
|
2069
2096
|
name: "outbox",
|
|
2070
|
-
identifier: route.values.identifier
|
|
2097
|
+
identifier: route.values.identifier,
|
|
2071
2098
|
uriGetter: context$1.getOutboxUri.bind(context$1),
|
|
2072
2099
|
context: context$1,
|
|
2073
2100
|
collectionCallbacks: this.outboxCallbacks,
|
|
@@ -2078,7 +2105,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2078
2105
|
case "inbox":
|
|
2079
2106
|
if (request.method !== "POST") return await handleCollection(request, {
|
|
2080
2107
|
name: "inbox",
|
|
2081
|
-
identifier: route.values.identifier
|
|
2108
|
+
identifier: route.values.identifier,
|
|
2082
2109
|
uriGetter: context$1.getInboxUri.bind(context$1),
|
|
2083
2110
|
context: context$1,
|
|
2084
2111
|
collectionCallbacks: this.inboxCallbacks,
|
|
@@ -2086,15 +2113,15 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2086
2113
|
onUnauthorized,
|
|
2087
2114
|
onNotFound
|
|
2088
2115
|
});
|
|
2089
|
-
context$1 = this.#createContext(request, contextData, { documentLoader: await context$1.getDocumentLoader({ identifier: route.values.identifier
|
|
2116
|
+
context$1 = this.#createContext(request, contextData, { documentLoader: await context$1.getDocumentLoader({ identifier: route.values.identifier }) });
|
|
2090
2117
|
case "sharedInbox":
|
|
2091
2118
|
if (routeName !== "inbox" && this.sharedInboxKeyDispatcher != null) {
|
|
2092
2119
|
const identity = await this.sharedInboxKeyDispatcher(context$1);
|
|
2093
|
-
if (identity != null) context$1 = this.#createContext(request, contextData, { documentLoader: "identifier" in identity || "username" in identity
|
|
2120
|
+
if (identity != null) context$1 = this.#createContext(request, contextData, { documentLoader: "identifier" in identity || "username" in identity ? await context$1.getDocumentLoader(identity) : context$1.getDocumentLoader(identity) });
|
|
2094
2121
|
}
|
|
2095
2122
|
if (!this.manuallyStartQueue) this._startQueueInternal(contextData);
|
|
2096
2123
|
return await handleInbox(request, {
|
|
2097
|
-
recipient: route.values.identifier ??
|
|
2124
|
+
recipient: route.values.identifier ?? null,
|
|
2098
2125
|
context: context$1,
|
|
2099
2126
|
inboxContextFactory: context$1.toInboxContext.bind(context$1),
|
|
2100
2127
|
kv: this.kv,
|
|
@@ -2111,7 +2138,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2111
2138
|
});
|
|
2112
2139
|
case "following": return await handleCollection(request, {
|
|
2113
2140
|
name: "following",
|
|
2114
|
-
identifier: route.values.identifier
|
|
2141
|
+
identifier: route.values.identifier,
|
|
2115
2142
|
uriGetter: context$1.getFollowingUri.bind(context$1),
|
|
2116
2143
|
context: context$1,
|
|
2117
2144
|
collectionCallbacks: this.followingCallbacks,
|
|
@@ -2128,7 +2155,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2128
2155
|
}
|
|
2129
2156
|
return await handleCollection(request, {
|
|
2130
2157
|
name: "followers",
|
|
2131
|
-
identifier: route.values.identifier
|
|
2158
|
+
identifier: route.values.identifier,
|
|
2132
2159
|
uriGetter: baseUrl == null ? context$1.getFollowersUri.bind(context$1) : (identifier) => {
|
|
2133
2160
|
const uri = context$1.getFollowersUri(identifier);
|
|
2134
2161
|
uri.searchParams.set("base-url", baseUrl);
|
|
@@ -2145,7 +2172,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2145
2172
|
}
|
|
2146
2173
|
case "liked": return await handleCollection(request, {
|
|
2147
2174
|
name: "liked",
|
|
2148
|
-
identifier: route.values.identifier
|
|
2175
|
+
identifier: route.values.identifier,
|
|
2149
2176
|
uriGetter: context$1.getLikedUri.bind(context$1),
|
|
2150
2177
|
context: context$1,
|
|
2151
2178
|
collectionCallbacks: this.likedCallbacks,
|
|
@@ -2155,7 +2182,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2155
2182
|
});
|
|
2156
2183
|
case "featured": return await handleCollection(request, {
|
|
2157
2184
|
name: "featured",
|
|
2158
|
-
identifier: route.values.identifier
|
|
2185
|
+
identifier: route.values.identifier,
|
|
2159
2186
|
uriGetter: context$1.getFeaturedUri.bind(context$1),
|
|
2160
2187
|
context: context$1,
|
|
2161
2188
|
collectionCallbacks: this.featuredCallbacks,
|
|
@@ -2165,7 +2192,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2165
2192
|
});
|
|
2166
2193
|
case "featuredTags": return await handleCollection(request, {
|
|
2167
2194
|
name: "featured tags",
|
|
2168
|
-
identifier: route.values.identifier
|
|
2195
|
+
identifier: route.values.identifier,
|
|
2169
2196
|
uriGetter: context$1.getFeaturedTagsUri.bind(context$1),
|
|
2170
2197
|
context: context$1,
|
|
2171
2198
|
collectionCallbacks: this.featuredTagsCallbacks,
|
|
@@ -2263,10 +2290,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2263
2290
|
return new URL(path, this.canonicalOrigin);
|
|
2264
2291
|
}
|
|
2265
2292
|
getActorUri(identifier) {
|
|
2266
|
-
const path = this.federation.router.build("actor", {
|
|
2267
|
-
identifier,
|
|
2268
|
-
handle: identifier
|
|
2269
|
-
});
|
|
2293
|
+
const path = this.federation.router.build("actor", { identifier });
|
|
2270
2294
|
if (path == null) throw new RouterError("No actor dispatcher registered.");
|
|
2271
2295
|
return new URL(path, this.canonicalOrigin);
|
|
2272
2296
|
}
|
|
@@ -2279,10 +2303,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2279
2303
|
return new URL(path, this.canonicalOrigin);
|
|
2280
2304
|
}
|
|
2281
2305
|
getOutboxUri(identifier) {
|
|
2282
|
-
const path = this.federation.router.build("outbox", {
|
|
2283
|
-
identifier,
|
|
2284
|
-
handle: identifier
|
|
2285
|
-
});
|
|
2306
|
+
const path = this.federation.router.build("outbox", { identifier });
|
|
2286
2307
|
if (path == null) throw new RouterError("No outbox dispatcher registered.");
|
|
2287
2308
|
return new URL(path, this.canonicalOrigin);
|
|
2288
2309
|
}
|
|
@@ -2292,50 +2313,32 @@ var ContextImpl = class ContextImpl {
|
|
|
2292
2313
|
if (path$1 == null) throw new RouterError("No shared inbox path registered.");
|
|
2293
2314
|
return new URL(path$1, this.canonicalOrigin);
|
|
2294
2315
|
}
|
|
2295
|
-
const path = this.federation.router.build("inbox", {
|
|
2296
|
-
identifier,
|
|
2297
|
-
handle: identifier
|
|
2298
|
-
});
|
|
2316
|
+
const path = this.federation.router.build("inbox", { identifier });
|
|
2299
2317
|
if (path == null) throw new RouterError("No inbox path registered.");
|
|
2300
2318
|
return new URL(path, this.canonicalOrigin);
|
|
2301
2319
|
}
|
|
2302
2320
|
getFollowingUri(identifier) {
|
|
2303
|
-
const path = this.federation.router.build("following", {
|
|
2304
|
-
identifier,
|
|
2305
|
-
handle: identifier
|
|
2306
|
-
});
|
|
2321
|
+
const path = this.federation.router.build("following", { identifier });
|
|
2307
2322
|
if (path == null) throw new RouterError("No following collection path registered.");
|
|
2308
2323
|
return new URL(path, this.canonicalOrigin);
|
|
2309
2324
|
}
|
|
2310
2325
|
getFollowersUri(identifier) {
|
|
2311
|
-
const path = this.federation.router.build("followers", {
|
|
2312
|
-
identifier,
|
|
2313
|
-
handle: identifier
|
|
2314
|
-
});
|
|
2326
|
+
const path = this.federation.router.build("followers", { identifier });
|
|
2315
2327
|
if (path == null) throw new RouterError("No followers collection path registered.");
|
|
2316
2328
|
return new URL(path, this.canonicalOrigin);
|
|
2317
2329
|
}
|
|
2318
2330
|
getLikedUri(identifier) {
|
|
2319
|
-
const path = this.federation.router.build("liked", {
|
|
2320
|
-
identifier,
|
|
2321
|
-
handle: identifier
|
|
2322
|
-
});
|
|
2331
|
+
const path = this.federation.router.build("liked", { identifier });
|
|
2323
2332
|
if (path == null) throw new RouterError("No liked collection path registered.");
|
|
2324
2333
|
return new URL(path, this.canonicalOrigin);
|
|
2325
2334
|
}
|
|
2326
2335
|
getFeaturedUri(identifier) {
|
|
2327
|
-
const path = this.federation.router.build("featured", {
|
|
2328
|
-
identifier,
|
|
2329
|
-
handle: identifier
|
|
2330
|
-
});
|
|
2336
|
+
const path = this.federation.router.build("featured", { identifier });
|
|
2331
2337
|
if (path == null) throw new RouterError("No featured collection path registered.");
|
|
2332
2338
|
return new URL(path, this.canonicalOrigin);
|
|
2333
2339
|
}
|
|
2334
2340
|
getFeaturedTagsUri(identifier) {
|
|
2335
|
-
const path = this.federation.router.build("featuredTags", {
|
|
2336
|
-
identifier,
|
|
2337
|
-
handle: identifier
|
|
2338
|
-
});
|
|
2341
|
+
const path = this.federation.router.build("featuredTags", { identifier });
|
|
2339
2342
|
if (path == null) throw new RouterError("No featured tags collection path registered.");
|
|
2340
2343
|
return new URL(path, this.canonicalOrigin);
|
|
2341
2344
|
}
|
|
@@ -2348,24 +2351,15 @@ var ContextImpl = class ContextImpl {
|
|
|
2348
2351
|
if (uri == null) return null;
|
|
2349
2352
|
if (uri.origin !== this.origin && uri.origin !== this.canonicalOrigin) return null;
|
|
2350
2353
|
const route = this.federation.router.route(uri.pathname);
|
|
2351
|
-
const logger$2 = getLogger(["fedify", "federation"]);
|
|
2352
2354
|
if (route == null) return null;
|
|
2353
2355
|
else if (route.name === "sharedInbox") return {
|
|
2354
2356
|
type: "inbox",
|
|
2355
|
-
identifier: void 0
|
|
2356
|
-
get handle() {
|
|
2357
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2358
|
-
return void 0;
|
|
2359
|
-
}
|
|
2357
|
+
identifier: void 0
|
|
2360
2358
|
};
|
|
2361
|
-
const identifier =
|
|
2359
|
+
const identifier = route.values.identifier;
|
|
2362
2360
|
if (route.name === "actor") return {
|
|
2363
2361
|
type: "actor",
|
|
2364
|
-
identifier
|
|
2365
|
-
get handle() {
|
|
2366
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2367
|
-
return identifier;
|
|
2368
|
-
}
|
|
2362
|
+
identifier
|
|
2369
2363
|
};
|
|
2370
2364
|
else if (route.name.startsWith("object:")) {
|
|
2371
2365
|
const typeId = route.name.replace(/^object:/, "");
|
|
@@ -2377,59 +2371,31 @@ var ContextImpl = class ContextImpl {
|
|
|
2377
2371
|
};
|
|
2378
2372
|
} else if (route.name === "inbox") return {
|
|
2379
2373
|
type: "inbox",
|
|
2380
|
-
identifier
|
|
2381
|
-
get handle() {
|
|
2382
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2383
|
-
return identifier;
|
|
2384
|
-
}
|
|
2374
|
+
identifier
|
|
2385
2375
|
};
|
|
2386
2376
|
else if (route.name === "outbox") return {
|
|
2387
2377
|
type: "outbox",
|
|
2388
|
-
identifier
|
|
2389
|
-
get handle() {
|
|
2390
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2391
|
-
return identifier;
|
|
2392
|
-
}
|
|
2378
|
+
identifier
|
|
2393
2379
|
};
|
|
2394
2380
|
else if (route.name === "following") return {
|
|
2395
2381
|
type: "following",
|
|
2396
|
-
identifier
|
|
2397
|
-
get handle() {
|
|
2398
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2399
|
-
return identifier;
|
|
2400
|
-
}
|
|
2382
|
+
identifier
|
|
2401
2383
|
};
|
|
2402
2384
|
else if (route.name === "followers") return {
|
|
2403
2385
|
type: "followers",
|
|
2404
|
-
identifier
|
|
2405
|
-
get handle() {
|
|
2406
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2407
|
-
return identifier;
|
|
2408
|
-
}
|
|
2386
|
+
identifier
|
|
2409
2387
|
};
|
|
2410
2388
|
else if (route.name === "liked") return {
|
|
2411
2389
|
type: "liked",
|
|
2412
|
-
identifier
|
|
2413
|
-
get handle() {
|
|
2414
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2415
|
-
return identifier;
|
|
2416
|
-
}
|
|
2390
|
+
identifier
|
|
2417
2391
|
};
|
|
2418
2392
|
else if (route.name === "featured") return {
|
|
2419
2393
|
type: "featured",
|
|
2420
|
-
identifier
|
|
2421
|
-
get handle() {
|
|
2422
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2423
|
-
return identifier;
|
|
2424
|
-
}
|
|
2394
|
+
identifier
|
|
2425
2395
|
};
|
|
2426
2396
|
else if (route.name === "featuredTags") return {
|
|
2427
2397
|
type: "featuredTags",
|
|
2428
|
-
identifier
|
|
2429
|
-
get handle() {
|
|
2430
|
-
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2431
|
-
return identifier;
|
|
2432
|
-
}
|
|
2398
|
+
identifier
|
|
2433
2399
|
};
|
|
2434
2400
|
const collectionTypes = ["collection", "orderedCollection"];
|
|
2435
2401
|
const collectionRegex = /* @__PURE__ */ new RegExp(`^(${collectionTypes.join("|")}):(.*)$`);
|
|
@@ -2531,19 +2497,10 @@ var ContextImpl = class ContextImpl {
|
|
|
2531
2497
|
return null;
|
|
2532
2498
|
}
|
|
2533
2499
|
getDocumentLoader(identity) {
|
|
2534
|
-
if ("identifier" in identity || "username" in identity
|
|
2500
|
+
if ("identifier" in identity || "username" in identity) {
|
|
2535
2501
|
let identifierPromise;
|
|
2536
|
-
if ("username" in identity
|
|
2537
|
-
|
|
2538
|
-
if ("username" in identity) username = identity.username;
|
|
2539
|
-
else {
|
|
2540
|
-
username = identity.handle;
|
|
2541
|
-
getLogger([
|
|
2542
|
-
"fedify",
|
|
2543
|
-
"runtime",
|
|
2544
|
-
"docloader"
|
|
2545
|
-
]).warn("The \"handle\" property is deprecated; use \"identifier\" or \"username\" instead.", { identity });
|
|
2546
|
-
}
|
|
2502
|
+
if ("username" in identity) {
|
|
2503
|
+
const username = identity.username;
|
|
2547
2504
|
const mapper = this.federation.actorCallbacks?.handleMapper;
|
|
2548
2505
|
if (mapper == null) identifierPromise = Promise.resolve(username);
|
|
2549
2506
|
else {
|
|
@@ -2629,15 +2586,10 @@ var ContextImpl = class ContextImpl {
|
|
|
2629
2586
|
]);
|
|
2630
2587
|
let keys;
|
|
2631
2588
|
let identifier = null;
|
|
2632
|
-
if ("identifier" in sender || "username" in sender
|
|
2589
|
+
if ("identifier" in sender || "username" in sender) {
|
|
2633
2590
|
if ("identifier" in sender) identifier = sender.identifier;
|
|
2634
2591
|
else {
|
|
2635
|
-
|
|
2636
|
-
if ("username" in sender) username = sender.username;
|
|
2637
|
-
else {
|
|
2638
|
-
username = sender.handle;
|
|
2639
|
-
logger$2.warn("The \"handle\" property for the sender parameter is deprecated; use \"identifier\" or \"username\" instead.", { sender });
|
|
2640
|
-
}
|
|
2592
|
+
const username = sender.username;
|
|
2641
2593
|
if (this.federation.actorCallbacks?.handleMapper == null) identifier = username;
|
|
2642
2594
|
else {
|
|
2643
2595
|
const mapped = await this.federation.actorCallbacks.handleMapper(this, username);
|
|
@@ -2993,15 +2945,10 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2993
2945
|
]);
|
|
2994
2946
|
let keys;
|
|
2995
2947
|
let identifier = null;
|
|
2996
|
-
if ("identifier" in forwarder || "username" in forwarder
|
|
2948
|
+
if ("identifier" in forwarder || "username" in forwarder) {
|
|
2997
2949
|
if ("identifier" in forwarder) identifier = forwarder.identifier;
|
|
2998
2950
|
else {
|
|
2999
|
-
|
|
3000
|
-
if ("username" in forwarder) username = forwarder.username;
|
|
3001
|
-
else {
|
|
3002
|
-
username = forwarder.handle;
|
|
3003
|
-
logger$2.warn("The \"handle\" property for the forwarder parameter is deprecated; use \"identifier\" or \"username\" instead.", { forwarder });
|
|
3004
|
-
}
|
|
2951
|
+
const username = forwarder.username;
|
|
3005
2952
|
if (this.federation.actorCallbacks?.handleMapper == null) identifier = username;
|
|
3006
2953
|
else {
|
|
3007
2954
|
const mapped = await this.federation.actorCallbacks.handleMapper(this, username);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
|
+
|
|
5
|
+
require('./transformers-3g8GZwkZ.cjs');
|
|
6
|
+
require('./http-CowIBMKY.cjs');
|
|
7
|
+
const require_middleware = require('./middleware-aQr0yVne.cjs');
|
|
8
|
+
require('./proof-DQFAjOse.cjs');
|
|
9
|
+
require('./types-Cd_hszr_.cjs');
|
|
10
|
+
require('./kv-cache-174yQHE6.cjs');
|
|
11
|
+
|
|
12
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|