@fedify/fedify 2.0.0-dev.241 → 2.0.0-dev.323
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{builder-CR-ZQZJR.js → builder-CvKuNW7P.js} +3 -3
- package/dist/{chunk-DqRYRqnO.cjs → chunk-CGaQZ11T.cjs} +19 -0
- package/dist/chunk-DJNbSFdH.js +29 -0
- package/dist/compat/mod.cjs +1 -1
- package/dist/compat/mod.d.cts +6 -6
- package/dist/compat/mod.d.ts +6 -6
- package/dist/compat/mod.js +2 -2
- package/dist/compat/transformers.test.js +11 -11
- package/dist/{context-C7vzWilY.d.ts → context-CJO1oqSa.d.ts} +55 -12
- package/dist/{context-Bns6uTJq.js → context-CZ5llAss.js} +12 -12
- package/dist/{context-CrB9RFy5.d.cts → context-Zqld1re2.d.cts} +55 -12
- package/dist/{deno-DOeSTfhz.js → deno-BTAi5-ur.js} +11 -3
- package/dist/{docloader-C1AGOQQm.js → docloader-D8dzb6AT.js} +2 -2
- package/dist/federation/builder.test.js +3 -3
- package/dist/federation/handler.test.js +12 -12
- package/dist/federation/idempotency.test.js +47 -11
- package/dist/federation/inbox.test.js +2 -2
- package/dist/federation/middleware.test.js +63 -11
- package/dist/federation/mod.cjs +7 -7
- package/dist/federation/mod.d.cts +6 -6
- package/dist/federation/mod.d.ts +6 -6
- package/dist/federation/mod.js +7 -7
- package/dist/federation/mq.test.js +162 -10
- package/dist/federation/send.test.js +5 -5
- package/dist/federation/webfinger.test.js +12 -12
- package/dist/{federation-B431K2gm.cjs → federation-Bp3HI26G.cjs} +95 -11
- package/dist/{federation-BbZwNNWj.js → federation-DaMfqRm4.js} +94 -10
- package/dist/{http-C1LrW2D3.cjs → http-BCfCt7nq.cjs} +12 -4
- package/dist/{http-i8VdY2df.js → http-C02fQ5SX.js} +11 -3
- package/dist/{http-DGkEl4mw.js → http-C4WANccp.js} +2 -2
- package/dist/{inbox-Cp87HRVs.js → inbox-CdBcxHA7.js} +1 -1
- package/dist/{key-3_vbTfr8.js → key-BI6sqU5u.js} +1 -1
- package/dist/{kv-cache-B4CFgxYq.js → kv-cache-BLxaWwPk.js} +1 -1
- package/dist/{kv-cache-DOgKf8lH.cjs → kv-cache-Dk9UX_M2.cjs} +2 -2
- package/dist/{ld-BQxhMgOJ.js → ld-qTcTL2A4.js} +2 -2
- package/dist/middleware-BhYGJwH9.js +12 -0
- package/dist/{middleware-DZ-OdkE6.js → middleware-DG4UsFBP.js} +11 -11
- package/dist/{middleware-DbwwSEOr.js → middleware-DaOdxVOc.js} +65 -22
- package/dist/middleware-Dsrm1uhx.cjs +12 -0
- package/dist/{middleware-ixha9m0b.js → middleware-LQKxYF7X.js} +61 -18
- package/dist/{middleware-D4Eexdig.cjs → middleware-nW8ONmt3.cjs} +62 -19
- package/dist/mod-Bh8mqlYw.d.cts +9 -0
- package/dist/{mod-waqu-BL_.d.ts → mod-Bpuc-q64.d.ts} +1 -1
- package/dist/{mod-C3SOvTD1.d.ts → mod-C92O3FpJ.d.ts} +1 -1
- package/dist/{mod-0qnPv4EC.d.cts → mod-CKtAEVny.d.cts} +1 -1
- package/dist/{mod-BrS8tiad.d.cts → mod-COO7VMcm.d.cts} +1 -1
- package/dist/{mod-DZmuPaKv.d.ts → mod-CvhyLrjX.d.ts} +2 -2
- package/dist/mod-D6HodEq7.d.ts +7 -0
- package/dist/{mod-D6pS5_xJ.d.cts → mod-DFWeUq2q.d.cts} +1 -1
- package/dist/{mod-BHXq4Q3x.d.cts → mod-DWaA45ef.d.cts} +2 -2
- package/dist/{mod-jOa7W503.d.ts → mod-q2IR8UiH.d.ts} +1 -1
- package/dist/mod.cjs +57 -9
- package/dist/mod.d.cts +19 -10
- package/dist/mod.d.ts +20 -10
- package/dist/mod.js +59 -11
- package/dist/nodeinfo/handler.test.js +12 -12
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +2 -2
- package/dist/nodeinfo/mod.d.ts +2 -2
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/otel/mod.cjs +1 -1
- package/dist/otel/mod.d.cts +1 -1
- package/dist/otel/mod.d.ts +1 -1
- package/dist/{owner-Bod8mCab.js → owner-Cfmtlwoe.js} +1 -1
- package/dist/{proof--60Adidu.js → proof-Bc8ULrzP.js} +2 -2
- package/dist/{proof-C8MAHWxQ.cjs → proof-BoqEqbih.cjs} +2 -2
- package/dist/{proof-vG4ePLF2.js → proof-OjMPhNWs.js} +1 -1
- package/dist/runtime/mod.cjs +14 -0
- package/dist/runtime/mod.d.cts +2 -0
- package/dist/runtime/mod.d.ts +4 -0
- package/dist/runtime/mod.js +7 -0
- package/dist/runtime-c2Njxsry.cjs +17 -0
- package/dist/runtime-poamPCMb.js +13 -0
- package/dist/{send-B3fWpYN9.js → send-BKW3wSXo.js} +2 -2
- 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 +3 -3
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +3 -3
- package/dist/sig/owner.test.js +3 -3
- package/dist/sig/proof.test.js +3 -3
- package/dist/testing/mod.d.ts +23 -7
- package/dist/testing/mod.js +1 -1
- package/dist/{transformers-BjBg6Lag.cjs → transformers-3g8GZwkZ.cjs} +1 -1
- package/dist/{types-B6z6CqIz.cjs → types-Cd_hszr_.cjs} +1 -1
- package/dist/utils/docloader.test.js +4 -4
- package/dist/utils/mod.cjs +3 -3
- package/dist/utils/mod.d.cts +3 -3
- package/dist/utils/mod.d.ts +3 -3
- package/dist/utils/mod.js +3 -3
- package/dist/vocab/mod.cjs +13 -0
- package/dist/vocab/mod.d.cts +1 -0
- package/dist/vocab/mod.d.ts +3 -0
- package/dist/vocab/mod.js +5 -0
- package/package.json +30 -8
- package/dist/middleware-C52jAnyA.js +0 -12
- package/dist/middleware-XsmW-sAa.cjs +0 -12
- /package/dist/{client-by-PEGAJ.d.cts → client-CwkOPN13.d.cts} +0 -0
- /package/dist/{client-CUTUGgvJ.d.ts → client-a7NwzhA2.d.ts} +0 -0
- /package/dist/{compat-nxUqe4Z-.js → compat-Bb4NuTUO.js} +0 -0
- /package/dist/{http-ClB3pLcL.d.cts → http-CCEu-x1_.d.cts} +0 -0
- /package/dist/{http-DLBDPal9.d.ts → http-CODSJcKx.d.ts} +0 -0
- /package/dist/{kv-B4vFhIYL.d.cts → kv-g9jFc34-.d.cts} +0 -0
- /package/dist/{kv-CYySNrsn.d.ts → kv-jg_8SMc1.d.ts} +0 -0
- /package/dist/{mod-1E3W847c.d.ts → mod-AGjRfPjT.d.ts} +0 -0
- /package/dist/{mod-C81L6_lQ.d.cts → mod-gq_Xfdz8.d.cts} +0 -0
- /package/dist/{nodeinfo-BlLsRSiT.js → nodeinfo-DoESQxq5.js} +0 -0
- /package/dist/{owner-C-zfmVAD.d.cts → owner-9yZ5Ibsb.d.cts} +0 -0
- /package/dist/{owner-BgI8C-VY.d.ts → owner-DQYAbVmX.d.ts} +0 -0
- /package/dist/{sig-CwuONEzF.js → sig-BNhspNOf.js} +0 -0
- /package/dist/{sig-DeXX2xnj.cjs → sig-vX39WyWI.cjs} +0 -0
- /package/dist/{transformers-N_ip_y4P.js → transformers-C3FLHUd6.js} +0 -0
- /package/dist/{types-8l28uC8o.js → types-C93Ob9cU.js} +0 -0
- /package/dist/{utils-Db0ZmjcD.cjs → utils-BQ9KqEK9.cjs} +0 -0
- /package/dist/{utils-Wranxuoe.js → utils-Dn5OPdSW.js} +0 -0
|
@@ -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-BTAi5-ur.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-BI6sqU5u.js";
|
|
11
|
+
import { verifyRequest } from "./http-C4WANccp.js";
|
|
12
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-qTcTL2A4.js";
|
|
13
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-Cfmtlwoe.js";
|
|
14
|
+
import { signObject, verifyObject } from "./proof-Bc8ULrzP.js";
|
|
15
|
+
import { getAuthenticatedDocumentLoader } from "./docloader-D8dzb6AT.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-CdBcxHA7.js";
|
|
18
|
+
import { FederationBuilderImpl } from "./builder-CvKuNW7P.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 { extractInboxes, sendActivity } from "./send-
|
|
23
|
+
import { extractInboxes, sendActivity } from "./send-BKW3wSXo.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";
|
|
@@ -1518,6 +1518,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1518
1518
|
}) });
|
|
1519
1519
|
await this.sendActivity(keys, message.inboxes, activity, {
|
|
1520
1520
|
collectionSync: message.collectionSync,
|
|
1521
|
+
orderingKey: message.orderingKey,
|
|
1521
1522
|
context: context$1
|
|
1522
1523
|
});
|
|
1523
1524
|
}
|
|
@@ -1766,7 +1767,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1766
1767
|
"federation",
|
|
1767
1768
|
"outbox"
|
|
1768
1769
|
]);
|
|
1769
|
-
const { immediate, collectionSync, context: ctx } = options;
|
|
1770
|
+
const { immediate, collectionSync, orderingKey, context: ctx } = options;
|
|
1770
1771
|
if (activity.id == null) throw new TypeError("The activity to send must have an id.");
|
|
1771
1772
|
if (activity.actorId == null) throw new TypeError("The activity to send must have at least one actor property.");
|
|
1772
1773
|
else if (keys.length < 1) throw new TypeError("The keys must not be empty.");
|
|
@@ -1854,6 +1855,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1854
1855
|
propagation.inject(context.active(), carrier);
|
|
1855
1856
|
const messages = [];
|
|
1856
1857
|
for (const inbox in inboxes) {
|
|
1858
|
+
const inboxOrigin = new URL(inbox).origin;
|
|
1859
|
+
const messageOrderingKey = orderingKey == null ? void 0 : `${orderingKey}\n${inboxOrigin}`;
|
|
1857
1860
|
const message = {
|
|
1858
1861
|
type: "outbox",
|
|
1859
1862
|
id: crypto.randomUUID(),
|
|
@@ -1867,13 +1870,29 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1867
1870
|
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1868
1871
|
attempt: 0,
|
|
1869
1872
|
headers: collectionSync == null ? {} : { "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) },
|
|
1873
|
+
orderingKey: messageOrderingKey,
|
|
1870
1874
|
traceContext: carrier
|
|
1871
1875
|
};
|
|
1872
|
-
messages.push(
|
|
1876
|
+
messages.push({
|
|
1877
|
+
message,
|
|
1878
|
+
orderingKey: messageOrderingKey
|
|
1879
|
+
});
|
|
1873
1880
|
}
|
|
1874
1881
|
const { outboxQueue } = this;
|
|
1875
1882
|
if (outboxQueue.enqueueMany == null) {
|
|
1876
|
-
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
1883
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
1884
|
+
const results = await Promise.allSettled(promises);
|
|
1885
|
+
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
1886
|
+
if (errors.length > 0) {
|
|
1887
|
+
logger$2.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
1888
|
+
activityId: activity.id.href,
|
|
1889
|
+
errors
|
|
1890
|
+
});
|
|
1891
|
+
if (errors.length > 1) throw new AggregateError(errors, `Failed to enqueue activity ${activityId} to send later.`);
|
|
1892
|
+
throw errors[0];
|
|
1893
|
+
}
|
|
1894
|
+
} else if (orderingKey != null) {
|
|
1895
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
1877
1896
|
const results = await Promise.allSettled(promises);
|
|
1878
1897
|
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
1879
1898
|
if (errors.length > 0) {
|
|
@@ -1885,7 +1904,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1885
1904
|
throw errors[0];
|
|
1886
1905
|
}
|
|
1887
1906
|
} else try {
|
|
1888
|
-
await outboxQueue.enqueueMany(messages);
|
|
1907
|
+
await outboxQueue.enqueueMany(messages.map((m) => m.message));
|
|
1889
1908
|
} catch (error) {
|
|
1890
1909
|
logger$2.error("Failed to enqueue activity {activityId} to send later: {error}", {
|
|
1891
1910
|
activityId: activity.id.href,
|
|
@@ -2601,20 +2620,25 @@ var ContextImpl = class ContextImpl {
|
|
|
2601
2620
|
} else keys = [sender];
|
|
2602
2621
|
if (keys.length < 1) throw new TypeError("The sender's keys must not be empty.");
|
|
2603
2622
|
for (const { privateKey } of keys) validateCryptoKey(privateKey, "private");
|
|
2604
|
-
const opts = { context: this };
|
|
2605
2623
|
let expandedRecipients;
|
|
2624
|
+
let collectionSync;
|
|
2606
2625
|
if (Array.isArray(recipients)) expandedRecipients = recipients;
|
|
2607
2626
|
else if (recipients === "followers") {
|
|
2608
2627
|
if (identifier == null) throw new Error("If recipients is \"followers\", sender must be an actor identifier or username.");
|
|
2609
2628
|
expandedRecipients = [];
|
|
2610
2629
|
for await (const recipient of this.getFollowers(identifier)) expandedRecipients.push(recipient);
|
|
2611
2630
|
if (options.syncCollection) try {
|
|
2612
|
-
|
|
2631
|
+
collectionSync = this.getFollowersUri(identifier).href;
|
|
2613
2632
|
} catch (error) {
|
|
2614
|
-
if (error instanceof RouterError)
|
|
2615
|
-
else throw error;
|
|
2633
|
+
if (!(error instanceof RouterError)) throw error;
|
|
2616
2634
|
}
|
|
2617
2635
|
} else expandedRecipients = [recipients];
|
|
2636
|
+
const opts = {
|
|
2637
|
+
context: this,
|
|
2638
|
+
orderingKey: options.orderingKey,
|
|
2639
|
+
collectionSync,
|
|
2640
|
+
immediate: options.immediate
|
|
2641
|
+
};
|
|
2618
2642
|
span.setAttribute("activitypub.inboxes", expandedRecipients.length);
|
|
2619
2643
|
for (const activityTransformer of this.federation.activityTransformers) activity = activityTransformer(activity, this);
|
|
2620
2644
|
span?.setAttribute("activitypub.activity.id", activity?.id?.href ?? "");
|
|
@@ -2661,10 +2685,11 @@ var ContextImpl = class ContextImpl {
|
|
|
2661
2685
|
activityId: activity.id?.href,
|
|
2662
2686
|
activityType: getTypeId(activity).href,
|
|
2663
2687
|
collectionSync: opts.collectionSync,
|
|
2688
|
+
orderingKey: options.orderingKey,
|
|
2664
2689
|
traceContext: carrier
|
|
2665
2690
|
};
|
|
2666
2691
|
if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
|
|
2667
|
-
this.federation.fanoutQueue.enqueue(message);
|
|
2692
|
+
this.federation.fanoutQueue.enqueue(message, { orderingKey: options.orderingKey });
|
|
2668
2693
|
}
|
|
2669
2694
|
async *getFollowers(identifier) {
|
|
2670
2695
|
if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
|
|
@@ -3016,8 +3041,10 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3016
3041
|
}
|
|
3017
3042
|
const carrier = {};
|
|
3018
3043
|
propagation.inject(context.active(), carrier);
|
|
3044
|
+
const orderingKey = options?.orderingKey;
|
|
3019
3045
|
const messages = [];
|
|
3020
3046
|
for (const inbox in inboxes) {
|
|
3047
|
+
const inboxUrl = new URL(inbox);
|
|
3021
3048
|
const message = {
|
|
3022
3049
|
type: "outbox",
|
|
3023
3050
|
id: crypto.randomUUID(),
|
|
@@ -3031,13 +3058,29 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3031
3058
|
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3032
3059
|
attempt: 0,
|
|
3033
3060
|
headers: {},
|
|
3061
|
+
orderingKey: orderingKey == null ? void 0 : `${orderingKey}\n${inboxUrl.origin}`,
|
|
3034
3062
|
traceContext: carrier
|
|
3035
3063
|
};
|
|
3036
|
-
messages.push(
|
|
3064
|
+
messages.push({
|
|
3065
|
+
message,
|
|
3066
|
+
orderingKey: message.orderingKey
|
|
3067
|
+
});
|
|
3037
3068
|
}
|
|
3038
3069
|
const { outboxQueue } = this.federation;
|
|
3039
3070
|
if (outboxQueue.enqueueMany == null) {
|
|
3040
|
-
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
3071
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
3072
|
+
const results = await Promise.allSettled(promises);
|
|
3073
|
+
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
3074
|
+
if (errors.length > 0) {
|
|
3075
|
+
logger$2.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
3076
|
+
activityId: this.activityId,
|
|
3077
|
+
errors
|
|
3078
|
+
});
|
|
3079
|
+
if (errors.length > 1) throw new AggregateError(errors, `Failed to enqueue activity ${this.activityId} to forward later.`);
|
|
3080
|
+
throw errors[0];
|
|
3081
|
+
}
|
|
3082
|
+
} else if (orderingKey != null) {
|
|
3083
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
3041
3084
|
const results = await Promise.allSettled(promises);
|
|
3042
3085
|
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
3043
3086
|
if (errors.length > 0) {
|
|
@@ -3049,7 +3092,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3049
3092
|
throw errors[0];
|
|
3050
3093
|
}
|
|
3051
3094
|
} else try {
|
|
3052
|
-
await outboxQueue.enqueueMany(messages);
|
|
3095
|
+
await outboxQueue.enqueueMany(messages.map((m) => m.message));
|
|
3053
3096
|
} catch (error) {
|
|
3054
3097
|
logger$2.error("Failed to enqueue activity {activityId} to forward later:\n{error}", {
|
|
3055
3098
|
activityId: this.activityId,
|
|
@@ -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-BCfCt7nq.cjs');
|
|
7
|
+
const require_middleware = require('./middleware-nW8ONmt3.cjs');
|
|
8
|
+
require('./proof-BoqEqbih.cjs');
|
|
9
|
+
require('./types-Cd_hszr_.cjs');
|
|
10
|
+
require('./kv-cache-Dk9UX_M2.cjs');
|
|
11
|
+
|
|
12
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { getDefaultActivityTransformers } from "./transformers-
|
|
6
|
-
import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-
|
|
7
|
-
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-
|
|
8
|
-
import { getNodeInfo, nodeInfoToJson } from "./types-
|
|
9
|
-
import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-
|
|
5
|
+
import { getDefaultActivityTransformers } from "./transformers-C3FLHUd6.js";
|
|
6
|
+
import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-C02fQ5SX.js";
|
|
7
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-OjMPhNWs.js";
|
|
8
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-C93Ob9cU.js";
|
|
9
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-BLxaWwPk.js";
|
|
10
10
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
12
12
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
@@ -337,7 +337,7 @@ var FederationBuilderImpl = class {
|
|
|
337
337
|
this.collectionTypeIds = {};
|
|
338
338
|
}
|
|
339
339
|
async build(options) {
|
|
340
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
|
340
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-BhYGJwH9.js");
|
|
341
341
|
const f = new FederationImpl$1(options);
|
|
342
342
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
343
343
|
f.router = this.router.clone();
|
|
@@ -2560,6 +2560,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2560
2560
|
}) });
|
|
2561
2561
|
await this.sendActivity(keys, message.inboxes, activity, {
|
|
2562
2562
|
collectionSync: message.collectionSync,
|
|
2563
|
+
orderingKey: message.orderingKey,
|
|
2563
2564
|
context: context$1
|
|
2564
2565
|
});
|
|
2565
2566
|
}
|
|
@@ -2808,7 +2809,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2808
2809
|
"federation",
|
|
2809
2810
|
"outbox"
|
|
2810
2811
|
]);
|
|
2811
|
-
const { immediate, collectionSync, context: ctx } = options;
|
|
2812
|
+
const { immediate, collectionSync, orderingKey, context: ctx } = options;
|
|
2812
2813
|
if (activity.id == null) throw new TypeError("The activity to send must have an id.");
|
|
2813
2814
|
if (activity.actorId == null) throw new TypeError("The activity to send must have at least one actor property.");
|
|
2814
2815
|
else if (keys.length < 1) throw new TypeError("The keys must not be empty.");
|
|
@@ -2896,6 +2897,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2896
2897
|
propagation.inject(context.active(), carrier);
|
|
2897
2898
|
const messages = [];
|
|
2898
2899
|
for (const inbox in inboxes) {
|
|
2900
|
+
const inboxOrigin = new URL(inbox).origin;
|
|
2901
|
+
const messageOrderingKey = orderingKey == null ? void 0 : `${orderingKey}\n${inboxOrigin}`;
|
|
2899
2902
|
const message = {
|
|
2900
2903
|
type: "outbox",
|
|
2901
2904
|
id: crypto.randomUUID(),
|
|
@@ -2909,13 +2912,29 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2909
2912
|
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2910
2913
|
attempt: 0,
|
|
2911
2914
|
headers: collectionSync == null ? {} : { "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) },
|
|
2915
|
+
orderingKey: messageOrderingKey,
|
|
2912
2916
|
traceContext: carrier
|
|
2913
2917
|
};
|
|
2914
|
-
messages.push(
|
|
2918
|
+
messages.push({
|
|
2919
|
+
message,
|
|
2920
|
+
orderingKey: messageOrderingKey
|
|
2921
|
+
});
|
|
2915
2922
|
}
|
|
2916
2923
|
const { outboxQueue } = this;
|
|
2917
2924
|
if (outboxQueue.enqueueMany == null) {
|
|
2918
|
-
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
2925
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
2926
|
+
const results = await Promise.allSettled(promises);
|
|
2927
|
+
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2928
|
+
if (errors.length > 0) {
|
|
2929
|
+
logger$1.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
2930
|
+
activityId: activity.id.href,
|
|
2931
|
+
errors
|
|
2932
|
+
});
|
|
2933
|
+
if (errors.length > 1) throw new AggregateError(errors, `Failed to enqueue activity ${activityId} to send later.`);
|
|
2934
|
+
throw errors[0];
|
|
2935
|
+
}
|
|
2936
|
+
} else if (orderingKey != null) {
|
|
2937
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
2919
2938
|
const results = await Promise.allSettled(promises);
|
|
2920
2939
|
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2921
2940
|
if (errors.length > 0) {
|
|
@@ -2927,7 +2946,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2927
2946
|
throw errors[0];
|
|
2928
2947
|
}
|
|
2929
2948
|
} else try {
|
|
2930
|
-
await outboxQueue.enqueueMany(messages);
|
|
2949
|
+
await outboxQueue.enqueueMany(messages.map((m) => m.message));
|
|
2931
2950
|
} catch (error) {
|
|
2932
2951
|
logger$1.error("Failed to enqueue activity {activityId} to send later: {error}", {
|
|
2933
2952
|
activityId: activity.id.href,
|
|
@@ -3643,20 +3662,25 @@ var ContextImpl = class ContextImpl {
|
|
|
3643
3662
|
} else keys = [sender];
|
|
3644
3663
|
if (keys.length < 1) throw new TypeError("The sender's keys must not be empty.");
|
|
3645
3664
|
for (const { privateKey } of keys) validateCryptoKey(privateKey, "private");
|
|
3646
|
-
const opts = { context: this };
|
|
3647
3665
|
let expandedRecipients;
|
|
3666
|
+
let collectionSync;
|
|
3648
3667
|
if (Array.isArray(recipients)) expandedRecipients = recipients;
|
|
3649
3668
|
else if (recipients === "followers") {
|
|
3650
3669
|
if (identifier == null) throw new Error("If recipients is \"followers\", sender must be an actor identifier or username.");
|
|
3651
3670
|
expandedRecipients = [];
|
|
3652
3671
|
for await (const recipient of this.getFollowers(identifier)) expandedRecipients.push(recipient);
|
|
3653
3672
|
if (options.syncCollection) try {
|
|
3654
|
-
|
|
3673
|
+
collectionSync = this.getFollowersUri(identifier).href;
|
|
3655
3674
|
} catch (error) {
|
|
3656
|
-
if (error instanceof RouterError)
|
|
3657
|
-
else throw error;
|
|
3675
|
+
if (!(error instanceof RouterError)) throw error;
|
|
3658
3676
|
}
|
|
3659
3677
|
} else expandedRecipients = [recipients];
|
|
3678
|
+
const opts = {
|
|
3679
|
+
context: this,
|
|
3680
|
+
orderingKey: options.orderingKey,
|
|
3681
|
+
collectionSync,
|
|
3682
|
+
immediate: options.immediate
|
|
3683
|
+
};
|
|
3660
3684
|
span.setAttribute("activitypub.inboxes", expandedRecipients.length);
|
|
3661
3685
|
for (const activityTransformer of this.federation.activityTransformers) activity = activityTransformer(activity, this);
|
|
3662
3686
|
span?.setAttribute("activitypub.activity.id", activity?.id?.href ?? "");
|
|
@@ -3703,10 +3727,11 @@ var ContextImpl = class ContextImpl {
|
|
|
3703
3727
|
activityId: activity.id?.href,
|
|
3704
3728
|
activityType: getTypeId(activity).href,
|
|
3705
3729
|
collectionSync: opts.collectionSync,
|
|
3730
|
+
orderingKey: options.orderingKey,
|
|
3706
3731
|
traceContext: carrier
|
|
3707
3732
|
};
|
|
3708
3733
|
if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
|
|
3709
|
-
this.federation.fanoutQueue.enqueue(message);
|
|
3734
|
+
this.federation.fanoutQueue.enqueue(message, { orderingKey: options.orderingKey });
|
|
3710
3735
|
}
|
|
3711
3736
|
async *getFollowers(identifier) {
|
|
3712
3737
|
if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
|
|
@@ -4058,8 +4083,10 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4058
4083
|
}
|
|
4059
4084
|
const carrier = {};
|
|
4060
4085
|
propagation.inject(context.active(), carrier);
|
|
4086
|
+
const orderingKey = options?.orderingKey;
|
|
4061
4087
|
const messages = [];
|
|
4062
4088
|
for (const inbox in inboxes) {
|
|
4089
|
+
const inboxUrl = new URL(inbox);
|
|
4063
4090
|
const message = {
|
|
4064
4091
|
type: "outbox",
|
|
4065
4092
|
id: crypto.randomUUID(),
|
|
@@ -4073,13 +4100,29 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4073
4100
|
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4074
4101
|
attempt: 0,
|
|
4075
4102
|
headers: {},
|
|
4103
|
+
orderingKey: orderingKey == null ? void 0 : `${orderingKey}\n${inboxUrl.origin}`,
|
|
4076
4104
|
traceContext: carrier
|
|
4077
4105
|
};
|
|
4078
|
-
messages.push(
|
|
4106
|
+
messages.push({
|
|
4107
|
+
message,
|
|
4108
|
+
orderingKey: message.orderingKey
|
|
4109
|
+
});
|
|
4079
4110
|
}
|
|
4080
4111
|
const { outboxQueue } = this.federation;
|
|
4081
4112
|
if (outboxQueue.enqueueMany == null) {
|
|
4082
|
-
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
4113
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
4114
|
+
const results = await Promise.allSettled(promises);
|
|
4115
|
+
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
4116
|
+
if (errors.length > 0) {
|
|
4117
|
+
logger$1.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
4118
|
+
activityId: this.activityId,
|
|
4119
|
+
errors
|
|
4120
|
+
});
|
|
4121
|
+
if (errors.length > 1) throw new AggregateError(errors, `Failed to enqueue activity ${this.activityId} to forward later.`);
|
|
4122
|
+
throw errors[0];
|
|
4123
|
+
}
|
|
4124
|
+
} else if (orderingKey != null) {
|
|
4125
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
4083
4126
|
const results = await Promise.allSettled(promises);
|
|
4084
4127
|
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
4085
4128
|
if (errors.length > 0) {
|
|
@@ -4091,7 +4134,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4091
4134
|
throw errors[0];
|
|
4092
4135
|
}
|
|
4093
4136
|
} else try {
|
|
4094
|
-
await outboxQueue.enqueueMany(messages);
|
|
4137
|
+
await outboxQueue.enqueueMany(messages.map((m) => m.message));
|
|
4095
4138
|
} catch (error) {
|
|
4096
4139
|
logger$1.error("Failed to enqueue activity {activityId} to forward later:\n{error}", {
|
|
4097
4140
|
activityId: this.activityId,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
|
-
const require_chunk = require('./chunk-
|
|
6
|
-
const require_transformers = require('./transformers-
|
|
7
|
-
const require_http = require('./http-
|
|
8
|
-
const require_proof = require('./proof-
|
|
9
|
-
const require_types = require('./types-
|
|
10
|
-
const require_kv_cache = require('./kv-cache-
|
|
5
|
+
const require_chunk = require('./chunk-CGaQZ11T.cjs');
|
|
6
|
+
const require_transformers = require('./transformers-3g8GZwkZ.cjs');
|
|
7
|
+
const require_http = require('./http-BCfCt7nq.cjs');
|
|
8
|
+
const require_proof = require('./proof-BoqEqbih.cjs');
|
|
9
|
+
const require_types = require('./types-Cd_hszr_.cjs');
|
|
10
|
+
const require_kv_cache = require('./kv-cache-Dk9UX_M2.cjs');
|
|
11
11
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
12
12
|
const __fedify_vocab = require_chunk.__toESM(require("@fedify/vocab"));
|
|
13
13
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
@@ -338,7 +338,7 @@ var FederationBuilderImpl = class {
|
|
|
338
338
|
this.collectionTypeIds = {};
|
|
339
339
|
}
|
|
340
340
|
async build(options) {
|
|
341
|
-
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-
|
|
341
|
+
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-Dsrm1uhx.cjs"));
|
|
342
342
|
const f = new FederationImpl$1(options);
|
|
343
343
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
344
344
|
f.router = this.router.clone();
|
|
@@ -2561,6 +2561,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2561
2561
|
}) });
|
|
2562
2562
|
await this.sendActivity(keys, message.inboxes, activity, {
|
|
2563
2563
|
collectionSync: message.collectionSync,
|
|
2564
|
+
orderingKey: message.orderingKey,
|
|
2564
2565
|
context: context$2
|
|
2565
2566
|
});
|
|
2566
2567
|
}
|
|
@@ -2809,7 +2810,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2809
2810
|
"federation",
|
|
2810
2811
|
"outbox"
|
|
2811
2812
|
]);
|
|
2812
|
-
const { immediate, collectionSync, context: ctx } = options;
|
|
2813
|
+
const { immediate, collectionSync, orderingKey, context: ctx } = options;
|
|
2813
2814
|
if (activity.id == null) throw new TypeError("The activity to send must have an id.");
|
|
2814
2815
|
if (activity.actorId == null) throw new TypeError("The activity to send must have at least one actor property.");
|
|
2815
2816
|
else if (keys.length < 1) throw new TypeError("The keys must not be empty.");
|
|
@@ -2897,6 +2898,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2897
2898
|
__opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
|
|
2898
2899
|
const messages = [];
|
|
2899
2900
|
for (const inbox in inboxes) {
|
|
2901
|
+
const inboxOrigin = new URL(inbox).origin;
|
|
2902
|
+
const messageOrderingKey = orderingKey == null ? void 0 : `${orderingKey}\n${inboxOrigin}`;
|
|
2900
2903
|
const message = {
|
|
2901
2904
|
type: "outbox",
|
|
2902
2905
|
id: crypto.randomUUID(),
|
|
@@ -2910,13 +2913,29 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2910
2913
|
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2911
2914
|
attempt: 0,
|
|
2912
2915
|
headers: collectionSync == null ? {} : { "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) },
|
|
2916
|
+
orderingKey: messageOrderingKey,
|
|
2913
2917
|
traceContext: carrier
|
|
2914
2918
|
};
|
|
2915
|
-
messages.push(
|
|
2919
|
+
messages.push({
|
|
2920
|
+
message,
|
|
2921
|
+
orderingKey: messageOrderingKey
|
|
2922
|
+
});
|
|
2916
2923
|
}
|
|
2917
2924
|
const { outboxQueue } = this;
|
|
2918
2925
|
if (outboxQueue.enqueueMany == null) {
|
|
2919
|
-
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
2926
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
2927
|
+
const results = await Promise.allSettled(promises);
|
|
2928
|
+
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2929
|
+
if (errors.length > 0) {
|
|
2930
|
+
logger$1.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
2931
|
+
activityId: activity.id.href,
|
|
2932
|
+
errors
|
|
2933
|
+
});
|
|
2934
|
+
if (errors.length > 1) throw new AggregateError(errors, `Failed to enqueue activity ${activityId} to send later.`);
|
|
2935
|
+
throw errors[0];
|
|
2936
|
+
}
|
|
2937
|
+
} else if (orderingKey != null) {
|
|
2938
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
2920
2939
|
const results = await Promise.allSettled(promises);
|
|
2921
2940
|
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2922
2941
|
if (errors.length > 0) {
|
|
@@ -2928,7 +2947,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2928
2947
|
throw errors[0];
|
|
2929
2948
|
}
|
|
2930
2949
|
} else try {
|
|
2931
|
-
await outboxQueue.enqueueMany(messages);
|
|
2950
|
+
await outboxQueue.enqueueMany(messages.map((m) => m.message));
|
|
2932
2951
|
} catch (error) {
|
|
2933
2952
|
logger$1.error("Failed to enqueue activity {activityId} to send later: {error}", {
|
|
2934
2953
|
activityId: activity.id.href,
|
|
@@ -3644,20 +3663,25 @@ var ContextImpl = class ContextImpl {
|
|
|
3644
3663
|
} else keys = [sender];
|
|
3645
3664
|
if (keys.length < 1) throw new TypeError("The sender's keys must not be empty.");
|
|
3646
3665
|
for (const { privateKey } of keys) require_http.validateCryptoKey(privateKey, "private");
|
|
3647
|
-
const opts = { context: this };
|
|
3648
3666
|
let expandedRecipients;
|
|
3667
|
+
let collectionSync;
|
|
3649
3668
|
if (Array.isArray(recipients)) expandedRecipients = recipients;
|
|
3650
3669
|
else if (recipients === "followers") {
|
|
3651
3670
|
if (identifier == null) throw new Error("If recipients is \"followers\", sender must be an actor identifier or username.");
|
|
3652
3671
|
expandedRecipients = [];
|
|
3653
3672
|
for await (const recipient of this.getFollowers(identifier)) expandedRecipients.push(recipient);
|
|
3654
3673
|
if (options.syncCollection) try {
|
|
3655
|
-
|
|
3674
|
+
collectionSync = this.getFollowersUri(identifier).href;
|
|
3656
3675
|
} catch (error) {
|
|
3657
|
-
if (error instanceof RouterError)
|
|
3658
|
-
else throw error;
|
|
3676
|
+
if (!(error instanceof RouterError)) throw error;
|
|
3659
3677
|
}
|
|
3660
3678
|
} else expandedRecipients = [recipients];
|
|
3679
|
+
const opts = {
|
|
3680
|
+
context: this,
|
|
3681
|
+
orderingKey: options.orderingKey,
|
|
3682
|
+
collectionSync,
|
|
3683
|
+
immediate: options.immediate
|
|
3684
|
+
};
|
|
3661
3685
|
span.setAttribute("activitypub.inboxes", expandedRecipients.length);
|
|
3662
3686
|
for (const activityTransformer of this.federation.activityTransformers) activity = activityTransformer(activity, this);
|
|
3663
3687
|
span?.setAttribute("activitypub.activity.id", activity?.id?.href ?? "");
|
|
@@ -3704,10 +3728,11 @@ var ContextImpl = class ContextImpl {
|
|
|
3704
3728
|
activityId: activity.id?.href,
|
|
3705
3729
|
activityType: (0, __fedify_vocab.getTypeId)(activity).href,
|
|
3706
3730
|
collectionSync: opts.collectionSync,
|
|
3731
|
+
orderingKey: options.orderingKey,
|
|
3707
3732
|
traceContext: carrier
|
|
3708
3733
|
};
|
|
3709
3734
|
if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
|
|
3710
|
-
this.federation.fanoutQueue.enqueue(message);
|
|
3735
|
+
this.federation.fanoutQueue.enqueue(message, { orderingKey: options.orderingKey });
|
|
3711
3736
|
}
|
|
3712
3737
|
async *getFollowers(identifier) {
|
|
3713
3738
|
if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
|
|
@@ -4059,8 +4084,10 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4059
4084
|
}
|
|
4060
4085
|
const carrier = {};
|
|
4061
4086
|
__opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
|
|
4087
|
+
const orderingKey = options?.orderingKey;
|
|
4062
4088
|
const messages = [];
|
|
4063
4089
|
for (const inbox in inboxes) {
|
|
4090
|
+
const inboxUrl = new URL(inbox);
|
|
4064
4091
|
const message = {
|
|
4065
4092
|
type: "outbox",
|
|
4066
4093
|
id: crypto.randomUUID(),
|
|
@@ -4074,13 +4101,29 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4074
4101
|
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4075
4102
|
attempt: 0,
|
|
4076
4103
|
headers: {},
|
|
4104
|
+
orderingKey: orderingKey == null ? void 0 : `${orderingKey}\n${inboxUrl.origin}`,
|
|
4077
4105
|
traceContext: carrier
|
|
4078
4106
|
};
|
|
4079
|
-
messages.push(
|
|
4107
|
+
messages.push({
|
|
4108
|
+
message,
|
|
4109
|
+
orderingKey: message.orderingKey
|
|
4110
|
+
});
|
|
4080
4111
|
}
|
|
4081
4112
|
const { outboxQueue } = this.federation;
|
|
4082
4113
|
if (outboxQueue.enqueueMany == null) {
|
|
4083
|
-
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
4114
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
4115
|
+
const results = await Promise.allSettled(promises);
|
|
4116
|
+
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
4117
|
+
if (errors.length > 0) {
|
|
4118
|
+
logger$1.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
4119
|
+
activityId: this.activityId,
|
|
4120
|
+
errors
|
|
4121
|
+
});
|
|
4122
|
+
if (errors.length > 1) throw new AggregateError(errors, `Failed to enqueue activity ${this.activityId} to forward later.`);
|
|
4123
|
+
throw errors[0];
|
|
4124
|
+
}
|
|
4125
|
+
} else if (orderingKey != null) {
|
|
4126
|
+
const promises = messages.map((m) => outboxQueue.enqueue(m.message, { orderingKey: m.orderingKey }));
|
|
4084
4127
|
const results = await Promise.allSettled(promises);
|
|
4085
4128
|
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
4086
4129
|
if (errors.length > 0) {
|
|
@@ -4092,7 +4135,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4092
4135
|
throw errors[0];
|
|
4093
4136
|
}
|
|
4094
4137
|
} else try {
|
|
4095
|
-
await outboxQueue.enqueueMany(messages);
|
|
4138
|
+
await outboxQueue.enqueueMany(messages.map((m) => m.message));
|
|
4096
4139
|
} catch (error) {
|
|
4097
4140
|
logger$1.error("Failed to enqueue activity {activityId} to forward later:\n{error}", {
|
|
4098
4141
|
activityId: this.activityId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { ActivityTransformer, Context } from "./context-
|
|
3
|
+
import { ActivityTransformer, Context } from "./context-CJO1oqSa.js";
|
|
4
4
|
import { Activity } from "@fedify/vocab";
|
|
5
5
|
|
|
6
6
|
//#region src/compat/transformers.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, RequestContext, WebFingerLinksDispatcher } from "./context-
|
|
3
|
+
import { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, RequestContext, WebFingerLinksDispatcher } from "./context-CJO1oqSa.js";
|
|
4
4
|
import { Span, Tracer } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/federation/webfinger.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, RequestContext, WebFingerLinksDispatcher } from "./context-
|
|
1
|
+
import { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, RequestContext, WebFingerLinksDispatcher } from "./context-Zqld1re2.cjs";
|
|
2
2
|
import { Span, Tracer } from "@opentelemetry/api";
|
|
3
3
|
|
|
4
4
|
//#region src/federation/webfinger.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyCache } from "./http-
|
|
1
|
+
import { KeyCache } from "./http-CCEu-x1_.cjs";
|
|
2
2
|
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
3
3
|
import { DocumentLoader } from "@fedify/vocab-runtime";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { HttpMessageSignaturesSpecDeterminer } from "./http-
|
|
4
|
-
import { KvKey, KvStore } from "./kv-
|
|
3
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-CODSJcKx.js";
|
|
4
|
+
import { KvKey, KvStore } from "./kv-jg_8SMc1.js";
|
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
7
7
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
import * as import___fedify_vocab_runtime from "@fedify/vocab-runtime";
|
|
4
|
+
__reExport(mod_d_exports, import___fedify_vocab_runtime);
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { mod_d_exports };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpMessageSignaturesSpecDeterminer } from "./http-
|
|
2
|
-
import { KvKey, KvStore } from "./kv-
|
|
1
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-CCEu-x1_.cjs";
|
|
2
|
+
import { KvKey, KvStore } from "./kv-g9jFc34-.cjs";
|
|
3
3
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
|