@fedify/fedify 2.5.0-dev.2609 → 2.5.0-dev.2618
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-BLCvt0zp.mjs → builder-C-zhu1PC.mjs} +82 -3
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-DNhLvscb.mjs → compound-proof-B6Mz3pzt.mjs} +2 -2
- package/dist/{context-ByflxsY9.d.cts → context-C1NqcIct.d.cts} +1061 -443
- package/dist/{context-uQUY5fQT.d.ts → context-xrqq4Hrq.d.ts} +1064 -446
- package/dist/{deno-DYkYmKp0.mjs → deno-CaPDSXDl.mjs} +1 -1
- package/dist/{docloader-B9RO5nh9.mjs → docloader-kYMkiXaB.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +4 -4
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-actorless.test.mjs +5 -5
- package/dist/federation/inbox-report.test.mjs +220 -5
- package/dist/federation/inbox-view.test.mjs +1 -1
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +4 -4
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +1 -1
- package/dist/federation/outbound-body.test.d.mts +2 -0
- package/dist/federation/outbound-body.test.mjs +149 -0
- package/dist/federation/outbound-capture.test.d.mts +2 -0
- package/dist/federation/outbound-capture.test.mjs +394 -0
- package/dist/federation/outbound-dispatch.test.d.mts +2 -0
- package/dist/federation/outbound-dispatch.test.mjs +368 -0
- package/dist/federation/outbound-document.test.d.mts +2 -0
- package/dist/federation/outbound-document.test.mjs +171 -0
- package/dist/federation/outbound-provenance.test.d.mts +2 -0
- package/dist/federation/outbound-provenance.test.mjs +543 -0
- package/dist/federation/outbound-report.test.d.mts +2 -0
- package/dist/federation/outbound-report.test.mjs +5475 -0
- package/dist/federation/outbound-workers.test.d.mts +2 -0
- package/dist/federation/outbound-workers.test.mjs +64 -0
- package/dist/federation/outbound-workflow.test.d.mts +2 -0
- package/dist/federation/outbound-workflow.test.mjs +154 -0
- package/dist/federation/outgoing-proof.test.mjs +4 -4
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +106 -7
- package/dist/federation/portable-gateway-keys.test.mjs +5 -5
- package/dist/federation/portable-inbox.test.mjs +430 -5
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +44 -3
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-DzMdu4zU.cjs → federation-c-ulWHXG.cjs} +2358 -405
- package/dist/{http-EoFzzh1s.js → http-C12QVNZt.js} +62 -32
- package/dist/{http-BdTJujR0.cjs → http-DwL_g670.cjs} +62 -32
- package/dist/{http-TgeyuTDM.mjs → http-NYqvoigN.mjs} +64 -34
- package/dist/{inbox-ChkbRxCN.mjs → inbox-CkL5YgHZ.mjs} +90 -3
- package/dist/{inbox-view-BosBZdlt.mjs → inbox-view-IJCZG0_b.mjs} +1 -1
- package/dist/{key-DbLNT-vA.d.ts → key-dwwAg5bA.d.ts} +1 -1
- package/dist/{kv-cache-CMgOYiLU.js → kv-cache-1BO1Deou.js} +1 -1
- package/dist/{kv-cache-CTA2i08a.mjs → kv-cache-BdFnnrOU.mjs} +1 -1
- package/dist/{kv-cache-B0o18_Ni.cjs → kv-cache-CcGUsFoZ.cjs} +1 -1
- package/dist/{ld-CZsMAfOw.mjs → ld-CEOS8Pho.mjs} +2 -2
- package/dist/{ld-Inagww4R.d.ts → ld-o4LnhCYY.d.ts} +2 -2
- package/dist/{metrics-Kc9mP1LD.mjs → metrics-CvuJeWaJ.mjs} +1 -1
- package/dist/{metrics-DoRtI0qU.d.ts → metrics-DVKYY6K1.d.ts} +1 -1
- package/dist/{middleware-C1coPz8l.mjs → middleware-BPZ9KhAd.mjs} +1 -1
- package/dist/{middleware-B-pjIvQ8.js → middleware-CzcR7pNr.js} +2303 -351
- package/dist/{middleware-CIRoIVSU.mjs → middleware-DMrpt2wD.mjs} +1573 -325
- package/dist/{mod-B7j30IQf.d.ts → mod-CQC9xlLZ.d.ts} +3 -3
- package/dist/{mod-B4kBw1-8.d.ts → mod-D22ZsiKi.d.ts} +2 -2
- package/dist/{mod-BN0TTfyQ.d.ts → mod-DO0epJGH.d.ts} +1 -1
- package/dist/{mod-DF2gbN_d.d.cts → mod-TwiQgEf3.d.cts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +4 -4
- package/dist/mod.d.ts +8 -8
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/outbound-body-CckPA5gc.mjs +83 -0
- package/dist/outbound-capture-DVgnRzlf.mjs +184 -0
- package/dist/outbound-document-BMgwLXTY.mjs +179 -0
- package/dist/{owner-Dwz4fGUW.mjs → owner-BOyHaAlU.mjs} +3 -3
- package/dist/{portable-collection-BikiijSk.js → portable-collection-B4HFXlgN.js} +2 -2
- package/dist/{portable-collection-Oxfavx8f.mjs → portable-collection-BBSMcaDY.mjs} +2 -2
- package/dist/{portable-collection-Ci6vIhbR.cjs → portable-collection-D_zZTK4C.cjs} +2 -2
- package/dist/{portable-key--fWpTNDN.mjs → portable-key-CF8xK_lj.mjs} +1 -1
- package/dist/{proof-D6Kb0Qq9.mjs → proof-VrE-GaGv.mjs} +3 -3
- package/dist/{send-BFti0L3I.mjs → send-CY6agn9T.mjs} +153 -40
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +38 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +1 -1
- package/dist/sig/mitra-receive-interop.test.mjs +4 -4
- package/dist/sig/mitra-send-interop.test.mjs +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +5 -5
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/sig/tootik-request-interop.test.mjs +4 -4
- package/dist/sig/tootik-send-interop.test.mjs +3 -3
- package/dist/sig/verification.test.mjs +3 -3
- package/dist/{temporal-DlYL_raW.mjs → temporal-QO2pe6W4.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +1030 -412
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
- package/skills/fedify/SKILL.md +60 -1
|
@@ -2,7 +2,9 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { i as getPortableDid, l as isPortableId, n as getCanonicalPortableId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
+
import { n as version, t as name } from "./deno-CaPDSXDl.mjs";
|
|
6
|
+
import { n as snapshotSenderPayloadOption } from "./outbound-document-BMgwLXTY.mjs";
|
|
7
|
+
import { n as snapshotBodyCapture } from "./outbound-capture-DVgnRzlf.mjs";
|
|
6
8
|
import { t as ActivityListenerSet } from "./activity-listener-CELFAodc.mjs";
|
|
7
9
|
import { getLogger } from "@logtape/logtape";
|
|
8
10
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
@@ -10,6 +12,68 @@ import { Tombstone, getTypeId } from "@fedify/vocab";
|
|
|
10
12
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
13
|
import { fromCompatibleEf61Id, isGatewayUrl } from "@fedify/vocab-runtime";
|
|
12
14
|
import { isCompatibleEf61Iri } from "@fedify/vocab-runtime/internal/portable-dereference";
|
|
15
|
+
//#region src/federation/outbound-headers.ts
|
|
16
|
+
const protectedHeaders = /* @__PURE__ */ new Set([
|
|
17
|
+
"authorization",
|
|
18
|
+
"proxy-authorization",
|
|
19
|
+
"cookie",
|
|
20
|
+
"set-cookie",
|
|
21
|
+
"signature",
|
|
22
|
+
"signature-input",
|
|
23
|
+
"authentication-info",
|
|
24
|
+
"proxy-authentication-info",
|
|
25
|
+
"x-api-key",
|
|
26
|
+
"x-auth-token"
|
|
27
|
+
]);
|
|
28
|
+
function snapshotNames(names) {
|
|
29
|
+
if (!Array.isArray(names)) throw new TypeError("Outbound header names must be an array.");
|
|
30
|
+
const normalized = /* @__PURE__ */ new Set();
|
|
31
|
+
for (const name of names) {
|
|
32
|
+
if (typeof name !== "string" || !/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name) || name.includes("*")) throw new TypeError("Outbound header names must be literal HTTP tokens.");
|
|
33
|
+
normalized.add(name.toLowerCase());
|
|
34
|
+
}
|
|
35
|
+
return Object.freeze([...normalized].sort());
|
|
36
|
+
}
|
|
37
|
+
/** Validate/copy policy before registration replaces the selected observers. */
|
|
38
|
+
function snapshotHeaderPolicy(policy) {
|
|
39
|
+
if (policy === void 0) return void 0;
|
|
40
|
+
if (policy == null || typeof policy !== "object") throw new TypeError("Outbound header policy must be an object.");
|
|
41
|
+
const { allow, redact, maxBytes } = policy;
|
|
42
|
+
if (typeof maxBytes !== "number") throw new TypeError("Outbound header maxBytes must be a number.");
|
|
43
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes <= 0) throw new RangeError("Outbound header maxBytes must be a positive safe integer.");
|
|
44
|
+
return Object.freeze({
|
|
45
|
+
allow: snapshotNames(allow),
|
|
46
|
+
...redact === void 0 ? {} : { redact: snapshotNames(redact) },
|
|
47
|
+
maxBytes
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Copy only selected/redacted entries; budgets never truncate a header value. */
|
|
51
|
+
function snapshotHeaders(headers, policy) {
|
|
52
|
+
const redact = /* @__PURE__ */ new Set([...protectedHeaders, ...policy.redact ?? []]);
|
|
53
|
+
const entries = [];
|
|
54
|
+
const encoder = new TextEncoder();
|
|
55
|
+
let bytes = 0;
|
|
56
|
+
let limitReached = false;
|
|
57
|
+
for (const name of policy.allow) {
|
|
58
|
+
if (!headers.has(name)) continue;
|
|
59
|
+
for (const [key, rawValue] of headers) {
|
|
60
|
+
if (key !== name) continue;
|
|
61
|
+
const value = redact.has(name) ? "[redacted]" : rawValue;
|
|
62
|
+
const size = encoder.encode(`${name}: ${value}\r\n`).byteLength;
|
|
63
|
+
if (size > policy.maxBytes - bytes) {
|
|
64
|
+
limitReached = true;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
entries.push(Object.freeze([name, value]));
|
|
68
|
+
bytes += size;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return Object.freeze({
|
|
72
|
+
entries: Object.freeze(entries),
|
|
73
|
+
limitReached
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
13
77
|
//#region src/federation/builder.ts
|
|
14
78
|
const ACTOR_ALIAS_PREFIX = "actorAlias:";
|
|
15
79
|
/**
|
|
@@ -56,6 +120,7 @@ var FederationBuilderImpl = class {
|
|
|
56
120
|
inboxListeners;
|
|
57
121
|
outboxListeners;
|
|
58
122
|
inboxRequestFinishedHandler;
|
|
123
|
+
outboundObservers = globalThis.Object.freeze({});
|
|
59
124
|
inboxErrorHandler;
|
|
60
125
|
outboxListenerErrorHandler;
|
|
61
126
|
outboxAuthorizePredicate;
|
|
@@ -91,7 +156,7 @@ var FederationBuilderImpl = class {
|
|
|
91
156
|
* specified.
|
|
92
157
|
*/
|
|
93
158
|
async build(options) {
|
|
94
|
-
const { FederationImpl } = await import("./middleware-
|
|
159
|
+
const { FederationImpl } = await import("./middleware-BPZ9KhAd.mjs");
|
|
95
160
|
const f = new FederationImpl(options);
|
|
96
161
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
97
162
|
f.router = this.router.clone();
|
|
@@ -118,6 +183,7 @@ var FederationBuilderImpl = class {
|
|
|
118
183
|
f.inboxListeners = this.inboxListeners?.clone();
|
|
119
184
|
f.outboxListeners = this.outboxListeners?.clone();
|
|
120
185
|
f.inboxRequestFinishedHandler = this.inboxRequestFinishedHandler;
|
|
186
|
+
f.setOutboundObservers(this.outboundObservers);
|
|
121
187
|
f.inboxErrorHandler = this.inboxErrorHandler;
|
|
122
188
|
f.outboxListenerErrorHandler = this.outboxListenerErrorHandler;
|
|
123
189
|
f.outboxAuthorizePredicate = this.outboxAuthorizePredicate;
|
|
@@ -265,6 +331,19 @@ var FederationBuilderImpl = class {
|
|
|
265
331
|
};
|
|
266
332
|
return setters;
|
|
267
333
|
}
|
|
334
|
+
setOutboundObservers(observers) {
|
|
335
|
+
this.outboundObservers = globalThis.Object.freeze({
|
|
336
|
+
senderPayload: snapshotSenderPayloadOption(observers.senderPayload),
|
|
337
|
+
responseBodyCapture: snapshotBodyCapture(observers.responseBodyCapture),
|
|
338
|
+
requestHeaders: snapshotHeaderPolicy(observers.requestHeaders),
|
|
339
|
+
responseHeaders: snapshotHeaderPolicy(observers.responseHeaders),
|
|
340
|
+
onBroadcast: observers.onBroadcast,
|
|
341
|
+
onDelivery: observers.onDelivery,
|
|
342
|
+
onAttempt: observers.onAttempt,
|
|
343
|
+
onHttpExchange: observers.onHttpExchange,
|
|
344
|
+
onWorker: observers.onWorker
|
|
345
|
+
});
|
|
346
|
+
}
|
|
268
347
|
setNodeInfoDispatcher(path, dispatcher) {
|
|
269
348
|
if (this.router.has("nodeInfo")) throw new RouterError("NodeInfo dispatcher already set.");
|
|
270
349
|
if (Router.variables(path).size !== 0) throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
|
|
@@ -829,4 +908,4 @@ function warnCompatibleActorId(actorId, gateway) {
|
|
|
829
908
|
});
|
|
830
909
|
}
|
|
831
910
|
//#endregion
|
|
832
|
-
export { FederationBuilderImpl as n, createFederationBuilder as r, ACTOR_ALIAS_PREFIX as t };
|
|
911
|
+
export { snapshotHeaders as a, snapshotHeaderPolicy as i, FederationBuilderImpl as n, createFederationBuilder as r, ACTOR_ALIAS_PREFIX as t };
|
package/dist/compat/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { in as ActivityTransformer, n as Context } from "../context-
|
|
2
|
+
import { in as ActivityTransformer, n as Context } from "../context-C1NqcIct.cjs";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
package/dist/compat/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { in as ActivityTransformer, n as Context } from "../context-
|
|
2
|
+
import { in as ActivityTransformer, n as Context } from "../context-xrqq4Hrq.js";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
|
@@ -5,7 +5,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
6
6
|
import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
7
7
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
8
|
-
import { O as actorDehydrator, k as autoIdAssigner, n as FederationImpl } from "../middleware-
|
|
8
|
+
import { O as actorDehydrator, k as autoIdAssigner, n as FederationImpl } from "../middleware-DMrpt2wD.mjs";
|
|
9
9
|
import { Follow, Person } from "@fedify/vocab";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
11
11
|
//#region src/compat/transformers.test.ts
|
|
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { a as getRawCanonicalPortableId, l as isPortableId, n as getCanonicalPortableId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
5
|
import { a as verificationObservation, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
|
|
6
|
-
import { c as getNormalizationContextLoader } from "./ld-
|
|
6
|
+
import { c as getNormalizationContextLoader } from "./ld-CEOS8Pho.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience--klBIOk1.mjs";
|
|
8
|
-
import { c as verifyMapLocalProof, f as verifyPortableObjectProofPolicy, m as verifyPreparedPortableObjectProofPolicy, n as classifyFep2277CoreType, o as preparePortableObjectProofPolicy } from "./proof-
|
|
8
|
+
import { c as verifyMapLocalProof, f as verifyPortableObjectProofPolicy, m as verifyPreparedPortableObjectProofPolicy, n as classifyFep2277CoreType, o as preparePortableObjectProofPolicy } from "./proof-VrE-GaGv.mjs";
|
|
9
9
|
import { parseIri, preloadedContexts } from "@fedify/vocab-runtime";
|
|
10
10
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
11
11
|
//#region src/sig/compound-proof.ts
|