@fedify/fedify 2.5.0-dev.2687 → 2.5.0-dev.2710
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/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/{federation-pFFwPyoZ.cjs → federation-JvzYDx0P.cjs} +3 -3
- package/dist/{http-CXX-QPzs.cjs → http-BG5cDmTS.cjs} +1 -1
- package/dist/{http-T7h9GBAN.js → http-MUf125Jc.js} +1 -1
- package/dist/{kv-cache-C6XX_fwz.cjs → kv-cache-A2po7h0_.cjs} +1 -1
- package/dist/{kv-cache-EFcb1kkU.js → kv-cache-CbWc1BZA.js} +1 -1
- package/dist/{middleware-Bj91r7r2.js → middleware-DzzdJ7Wz.js} +3 -3
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/{portable-collection-Do5QA2oy.js → portable-collection-CAer9RWN.js} +1 -1
- package/dist/{portable-collection-BOl9oKrt.cjs → portable-collection-d8w7TCn9.cjs} +1 -1
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +22 -9
- package/skills/fedify/SKILL.md +10 -0
- package/dist/accept-CPVqki78.mjs +0 -145
- package/dist/activity-listener-CELFAodc.mjs +0 -44
- package/dist/assert-D1Eafmd_.mjs +0 -23
- package/dist/assert_equals-Z6IcEbWU.mjs +0 -987
- package/dist/assert_exists-cffSpJ7X.mjs +0 -28
- package/dist/assert_false-CPdRnc3E.mjs +0 -23
- package/dist/assert_greater_or_equal-BlafOF4-.mjs +0 -31
- package/dist/assert_instance_of-mrXWWNY-.mjs +0 -37
- package/dist/assert_not_equals-CpPK2t89.mjs +0 -30
- package/dist/assert_rejects-CTptdYck.mjs +0 -39
- package/dist/assert_strict_equals-CYvBmkpC.mjs +0 -42
- package/dist/assert_throws-BYITOvPO.mjs +0 -74
- package/dist/assertion_error-B-cx0fFA.mjs +0 -31
- package/dist/audience-CHQ-FlLD.mjs +0 -95
- package/dist/builder-D1FP_5nQ.mjs +0 -911
- package/dist/circuit-breaker-XJ53md4S.mjs +0 -544
- package/dist/circuit-breaker-test-utils-DW6YC_Pe.mjs +0 -14
- package/dist/client-5SIFzW3q.mjs +0 -441
- package/dist/codec-C6rTrpIp.mjs +0 -147
- package/dist/collection-CnnP1UAv.mjs +0 -44
- package/dist/compat/outgoing-jsonld.test.d.mts +0 -2
- package/dist/compat/outgoing-jsonld.test.mjs +0 -257
- package/dist/compat/public-audience.test.d.mts +0 -2
- package/dist/compat/public-audience.test.mjs +0 -187
- package/dist/compat/secured-document.test.d.mts +0 -2
- package/dist/compat/secured-document.test.mjs +0 -58
- package/dist/compat/transformers.test.d.mts +0 -2
- package/dist/compat/transformers.test.mjs +0 -62
- package/dist/compound-proof-DSHhnOEW.mjs +0 -1019
- package/dist/context-LgGFFSz7.mjs +0 -146
- package/dist/deno-C50ikGBU.mjs +0 -8
- package/dist/dist-_geWsuaI.mjs +0 -189
- package/dist/docloader-BY-SEID0.mjs +0 -136
- package/dist/esm-BHXXx4Wx.mjs +0 -1233
- package/dist/exporter-DVG68ozH.mjs +0 -263
- package/dist/federation/audience.test.d.mts +0 -2
- package/dist/federation/audience.test.mjs +0 -130
- package/dist/federation/builder.test.d.mts +0 -2
- package/dist/federation/builder.test.mjs +0 -396
- package/dist/federation/circuit-breaker.test.d.mts +0 -2
- package/dist/federation/circuit-breaker.test.mjs +0 -1277
- package/dist/federation/collection.test.d.mts +0 -2
- package/dist/federation/collection.test.mjs +0 -21
- package/dist/federation/compound-fanout.test.d.mts +0 -2
- package/dist/federation/compound-fanout.test.mjs +0 -231
- package/dist/federation/handler-compound-proof.test.d.mts +0 -2
- package/dist/federation/handler-compound-proof.test.mjs +0 -384
- package/dist/federation/handler.test.d.mts +0 -2
- package/dist/federation/handler.test.mjs +0 -5445
- package/dist/federation/hashlink-media.test.d.mts +0 -2
- package/dist/federation/hashlink-media.test.mjs +0 -422
- package/dist/federation/idempotency.test.d.mts +0 -2
- package/dist/federation/idempotency.test.mjs +0 -207
- package/dist/federation/inbox-actorless.test.d.mts +0 -2
- package/dist/federation/inbox-actorless.test.mjs +0 -522
- package/dist/federation/inbox-authentication.test.d.mts +0 -2
- package/dist/federation/inbox-authentication.test.mjs +0 -220
- package/dist/federation/inbox-report.test.d.mts +0 -2
- package/dist/federation/inbox-report.test.mjs +0 -719
- package/dist/federation/inbox-view.test.d.mts +0 -2
- package/dist/federation/inbox-view.test.mjs +0 -369
- package/dist/federation/inbox.test.d.mts +0 -2
- package/dist/federation/inbox.test.mjs +0 -139
- package/dist/federation/keycache.test.d.mts +0 -2
- package/dist/federation/keycache.test.mjs +0 -337
- package/dist/federation/kv.test.d.mts +0 -2
- package/dist/federation/kv.test.mjs +0 -88
- package/dist/federation/metrics.test.d.mts +0 -2
- package/dist/federation/metrics.test.mjs +0 -634
- package/dist/federation/middleware.test.d.mts +0 -2
- package/dist/federation/middleware.test.mjs +0 -9314
- package/dist/federation/mq.test.d.mts +0 -2
- package/dist/federation/mq.test.mjs +0 -591
- package/dist/federation/negotiation.test.d.mts +0 -2
- package/dist/federation/negotiation.test.mjs +0 -18
- package/dist/federation/outbound-body.test.d.mts +0 -2
- package/dist/federation/outbound-body.test.mjs +0 -149
- package/dist/federation/outbound-capture.test.d.mts +0 -2
- package/dist/federation/outbound-capture.test.mjs +0 -394
- package/dist/federation/outbound-dispatch.test.d.mts +0 -2
- package/dist/federation/outbound-dispatch.test.mjs +0 -368
- package/dist/federation/outbound-document.test.d.mts +0 -2
- package/dist/federation/outbound-document.test.mjs +0 -171
- package/dist/federation/outbound-provenance.test.d.mts +0 -2
- package/dist/federation/outbound-provenance.test.mjs +0 -543
- package/dist/federation/outbound-report.test.d.mts +0 -2
- package/dist/federation/outbound-report.test.mjs +0 -5475
- package/dist/federation/outbound-workers.test.d.mts +0 -2
- package/dist/federation/outbound-workers.test.mjs +0 -64
- package/dist/federation/outbound-workflow.test.d.mts +0 -2
- package/dist/federation/outbound-workflow.test.mjs +0 -154
- package/dist/federation/outgoing-proof.test.d.mts +0 -2
- package/dist/federation/outgoing-proof.test.mjs +0 -933
- package/dist/federation/portable-actor.test.d.mts +0 -2
- package/dist/federation/portable-actor.test.mjs +0 -496
- package/dist/federation/portable-chain.test.d.mts +0 -2
- package/dist/federation/portable-chain.test.mjs +0 -370
- package/dist/federation/portable-collection.test.d.mts +0 -2
- package/dist/federation/portable-collection.test.mjs +0 -832
- package/dist/federation/portable-delivery.test.d.mts +0 -2
- package/dist/federation/portable-delivery.test.mjs +0 -845
- package/dist/federation/portable-gateway-keys.test.d.mts +0 -2
- package/dist/federation/portable-gateway-keys.test.mjs +0 -692
- package/dist/federation/portable-inbox.test.d.mts +0 -2
- package/dist/federation/portable-inbox.test.mjs +0 -1960
- package/dist/federation/portable-parse-uri.test.d.mts +0 -2
- package/dist/federation/portable-parse-uri.test.mjs +0 -348
- package/dist/federation/portable-route-activity.test.d.mts +0 -2
- package/dist/federation/portable-route-activity.test.mjs +0 -259
- package/dist/federation/portable.test.d.mts +0 -2
- package/dist/federation/portable.test.mjs +0 -1072
- package/dist/federation/retry.test.d.mts +0 -2
- package/dist/federation/retry.test.mjs +0 -42
- package/dist/federation/router.test.d.mts +0 -2
- package/dist/federation/router.test.mjs +0 -123
- package/dist/federation/send.test.d.mts +0 -2
- package/dist/federation/send.test.mjs +0 -1421
- package/dist/federation/tasks/codec.test.d.mts +0 -2
- package/dist/federation/tasks/codec.test.mjs +0 -302
- package/dist/federation/tasks/enqueue.test.d.mts +0 -2
- package/dist/federation/tasks/enqueue.test.mjs +0 -1095
- package/dist/federation/tasks/tasks.test.d.mts +0 -2
- package/dist/federation/tasks/tasks.test.mjs +0 -1229
- package/dist/federation/temporal.test.d.mts +0 -2
- package/dist/federation/temporal.test.mjs +0 -71
- package/dist/federation/webfinger.test.d.mts +0 -2
- package/dist/federation/webfinger.test.mjs +0 -944
- package/dist/http-BXbQQZDM.mjs +0 -1449
- package/dist/inbox-authentication-CgonVRkg.mjs +0 -198
- package/dist/inbox-cS97XzOD.mjs +0 -399
- package/dist/inbox-view-D-d0Ar6o.mjs +0 -385
- package/dist/key-owner-evidence-APB6NpSk.mjs +0 -108
- package/dist/keycache-N2opu4-3.mjs +0 -221
- package/dist/keys-DIJNHW-Y.mjs +0 -120
- package/dist/kv-DBRWVx3Q.mjs +0 -104
- package/dist/kv-DCHkaJ9-.mjs +0 -92
- package/dist/kv-cache-fgbLHGVL.mjs +0 -121
- package/dist/ld-BpkhkDGj.mjs +0 -1752
- package/dist/map-local-context-conflict-DOYEEJ3u.mjs +0 -204
- package/dist/map-local-create-note-B0SeXJms.mjs +0 -214
- package/dist/metrics-Uqf8GomB.mjs +0 -818
- package/dist/middleware-DcXzz-YK.mjs +0 -9971
- package/dist/middleware-DgwZkvJR.mjs +0 -5
- package/dist/mq-eF96QxUT.mjs +0 -288
- package/dist/negotiation-BAKO9nih.mjs +0 -96
- package/dist/nodeinfo/client.test.d.mts +0 -2
- package/dist/nodeinfo/client.test.mjs +0 -1364
- package/dist/nodeinfo/handler.test.d.mts +0 -2
- package/dist/nodeinfo/handler.test.mjs +0 -94
- package/dist/nodeinfo/types.test.d.mts +0 -2
- package/dist/nodeinfo/types.test.mjs +0 -192
- package/dist/otel/exporter.test.d.mts +0 -2
- package/dist/otel/exporter.test.mjs +0 -887
- package/dist/outbound-body-CckPA5gc.mjs +0 -83
- package/dist/outbound-capture-DVgnRzlf.mjs +0 -184
- package/dist/outbound-document-BMgwLXTY.mjs +0 -179
- package/dist/outgoing-jsonld-4IJqPYos.mjs +0 -205
- package/dist/owner-BVenIFg1.mjs +0 -267
- package/dist/portable-collection-DIk9gpjL.mjs +0 -418
- package/dist/portable-key-C7pVaHNR.mjs +0 -549
- package/dist/portable-key-id-Ca30-hOa.mjs +0 -248
- package/dist/proof-BlfZ95--.mjs +0 -1420
- package/dist/public-audience--klBIOk1.mjs +0 -197
- package/dist/retry-zX5xw5e0.mjs +0 -34
- package/dist/router-u5O5KCQr.mjs +0 -156
- package/dist/secured-document-CxzZZ9nL.mjs +0 -35
- package/dist/send-DEGHPGFk.mjs +0 -710
- package/dist/sig/accept.test.d.mts +0 -2
- package/dist/sig/accept.test.mjs +0 -416
- package/dist/sig/compound-proof-discovery.test.d.mts +0 -2
- package/dist/sig/compound-proof-discovery.test.mjs +0 -331
- package/dist/sig/compound-proof-producer.test.d.mts +0 -2
- package/dist/sig/compound-proof-producer.test.mjs +0 -107
- package/dist/sig/compound-proof-verification.test.d.mts +0 -2
- package/dist/sig/compound-proof-verification.test.mjs +0 -1017
- package/dist/sig/compound-proof.test.d.mts +0 -2
- package/dist/sig/compound-proof.test.mjs +0 -411
- package/dist/sig/http.test.d.mts +0 -2
- package/dist/sig/http.test.mjs +0 -3328
- package/dist/sig/key-owner-evidence.test.d.mts +0 -2
- package/dist/sig/key-owner-evidence.test.mjs +0 -100
- package/dist/sig/key.test.d.mts +0 -2
- package/dist/sig/key.test.mjs +0 -1250
- package/dist/sig/ld.test.d.mts +0 -2
- package/dist/sig/ld.test.mjs +0 -1044
- package/dist/sig/mitra-receive-interop.test.d.mts +0 -2
- package/dist/sig/mitra-receive-interop.test.mjs +0 -260
- package/dist/sig/mitra-send-interop.test.d.mts +0 -2
- package/dist/sig/mitra-send-interop.test.mjs +0 -461
- package/dist/sig/owner.test.d.mts +0 -2
- package/dist/sig/owner.test.mjs +0 -202
- package/dist/sig/portable-collection.test.d.mts +0 -2
- package/dist/sig/portable-collection.test.mjs +0 -697
- package/dist/sig/portable-interop.test.d.mts +0 -2
- package/dist/sig/portable-interop.test.mjs +0 -156
- package/dist/sig/portable-key-id.test.d.mts +0 -2
- package/dist/sig/portable-key-id.test.mjs +0 -67
- package/dist/sig/portable-key.test.d.mts +0 -2
- package/dist/sig/portable-key.test.mjs +0 -1438
- package/dist/sig/proof.test.d.mts +0 -2
- package/dist/sig/proof.test.mjs +0 -2638
- package/dist/sig/tootik-request-interop.test.d.mts +0 -2
- package/dist/sig/tootik-request-interop.test.mjs +0 -190
- package/dist/sig/tootik-send-interop.test.d.mts +0 -2
- package/dist/sig/tootik-send-interop.test.mjs +0 -331
- package/dist/sig/verification.test.d.mts +0 -2
- package/dist/sig/verification.test.mjs +0 -310
- package/dist/std__assert-DvMDRPes.mjs +0 -8
- package/dist/tasks-BCUmQbbz.mjs +0 -77
- package/dist/temporal-B4oQ8HpW.mjs +0 -95
- package/dist/testing/context.test.d.mts +0 -2
- package/dist/testing/context.test.mjs +0 -19
- package/dist/testing/kv.test.d.mts +0 -2
- package/dist/testing/kv.test.mjs +0 -101
- package/dist/testing/mod.d.mts +0 -6099
- package/dist/testing/mod.mjs +0 -9
- package/dist/testing-vrnD5Uaa.mjs +0 -8
- package/dist/types-DE_LV1JB.mjs +0 -46
- package/dist/utils/docloader.test.d.mts +0 -2
- package/dist/utils/docloader.test.mjs +0 -1076
- package/dist/utils/kv-cache.test.d.mts +0 -2
- package/dist/utils/kv-cache.test.mjs +0 -261
- package/dist/verification-C3954hQh.mjs +0 -5
- package/dist/verification-Dpfcw8ml.mjs +0 -105
- package/dist/vocab/cjs.test.d.mts +0 -2
- package/dist/vocab/cjs.test.mjs +0 -27
|
@@ -1,911 +0,0 @@
|
|
|
1
|
-
import "temporal-polyfill";
|
|
2
|
-
import "urlpattern-polyfill";
|
|
3
|
-
globalThis.addEventListener = () => {};
|
|
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-C50ikGBU.mjs";
|
|
6
|
-
import { n as snapshotSenderPayloadOption } from "./outbound-document-BMgwLXTY.mjs";
|
|
7
|
-
import { n as snapshotBodyCapture } from "./outbound-capture-DVgnRzlf.mjs";
|
|
8
|
-
import { t as ActivityListenerSet } from "./activity-listener-CELFAodc.mjs";
|
|
9
|
-
import { getLogger } from "@logtape/logtape";
|
|
10
|
-
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
11
|
-
import { Tombstone, getTypeId } from "@fedify/vocab";
|
|
12
|
-
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
13
|
-
import { fromCompatibleEf61Id, isGatewayUrl } from "@fedify/vocab-runtime";
|
|
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
|
|
77
|
-
//#region src/federation/builder.ts
|
|
78
|
-
const ACTOR_ALIAS_PREFIX = "actorAlias:";
|
|
79
|
-
/**
|
|
80
|
-
* Route options shared by every dispatcher whose path must expose exactly
|
|
81
|
-
* one `{identifier}` variable bound to a single, non-empty value
|
|
82
|
-
* for `setOutboxDispatcher/Listener()`.
|
|
83
|
-
*/
|
|
84
|
-
const identifierSingular = {
|
|
85
|
-
exact: true,
|
|
86
|
-
variables: { identifier: { operatables: [""] } }
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Route options shared by every dispatcher whose path must expose
|
|
90
|
-
* `{identifier}` and `{+identifier}` variables bound to the same single,
|
|
91
|
-
* non-empty value for following setters:
|
|
92
|
-
* - `setActorDispatcher()` (actor path)
|
|
93
|
-
* - `setInboxDispatcher/Listener()` (inbox path)
|
|
94
|
-
* - `setFollowingDispatcher()` (following path)
|
|
95
|
-
* - `setFollowersDispatcher()` (followers path)
|
|
96
|
-
* - `setLikedDispatcher()` (liked path)
|
|
97
|
-
* - `setFeaturedDispatcher()` (featured path)
|
|
98
|
-
* - `setFeaturedTagsDispatcher()` (featured tags path)
|
|
99
|
-
*/
|
|
100
|
-
const identifierSingularAllowPlus = {
|
|
101
|
-
exact: true,
|
|
102
|
-
variables: { identifier: { operatables: ["", "+"] } }
|
|
103
|
-
};
|
|
104
|
-
var FederationBuilderImpl = class {
|
|
105
|
-
router;
|
|
106
|
-
actorCallbacks;
|
|
107
|
-
nodeInfoDispatcher;
|
|
108
|
-
webFingerLinksDispatcher;
|
|
109
|
-
objectCallbacks;
|
|
110
|
-
objectTypeIds;
|
|
111
|
-
inboxPath;
|
|
112
|
-
outboxPath;
|
|
113
|
-
inboxCallbacks;
|
|
114
|
-
outboxCallbacks;
|
|
115
|
-
followingCallbacks;
|
|
116
|
-
followersCallbacks;
|
|
117
|
-
likedCallbacks;
|
|
118
|
-
featuredCallbacks;
|
|
119
|
-
featuredTagsCallbacks;
|
|
120
|
-
inboxListeners;
|
|
121
|
-
outboxListeners;
|
|
122
|
-
inboxRequestFinishedHandler;
|
|
123
|
-
outboundObservers = globalThis.Object.freeze({});
|
|
124
|
-
inboxErrorHandler;
|
|
125
|
-
outboxListenerErrorHandler;
|
|
126
|
-
outboxAuthorizePredicate;
|
|
127
|
-
mediaUploaderPath;
|
|
128
|
-
mediaUploaderCallback;
|
|
129
|
-
mediaUploaderAuthorizePredicate;
|
|
130
|
-
hashlinkMediaDispatcher;
|
|
131
|
-
sharedInboxKeyDispatcher;
|
|
132
|
-
unverifiedActivityHandler;
|
|
133
|
-
outboxPermanentFailureHandler;
|
|
134
|
-
idempotencyStrategy;
|
|
135
|
-
collectionTypeIds;
|
|
136
|
-
collectionCallbacks;
|
|
137
|
-
taskDefinitions;
|
|
138
|
-
/**
|
|
139
|
-
* Symbol registry for unique identification of unnamed symbols.
|
|
140
|
-
*/
|
|
141
|
-
#symbolRegistry = /* @__PURE__ */ new Map();
|
|
142
|
-
#collectionNames = /* @__PURE__ */ new Map();
|
|
143
|
-
constructor() {
|
|
144
|
-
this.router = new Router();
|
|
145
|
-
this.objectCallbacks = {};
|
|
146
|
-
this.objectTypeIds = {};
|
|
147
|
-
this.collectionCallbacks = {};
|
|
148
|
-
this.collectionTypeIds = {};
|
|
149
|
-
this.taskDefinitions = /* @__PURE__ */ new Map();
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Builds the federation object.
|
|
153
|
-
* @param options Parameters for initializing the federation object.
|
|
154
|
-
* @returns The federation object.
|
|
155
|
-
* @throws {TypeError} If benchmark mode and `meterProvider` are both
|
|
156
|
-
* specified.
|
|
157
|
-
*/
|
|
158
|
-
async build(options) {
|
|
159
|
-
const { FederationImpl } = await import("./middleware-DgwZkvJR.mjs");
|
|
160
|
-
const f = new FederationImpl(options);
|
|
161
|
-
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
162
|
-
f.router = this.router.clone();
|
|
163
|
-
f.router.trailingSlashInsensitive = trailingSlashInsensitiveValue;
|
|
164
|
-
f._initializeRouter();
|
|
165
|
-
f.actorCallbacks = this.actorCallbacks == null ? void 0 : { ...this.actorCallbacks };
|
|
166
|
-
f.nodeInfoDispatcher = this.nodeInfoDispatcher;
|
|
167
|
-
f.webFingerLinksDispatcher = this.webFingerLinksDispatcher;
|
|
168
|
-
f.objectCallbacks = { ...this.objectCallbacks };
|
|
169
|
-
f.objectTypeIds = { ...this.objectTypeIds };
|
|
170
|
-
f.collectionCallbacks = { ...this.collectionCallbacks };
|
|
171
|
-
f.collectionTypeIds = { ...this.collectionTypeIds };
|
|
172
|
-
f.#symbolRegistry = new Map(this.#symbolRegistry);
|
|
173
|
-
f.#collectionNames = new Map(this.#collectionNames);
|
|
174
|
-
f.inboxPath = this.inboxPath;
|
|
175
|
-
f.outboxPath = this.outboxPath;
|
|
176
|
-
f.inboxCallbacks = this.inboxCallbacks == null ? void 0 : { ...this.inboxCallbacks };
|
|
177
|
-
f.outboxCallbacks = this.outboxCallbacks == null ? void 0 : { ...this.outboxCallbacks };
|
|
178
|
-
f.followingCallbacks = this.followingCallbacks == null ? void 0 : { ...this.followingCallbacks };
|
|
179
|
-
f.followersCallbacks = this.followersCallbacks == null ? void 0 : { ...this.followersCallbacks };
|
|
180
|
-
f.likedCallbacks = this.likedCallbacks == null ? void 0 : { ...this.likedCallbacks };
|
|
181
|
-
f.featuredCallbacks = this.featuredCallbacks == null ? void 0 : { ...this.featuredCallbacks };
|
|
182
|
-
f.featuredTagsCallbacks = this.featuredTagsCallbacks == null ? void 0 : { ...this.featuredTagsCallbacks };
|
|
183
|
-
f.inboxListeners = this.inboxListeners?.clone();
|
|
184
|
-
f.outboxListeners = this.outboxListeners?.clone();
|
|
185
|
-
f.inboxRequestFinishedHandler = this.inboxRequestFinishedHandler;
|
|
186
|
-
f.setOutboundObservers(this.outboundObservers);
|
|
187
|
-
f.inboxErrorHandler = this.inboxErrorHandler;
|
|
188
|
-
f.outboxListenerErrorHandler = this.outboxListenerErrorHandler;
|
|
189
|
-
f.outboxAuthorizePredicate = this.outboxAuthorizePredicate;
|
|
190
|
-
f.mediaUploaderPath = this.mediaUploaderPath;
|
|
191
|
-
f.mediaUploaderCallback = this.mediaUploaderCallback;
|
|
192
|
-
f.mediaUploaderAuthorizePredicate = this.mediaUploaderAuthorizePredicate;
|
|
193
|
-
f.hashlinkMediaDispatcher = this.hashlinkMediaDispatcher;
|
|
194
|
-
f.sharedInboxKeyDispatcher = this.sharedInboxKeyDispatcher;
|
|
195
|
-
f.unverifiedActivityHandler = this.unverifiedActivityHandler;
|
|
196
|
-
f.outboxPermanentFailureHandler = this.outboxPermanentFailureHandler;
|
|
197
|
-
f.idempotencyStrategy = this.idempotencyStrategy;
|
|
198
|
-
f.taskDefinitions = new Map(this.taskDefinitions);
|
|
199
|
-
return f;
|
|
200
|
-
}
|
|
201
|
-
_getTracer() {
|
|
202
|
-
return trace.getTracer(name, version);
|
|
203
|
-
}
|
|
204
|
-
setActorDispatcher(path, dispatcher) {
|
|
205
|
-
if (this.router.has("actor")) throw new RouterError("Actor dispatcher already set.");
|
|
206
|
-
assertPath(path);
|
|
207
|
-
this.router.add(path, "actor", identifierSingularAllowPlus);
|
|
208
|
-
const callbacks = { dispatcher: async (context, identifier) => {
|
|
209
|
-
const actor = await this._getTracer().startActiveSpan("activitypub.dispatch_actor", {
|
|
210
|
-
kind: SpanKind.SERVER,
|
|
211
|
-
attributes: { "fedify.actor.identifier": identifier }
|
|
212
|
-
}, async (span) => {
|
|
213
|
-
try {
|
|
214
|
-
const actor = await dispatcher(context, identifier);
|
|
215
|
-
span.setAttribute("activitypub.actor.id", (actor?.id ?? context.getActorUri(identifier)).href);
|
|
216
|
-
if (actor == null) span.setStatus({ code: SpanStatusCode.ERROR });
|
|
217
|
-
else span.setAttribute("activitypub.actor.type", getTypeId(actor).href);
|
|
218
|
-
return actor;
|
|
219
|
-
} catch (error) {
|
|
220
|
-
span.setStatus({
|
|
221
|
-
code: SpanStatusCode.ERROR,
|
|
222
|
-
message: String(error)
|
|
223
|
-
});
|
|
224
|
-
throw error;
|
|
225
|
-
} finally {
|
|
226
|
-
span.end();
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
if (actor == null) return null;
|
|
230
|
-
const logger = getLogger([
|
|
231
|
-
"fedify",
|
|
232
|
-
"federation",
|
|
233
|
-
"actor"
|
|
234
|
-
]);
|
|
235
|
-
const portable = actor.id != null && isPortableId(actor.id);
|
|
236
|
-
if (actor.id == null) logger.warn("Actor dispatcher returned an actor without an id property. Set the property with Context.getActorUri(identifier).");
|
|
237
|
-
else if (!portable && actor.id.href != context.getActorUri(identifier).href) logger.warn("Actor dispatcher returned an actor with an id property that does not match the actor URI. Set the property with Context.getActorUri(identifier).");
|
|
238
|
-
if (actor instanceof Tombstone) return actor;
|
|
239
|
-
if (portable && actor.id != null) warnPortableActorGateways(actor.id, actor.gateways);
|
|
240
|
-
if (actor.id != null && isCompatibleEf61Iri(actor.id)) warnCompatibleActorId(actor.id, actor.gateway);
|
|
241
|
-
if (portable) this.#warnPortableCollectionIds(context, identifier, actor);
|
|
242
|
-
if (this.followingCallbacks != null && this.followingCallbacks.dispatcher != null) {
|
|
243
|
-
if (actor.followingId == null) logger.warn("You configured a following collection dispatcher, but the actor does not have a following property. Set the property with Context.getFollowingUri(identifier).");
|
|
244
|
-
else if (!portable && actor.followingId.href != context.getFollowingUri(identifier).href) logger.warn("You configured a following collection dispatcher, but the actor's following property does not match the following collection URI. Set the property with Context.getFollowingUri(identifier).");
|
|
245
|
-
}
|
|
246
|
-
if (this.followersCallbacks != null && this.followersCallbacks.dispatcher != null) {
|
|
247
|
-
if (actor.followersId == null) logger.warn("You configured a followers collection dispatcher, but the actor does not have a followers property. Set the property with Context.getFollowersUri(identifier).");
|
|
248
|
-
else if (!portable && actor.followersId.href != context.getFollowersUri(identifier).href) logger.warn("You configured a followers collection dispatcher, but the actor's followers property does not match the followers collection URI. Set the property with Context.getFollowersUri(identifier).");
|
|
249
|
-
}
|
|
250
|
-
if (this.outboxCallbacks != null && this.outboxCallbacks.dispatcher != null) {
|
|
251
|
-
if (actor?.outboxId == null) logger.warn("You configured an outbox collection dispatcher, but the actor does not have an outbox property. Set the property with Context.getOutboxUri(identifier).");
|
|
252
|
-
else if (!portable && actor.outboxId.href != context.getOutboxUri(identifier).href) logger.warn("You configured an outbox collection dispatcher, but the actor's outbox property does not match the outbox collection URI. Set the property with Context.getOutboxUri(identifier).");
|
|
253
|
-
}
|
|
254
|
-
if (this.likedCallbacks != null && this.likedCallbacks.dispatcher != null) {
|
|
255
|
-
if (actor?.likedId == null) logger.warn("You configured a liked collection dispatcher, but the actor does not have a liked property. Set the property with Context.getLikedUri(identifier).");
|
|
256
|
-
else if (!portable && actor.likedId.href != context.getLikedUri(identifier).href) logger.warn("You configured a liked collection dispatcher, but the actor's liked property does not match the liked collection URI. Set the property with Context.getLikedUri(identifier).");
|
|
257
|
-
}
|
|
258
|
-
if (this.featuredCallbacks != null && this.featuredCallbacks.dispatcher != null) {
|
|
259
|
-
if (actor?.featuredId == null) logger.warn("You configured a featured collection dispatcher, but the actor does not have a featured property. Set the property with Context.getFeaturedUri(identifier).");
|
|
260
|
-
else if (!portable && actor.featuredId.href != context.getFeaturedUri(identifier).href) logger.warn("You configured a featured collection dispatcher, but the actor's featured property does not match the featured collection URI. Set the property with Context.getFeaturedUri(identifier).");
|
|
261
|
-
}
|
|
262
|
-
if (this.featuredTagsCallbacks != null && this.featuredTagsCallbacks.dispatcher != null) {
|
|
263
|
-
if (actor?.featuredTagsId == null) logger.warn("You configured a featured tags collection dispatcher, but the actor does not have a featuredTags property. Set the property with Context.getFeaturedTagsUri(identifier).");
|
|
264
|
-
else if (!portable && actor.featuredTagsId.href != context.getFeaturedTagsUri(identifier).href) logger.warn("You configured a featured tags collection dispatcher, but the actor's featuredTags property does not match the featured tags collection URI. Set the property with Context.getFeaturedTagsUri(identifier).");
|
|
265
|
-
}
|
|
266
|
-
if (this.router.has("inbox")) {
|
|
267
|
-
if (actor.inboxId == null) logger.warn("You configured inbox listeners, but the actor does not have an inbox property. Set the property with Context.getInboxUri(identifier).");
|
|
268
|
-
else if (!portable && actor.inboxId.href != context.getInboxUri(identifier).href) logger.warn("You configured inbox listeners, but the actor's inbox property does not match the inbox URI. Set the property with Context.getInboxUri(identifier).");
|
|
269
|
-
if (actor.endpoints == null || actor.endpoints.sharedInbox == null) logger.warn("You configured inbox listeners, but the actor does not have a endpoints.sharedInbox property. Set the property with Context.getInboxUri().");
|
|
270
|
-
else if (!portable && actor.endpoints.sharedInbox.href != context.getInboxUri().href) logger.warn("You configured inbox listeners, but the actor's endpoints.sharedInbox property does not match the shared inbox URI. Set the property with Context.getInboxUri().");
|
|
271
|
-
}
|
|
272
|
-
if (callbacks.keyPairsDispatcher != null) {
|
|
273
|
-
if (actor.publicKeyId == null) logger.warn("You configured a key pairs dispatcher, but the actor does not have a publicKey property. Set the property with Context.getActorKeyPairs(identifier).");
|
|
274
|
-
if (actor.assertionMethodId == null) logger.warn("You configured a key pairs dispatcher, but the actor does not have an assertionMethod property. Set the property with Context.getActorKeyPairs(identifier).");
|
|
275
|
-
}
|
|
276
|
-
if (this.mediaUploaderCallback != null) {
|
|
277
|
-
if (actor.endpoints == null || actor.endpoints.uploadMedia == null) logger.warn("You configured a media uploader, but the actor does not have a endpoints.uploadMedia property. Set the property with Context.getMediaUploaderUri(identifier).");
|
|
278
|
-
else if (actor.endpoints.uploadMedia.href != context.getMediaUploaderUri(identifier).href) logger.warn("You configured a media uploader, but the actor's endpoints.uploadMedia property does not match the media upload endpoint URI. Set the property with Context.getMediaUploaderUri(identifier).");
|
|
279
|
-
}
|
|
280
|
-
return actor;
|
|
281
|
-
} };
|
|
282
|
-
this.actorCallbacks = callbacks;
|
|
283
|
-
const setters = {
|
|
284
|
-
setKeyPairsDispatcher: (dispatcher) => {
|
|
285
|
-
callbacks.keyPairsDispatcher = (ctx, identifier) => this._getTracer().startActiveSpan("activitypub.dispatch_actor_key_pairs", {
|
|
286
|
-
kind: SpanKind.SERVER,
|
|
287
|
-
attributes: {
|
|
288
|
-
"activitypub.actor.id": ctx.getActorUri(identifier).href,
|
|
289
|
-
"fedify.actor.identifier": identifier
|
|
290
|
-
}
|
|
291
|
-
}, async (span) => {
|
|
292
|
-
try {
|
|
293
|
-
return await dispatcher(ctx, identifier);
|
|
294
|
-
} catch (e) {
|
|
295
|
-
span.setStatus({
|
|
296
|
-
code: SpanStatusCode.ERROR,
|
|
297
|
-
message: String(e)
|
|
298
|
-
});
|
|
299
|
-
throw e;
|
|
300
|
-
} finally {
|
|
301
|
-
span.end();
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
return setters;
|
|
305
|
-
},
|
|
306
|
-
mapHandle(mapper) {
|
|
307
|
-
callbacks.handleMapper = mapper;
|
|
308
|
-
return setters;
|
|
309
|
-
},
|
|
310
|
-
mapAlias(mapper) {
|
|
311
|
-
callbacks.aliasMapper = mapper;
|
|
312
|
-
return setters;
|
|
313
|
-
},
|
|
314
|
-
mapPortableActorId(mapper) {
|
|
315
|
-
callbacks.portableActorIdMapper = mapper;
|
|
316
|
-
return setters;
|
|
317
|
-
},
|
|
318
|
-
mapActorAlias: (path, identifier) => {
|
|
319
|
-
if (identifier === "") throw new RouterError("Identifier cannot be empty.");
|
|
320
|
-
if (this.router.has(`actorAlias:${identifier}`)) throw new RouterError(`Actor alias for "${identifier}" already set.`);
|
|
321
|
-
if (Router.variables(path).size > 0) throw new RouterError("Path for actor alias must have no variables.");
|
|
322
|
-
const existingRoute = this.router.route(path);
|
|
323
|
-
if (existingRoute != null) throw new RouterError(`Actor alias path "${path}" conflicts with existing route "${existingRoute.name}".`);
|
|
324
|
-
this.router.add(path, `${ACTOR_ALIAS_PREFIX}${identifier}`);
|
|
325
|
-
return setters;
|
|
326
|
-
},
|
|
327
|
-
authorize(predicate) {
|
|
328
|
-
callbacks.authorizePredicate = predicate;
|
|
329
|
-
return setters;
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
return setters;
|
|
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
|
-
}
|
|
347
|
-
setNodeInfoDispatcher(path, dispatcher) {
|
|
348
|
-
if (this.router.has("nodeInfo")) throw new RouterError("NodeInfo dispatcher already set.");
|
|
349
|
-
if (Router.variables(path).size !== 0) throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
|
|
350
|
-
this.router.add(path, "nodeInfo");
|
|
351
|
-
this.nodeInfoDispatcher = dispatcher;
|
|
352
|
-
}
|
|
353
|
-
setWebFingerLinksDispatcher(dispatcher) {
|
|
354
|
-
this.webFingerLinksDispatcher = dispatcher;
|
|
355
|
-
}
|
|
356
|
-
defineTask(name, options) {
|
|
357
|
-
if (this.taskDefinitions.has(name)) throw new TypeError(`Task ${JSON.stringify(name)} is already defined.`);
|
|
358
|
-
const handle = {
|
|
359
|
-
name,
|
|
360
|
-
schema: options.schema
|
|
361
|
-
};
|
|
362
|
-
this.taskDefinitions.set(name, {
|
|
363
|
-
name,
|
|
364
|
-
schema: options.schema,
|
|
365
|
-
handle,
|
|
366
|
-
handler: options.handler,
|
|
367
|
-
onError: options.onError,
|
|
368
|
-
retryPolicy: options.retryPolicy,
|
|
369
|
-
queue: options.queue
|
|
370
|
-
});
|
|
371
|
-
return handle;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* The RFC 6570 template-literal `path` overloads were removed for
|
|
375
|
-
* type-checking efficiency, so the URI variable types can no longer be
|
|
376
|
-
* inferred from `path` (now typed as a plain `string`); to use them, specify
|
|
377
|
-
* the variable name through the `TParam` generic argument.
|
|
378
|
-
*/
|
|
379
|
-
setObjectDispatcher(cls, path, dispatcher) {
|
|
380
|
-
const routeName = `object:${cls.typeId.href}`;
|
|
381
|
-
if (this.router.has(routeName)) throw new RouterError(`Object dispatcher for ${cls.name} already set.`);
|
|
382
|
-
assertPath(path);
|
|
383
|
-
const variables = Router.variables(path);
|
|
384
|
-
this.router.add(path, routeName);
|
|
385
|
-
const callbacks = {
|
|
386
|
-
dispatcher: async (ctx, values) => {
|
|
387
|
-
const object = await this._getTracer().startActiveSpan("activitypub.dispatch_object", {
|
|
388
|
-
kind: SpanKind.SERVER,
|
|
389
|
-
attributes: {
|
|
390
|
-
"fedify.object.type": cls.typeId.href,
|
|
391
|
-
...globalThis.Object.fromEntries(globalThis.Object.entries(values).map(([k, v]) => [`fedify.object.values.${k}`, v]))
|
|
392
|
-
}
|
|
393
|
-
}, async (span) => {
|
|
394
|
-
try {
|
|
395
|
-
const object = await dispatcher(ctx, values);
|
|
396
|
-
span.setAttribute("activitypub.object.id", (object?.id ?? ctx.getObjectUri(cls, values)).href);
|
|
397
|
-
if (object == null) span.setStatus({ code: SpanStatusCode.ERROR });
|
|
398
|
-
else span.setAttribute("activitypub.object.type", getTypeId(object).href);
|
|
399
|
-
return object;
|
|
400
|
-
} catch (e) {
|
|
401
|
-
span.setStatus({
|
|
402
|
-
code: SpanStatusCode.ERROR,
|
|
403
|
-
message: String(e)
|
|
404
|
-
});
|
|
405
|
-
throw e;
|
|
406
|
-
} finally {
|
|
407
|
-
span.end();
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
if (object instanceof Tombstone) warnMismatchedTombstoneId(ctx, cls, values, object);
|
|
411
|
-
return object;
|
|
412
|
-
},
|
|
413
|
-
parameters: variables
|
|
414
|
-
};
|
|
415
|
-
this.objectCallbacks[cls.typeId.href] = callbacks;
|
|
416
|
-
this.objectTypeIds[cls.typeId.href] = cls;
|
|
417
|
-
const setters = { authorize(predicate) {
|
|
418
|
-
callbacks.authorizePredicate = predicate;
|
|
419
|
-
return setters;
|
|
420
|
-
} };
|
|
421
|
-
return setters;
|
|
422
|
-
}
|
|
423
|
-
setInboxDispatcher(path, dispatcher) {
|
|
424
|
-
if (this.inboxCallbacks != null) throw new RouterError("Inbox dispatcher already set.");
|
|
425
|
-
if (this.router.has("inbox")) {
|
|
426
|
-
if (this.inboxPath !== path) throw new RouterError("Inbox dispatcher path must match inbox listener path.");
|
|
427
|
-
} else {
|
|
428
|
-
assertPath(path);
|
|
429
|
-
this.router.add(path, "inbox", identifierSingularAllowPlus);
|
|
430
|
-
this.inboxPath = path;
|
|
431
|
-
}
|
|
432
|
-
const callbacks = { dispatcher };
|
|
433
|
-
this.inboxCallbacks = callbacks;
|
|
434
|
-
const setters = {
|
|
435
|
-
setCounter(counter) {
|
|
436
|
-
callbacks.counter = counter;
|
|
437
|
-
return setters;
|
|
438
|
-
},
|
|
439
|
-
setFirstCursor(cursor) {
|
|
440
|
-
callbacks.firstCursor = cursor;
|
|
441
|
-
return setters;
|
|
442
|
-
},
|
|
443
|
-
setLastCursor(cursor) {
|
|
444
|
-
callbacks.lastCursor = cursor;
|
|
445
|
-
return setters;
|
|
446
|
-
},
|
|
447
|
-
authorize(predicate) {
|
|
448
|
-
callbacks.authorizePredicate = predicate;
|
|
449
|
-
return setters;
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
return setters;
|
|
453
|
-
}
|
|
454
|
-
setOutboxDispatcher(path, dispatcher) {
|
|
455
|
-
if (this.outboxCallbacks != null) throw new RouterError("Outbox dispatcher already set.");
|
|
456
|
-
if (this.router.has("outbox")) {
|
|
457
|
-
if (this.outboxPath !== path) throw new RouterError("Outbox dispatcher path must match outbox listener path.");
|
|
458
|
-
} else {
|
|
459
|
-
assertPath(path);
|
|
460
|
-
this.router.add(path, "outbox", identifierSingular);
|
|
461
|
-
this.outboxPath = path;
|
|
462
|
-
}
|
|
463
|
-
const callbacks = { dispatcher };
|
|
464
|
-
this.outboxCallbacks = callbacks;
|
|
465
|
-
const setters = {
|
|
466
|
-
setCounter(counter) {
|
|
467
|
-
callbacks.counter = counter;
|
|
468
|
-
return setters;
|
|
469
|
-
},
|
|
470
|
-
setFirstCursor(cursor) {
|
|
471
|
-
callbacks.firstCursor = cursor;
|
|
472
|
-
return setters;
|
|
473
|
-
},
|
|
474
|
-
setLastCursor(cursor) {
|
|
475
|
-
callbacks.lastCursor = cursor;
|
|
476
|
-
return setters;
|
|
477
|
-
},
|
|
478
|
-
authorize(predicate) {
|
|
479
|
-
callbacks.authorizePredicate = predicate;
|
|
480
|
-
return setters;
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
return setters;
|
|
484
|
-
}
|
|
485
|
-
setOutboxListeners(outboxPath) {
|
|
486
|
-
if (this.outboxListeners != null) throw new RouterError("Outbox listeners already set.");
|
|
487
|
-
if (this.router.has("outbox")) {
|
|
488
|
-
if (this.outboxPath !== outboxPath) throw new RouterError("Outbox listener path must match outbox dispatcher path.");
|
|
489
|
-
} else {
|
|
490
|
-
assertPath(outboxPath);
|
|
491
|
-
this.router.add(outboxPath, "outbox", identifierSingular);
|
|
492
|
-
this.outboxPath = outboxPath;
|
|
493
|
-
}
|
|
494
|
-
const listeners = this.outboxListeners = new ActivityListenerSet();
|
|
495
|
-
const setters = {
|
|
496
|
-
on(type, listener) {
|
|
497
|
-
listeners.add(type, listener);
|
|
498
|
-
return setters;
|
|
499
|
-
},
|
|
500
|
-
onError: (handler) => {
|
|
501
|
-
this.outboxListenerErrorHandler = handler;
|
|
502
|
-
return setters;
|
|
503
|
-
},
|
|
504
|
-
authorize: (predicate) => {
|
|
505
|
-
this.outboxAuthorizePredicate = predicate;
|
|
506
|
-
return setters;
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
return setters;
|
|
510
|
-
}
|
|
511
|
-
setMediaUploader(path, callback) {
|
|
512
|
-
if (this.mediaUploaderCallback != null) throw new RouterError("Media uploader already set.");
|
|
513
|
-
assertPath(path);
|
|
514
|
-
this.router.add(path, "mediaUploader", identifierSingular);
|
|
515
|
-
this.mediaUploaderPath = path;
|
|
516
|
-
this.mediaUploaderCallback = callback;
|
|
517
|
-
const setters = { authorize: (predicate) => {
|
|
518
|
-
this.mediaUploaderAuthorizePredicate = predicate;
|
|
519
|
-
return setters;
|
|
520
|
-
} };
|
|
521
|
-
return setters;
|
|
522
|
-
}
|
|
523
|
-
setHashlinkMediaDispatcher(dispatcher) {
|
|
524
|
-
if (this.hashlinkMediaDispatcher != null) throw new RouterError("Hashlink media dispatcher already set.");
|
|
525
|
-
this.hashlinkMediaDispatcher = dispatcher;
|
|
526
|
-
}
|
|
527
|
-
setFollowingDispatcher(path, dispatcher) {
|
|
528
|
-
if (this.router.has("following")) throw new RouterError("Following collection dispatcher already set.");
|
|
529
|
-
assertPath(path);
|
|
530
|
-
this.router.add(path, "following", identifierSingularAllowPlus);
|
|
531
|
-
const callbacks = { dispatcher };
|
|
532
|
-
this.followingCallbacks = callbacks;
|
|
533
|
-
const setters = {
|
|
534
|
-
setCounter(counter) {
|
|
535
|
-
callbacks.counter = counter;
|
|
536
|
-
return setters;
|
|
537
|
-
},
|
|
538
|
-
setFirstCursor(cursor) {
|
|
539
|
-
callbacks.firstCursor = cursor;
|
|
540
|
-
return setters;
|
|
541
|
-
},
|
|
542
|
-
setLastCursor(cursor) {
|
|
543
|
-
callbacks.lastCursor = cursor;
|
|
544
|
-
return setters;
|
|
545
|
-
},
|
|
546
|
-
authorize(predicate) {
|
|
547
|
-
callbacks.authorizePredicate = predicate;
|
|
548
|
-
return setters;
|
|
549
|
-
}
|
|
550
|
-
};
|
|
551
|
-
return setters;
|
|
552
|
-
}
|
|
553
|
-
setFollowersDispatcher(path, dispatcher) {
|
|
554
|
-
if (this.router.has("followers")) throw new RouterError("Followers collection dispatcher already set.");
|
|
555
|
-
assertPath(path);
|
|
556
|
-
this.router.add(path, "followers", identifierSingularAllowPlus);
|
|
557
|
-
const callbacks = { dispatcher };
|
|
558
|
-
this.followersCallbacks = callbacks;
|
|
559
|
-
const setters = {
|
|
560
|
-
setCounter(counter) {
|
|
561
|
-
callbacks.counter = counter;
|
|
562
|
-
return setters;
|
|
563
|
-
},
|
|
564
|
-
setFirstCursor(cursor) {
|
|
565
|
-
callbacks.firstCursor = cursor;
|
|
566
|
-
return setters;
|
|
567
|
-
},
|
|
568
|
-
setLastCursor(cursor) {
|
|
569
|
-
callbacks.lastCursor = cursor;
|
|
570
|
-
return setters;
|
|
571
|
-
},
|
|
572
|
-
authorize(predicate) {
|
|
573
|
-
callbacks.authorizePredicate = predicate;
|
|
574
|
-
return setters;
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
|
-
return setters;
|
|
578
|
-
}
|
|
579
|
-
setLikedDispatcher(path, dispatcher) {
|
|
580
|
-
if (this.router.has("liked")) throw new RouterError("Liked collection dispatcher already set.");
|
|
581
|
-
assertPath(path);
|
|
582
|
-
this.router.add(path, "liked", identifierSingularAllowPlus);
|
|
583
|
-
const callbacks = { dispatcher };
|
|
584
|
-
this.likedCallbacks = callbacks;
|
|
585
|
-
const setters = {
|
|
586
|
-
setCounter(counter) {
|
|
587
|
-
callbacks.counter = counter;
|
|
588
|
-
return setters;
|
|
589
|
-
},
|
|
590
|
-
setFirstCursor(cursor) {
|
|
591
|
-
callbacks.firstCursor = cursor;
|
|
592
|
-
return setters;
|
|
593
|
-
},
|
|
594
|
-
setLastCursor(cursor) {
|
|
595
|
-
callbacks.lastCursor = cursor;
|
|
596
|
-
return setters;
|
|
597
|
-
},
|
|
598
|
-
authorize(predicate) {
|
|
599
|
-
callbacks.authorizePredicate = predicate;
|
|
600
|
-
return setters;
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
|
-
return setters;
|
|
604
|
-
}
|
|
605
|
-
setFeaturedDispatcher(path, dispatcher) {
|
|
606
|
-
if (this.router.has("featured")) throw new RouterError("Featured collection dispatcher already set.");
|
|
607
|
-
assertPath(path);
|
|
608
|
-
this.router.add(path, "featured", identifierSingularAllowPlus);
|
|
609
|
-
const callbacks = { dispatcher };
|
|
610
|
-
this.featuredCallbacks = callbacks;
|
|
611
|
-
const setters = {
|
|
612
|
-
setCounter(counter) {
|
|
613
|
-
callbacks.counter = counter;
|
|
614
|
-
return setters;
|
|
615
|
-
},
|
|
616
|
-
setFirstCursor(cursor) {
|
|
617
|
-
callbacks.firstCursor = cursor;
|
|
618
|
-
return setters;
|
|
619
|
-
},
|
|
620
|
-
setLastCursor(cursor) {
|
|
621
|
-
callbacks.lastCursor = cursor;
|
|
622
|
-
return setters;
|
|
623
|
-
},
|
|
624
|
-
authorize(predicate) {
|
|
625
|
-
callbacks.authorizePredicate = predicate;
|
|
626
|
-
return setters;
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
return setters;
|
|
630
|
-
}
|
|
631
|
-
setFeaturedTagsDispatcher(path, dispatcher) {
|
|
632
|
-
if (this.router.has("featuredTags")) throw new RouterError("Featured tags collection dispatcher already set.");
|
|
633
|
-
assertPath(path);
|
|
634
|
-
this.router.add(path, "featuredTags", identifierSingularAllowPlus);
|
|
635
|
-
const callbacks = { dispatcher };
|
|
636
|
-
this.featuredTagsCallbacks = callbacks;
|
|
637
|
-
const setters = {
|
|
638
|
-
setCounter(counter) {
|
|
639
|
-
callbacks.counter = counter;
|
|
640
|
-
return setters;
|
|
641
|
-
},
|
|
642
|
-
setFirstCursor(cursor) {
|
|
643
|
-
callbacks.firstCursor = cursor;
|
|
644
|
-
return setters;
|
|
645
|
-
},
|
|
646
|
-
setLastCursor(cursor) {
|
|
647
|
-
callbacks.lastCursor = cursor;
|
|
648
|
-
return setters;
|
|
649
|
-
},
|
|
650
|
-
authorize(predicate) {
|
|
651
|
-
callbacks.authorizePredicate = predicate;
|
|
652
|
-
return setters;
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
return setters;
|
|
656
|
-
}
|
|
657
|
-
setInboxListeners(inboxPath, sharedInboxPath) {
|
|
658
|
-
if (this.inboxListeners != null) throw new RouterError("Inbox listeners already set.");
|
|
659
|
-
if (this.router.has("inbox")) {
|
|
660
|
-
if (this.inboxPath !== inboxPath) throw new RouterError("Inbox listener path must match inbox dispatcher path.");
|
|
661
|
-
} else {
|
|
662
|
-
assertPath(inboxPath);
|
|
663
|
-
this.router.add(inboxPath, "inbox", identifierSingularAllowPlus);
|
|
664
|
-
this.inboxPath = inboxPath;
|
|
665
|
-
}
|
|
666
|
-
if (sharedInboxPath != null) {
|
|
667
|
-
if (Router.variables(sharedInboxPath).size !== 0) throw new RouterError("Path for shared inbox must have no variables.");
|
|
668
|
-
this.router.add(sharedInboxPath, "sharedInbox");
|
|
669
|
-
}
|
|
670
|
-
const listeners = this.inboxListeners = new ActivityListenerSet();
|
|
671
|
-
const setters = {
|
|
672
|
-
on(type, listener, options) {
|
|
673
|
-
listeners.add(type, listener, options);
|
|
674
|
-
return setters;
|
|
675
|
-
},
|
|
676
|
-
onError: (handler) => {
|
|
677
|
-
this.inboxErrorHandler = handler;
|
|
678
|
-
return setters;
|
|
679
|
-
},
|
|
680
|
-
onRequestFinished: (handler) => {
|
|
681
|
-
this.inboxRequestFinishedHandler = handler;
|
|
682
|
-
return setters;
|
|
683
|
-
},
|
|
684
|
-
onUnverifiedActivity: (handler) => {
|
|
685
|
-
this.unverifiedActivityHandler = handler;
|
|
686
|
-
return setters;
|
|
687
|
-
},
|
|
688
|
-
setSharedKeyDispatcher: (dispatcher) => {
|
|
689
|
-
this.sharedInboxKeyDispatcher = dispatcher;
|
|
690
|
-
return setters;
|
|
691
|
-
},
|
|
692
|
-
withIdempotency: (strategy) => {
|
|
693
|
-
this.idempotencyStrategy = strategy;
|
|
694
|
-
return setters;
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
return setters;
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* The RFC 6570 template-literal `path` overloads were removed for
|
|
701
|
-
* type-checking efficiency, so the URI variable types can no longer be
|
|
702
|
-
* inferred from `path` (now typed as a plain `string`); to use them, specify
|
|
703
|
-
* the variable name through the `TParam` generic argument.
|
|
704
|
-
*/
|
|
705
|
-
setCollectionDispatcher(name, itemType, path, dispatcher) {
|
|
706
|
-
return this.#setCustomCollectionDispatcher(name, "collection", itemType, path, dispatcher);
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* The RFC 6570 template-literal `path` overloads were removed for
|
|
710
|
-
* type-checking efficiency, so the URI variable types can no longer be
|
|
711
|
-
* inferred from `path` (now typed as a plain `string`); to use them, specify
|
|
712
|
-
* the variable name through the `TParam` generic argument.
|
|
713
|
-
*/
|
|
714
|
-
setOrderedCollectionDispatcher(name, itemType, path, dispatcher) {
|
|
715
|
-
return this.#setCustomCollectionDispatcher(name, "orderedCollection", itemType, path, dispatcher);
|
|
716
|
-
}
|
|
717
|
-
#setCustomCollectionDispatcher(name, collectionType, itemType, path, dispatcher) {
|
|
718
|
-
const strName = String(name);
|
|
719
|
-
const routeName = `${collectionType}:${this.#uniqueCollectionId(name)}`;
|
|
720
|
-
if (this.router.has(routeName)) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
|
|
721
|
-
if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
|
|
722
|
-
assertPath(path);
|
|
723
|
-
if (Router.variables(path).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
|
|
724
|
-
this.#collectionNames.set(routeName, name);
|
|
725
|
-
this.router.add(path, routeName);
|
|
726
|
-
const callbacks = { dispatcher };
|
|
727
|
-
this.collectionCallbacks[name] = callbacks;
|
|
728
|
-
this.collectionTypeIds[name] = itemType;
|
|
729
|
-
const setters = {
|
|
730
|
-
setCounter(counter) {
|
|
731
|
-
callbacks.counter = counter;
|
|
732
|
-
return setters;
|
|
733
|
-
},
|
|
734
|
-
setFirstCursor(cursor) {
|
|
735
|
-
callbacks.firstCursor = cursor;
|
|
736
|
-
return setters;
|
|
737
|
-
},
|
|
738
|
-
setLastCursor(cursor) {
|
|
739
|
-
callbacks.lastCursor = cursor;
|
|
740
|
-
return setters;
|
|
741
|
-
},
|
|
742
|
-
authorize(predicate) {
|
|
743
|
-
callbacks.authorizePredicate = predicate;
|
|
744
|
-
return setters;
|
|
745
|
-
},
|
|
746
|
-
mapPortableOwner(mapper) {
|
|
747
|
-
callbacks.portableOwnerMapper = mapper;
|
|
748
|
-
return setters;
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
return setters;
|
|
752
|
-
}
|
|
753
|
-
/**
|
|
754
|
-
* Get the URL path for a custom collection.
|
|
755
|
-
* If the collection is not registered, returns null.
|
|
756
|
-
* @template TParam The parameter names of the requested URL.
|
|
757
|
-
* @param {string | symbol} name The name of the custom collection.
|
|
758
|
-
* @param {TParam} values The values to fill in the URL parameters.
|
|
759
|
-
* @returns {string | null} The URL path for the custom collection, or null if not registered.
|
|
760
|
-
*/
|
|
761
|
-
getCollectionPath(name, values) {
|
|
762
|
-
if (!(name in this.collectionCallbacks)) return null;
|
|
763
|
-
const routeName = this.#uniqueCollectionId(name);
|
|
764
|
-
return this.router.build(`collection:${routeName}`, values) ?? this.router.build(`orderedCollection:${routeName}`, values);
|
|
765
|
-
}
|
|
766
|
-
/** Resolves a custom collection route to its original name. */
|
|
767
|
-
getCollectionName(routeName) {
|
|
768
|
-
return this.#collectionNames.get(routeName) ?? routeName.replace(/^(collection|orderedCollection):/, "");
|
|
769
|
-
}
|
|
770
|
-
setOutboxPermanentFailureHandler(handler) {
|
|
771
|
-
this.outboxPermanentFailureHandler = handler;
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Warns if a portable actor's collection properties that are portable IDs
|
|
775
|
-
* or compatible identifiers do not refer to the collections that
|
|
776
|
-
* the registered collection dispatchers serve through the FEP-ef61 gateway
|
|
777
|
-
* endpoint for the actor's DID. Properties with ordinary HTTP(S) URLs are
|
|
778
|
-
* not compared, since a portable actor may keep ordinary collections.
|
|
779
|
-
*/
|
|
780
|
-
#warnPortableCollectionIds(context, identifier, actor) {
|
|
781
|
-
const did = actor.id == null ? null : getPortableDid(actor.id);
|
|
782
|
-
if (did == null) return;
|
|
783
|
-
const logger = getLogger([
|
|
784
|
-
"fedify",
|
|
785
|
-
"federation",
|
|
786
|
-
"actor"
|
|
787
|
-
]);
|
|
788
|
-
const check = (registered, property, value, helper, build) => {
|
|
789
|
-
if (!registered || value == null || !isPortableId(value)) return;
|
|
790
|
-
const actual = getCanonicalPortableId(value);
|
|
791
|
-
if (actual == null) {
|
|
792
|
-
logger.warn("The actor's {property} property, {value}, is a malformed FEP-ef61 portable ID or compatible identifier.", {
|
|
793
|
-
property,
|
|
794
|
-
value: value.href
|
|
795
|
-
});
|
|
796
|
-
return;
|
|
797
|
-
}
|
|
798
|
-
let expected;
|
|
799
|
-
try {
|
|
800
|
-
expected = build();
|
|
801
|
-
} catch (error) {
|
|
802
|
-
if (error instanceof TypeError || error instanceof RouterError) return;
|
|
803
|
-
throw error;
|
|
804
|
-
}
|
|
805
|
-
if (actual === getCanonicalPortableId(expected)) return;
|
|
806
|
-
logger.warn("The portable actor's {property} property, {value}, does not match the portable ID of the collection that the gateway endpoint serves, {expected}. Set the property with Context.{helper}(identifier, did).", {
|
|
807
|
-
property,
|
|
808
|
-
value: value.href,
|
|
809
|
-
expected: expected.href,
|
|
810
|
-
helper
|
|
811
|
-
});
|
|
812
|
-
};
|
|
813
|
-
check(this.outboxCallbacks?.dispatcher != null, "outbox", actor.outboxId, "getPortableOutboxUri", () => context.getPortableOutboxUri(identifier, did));
|
|
814
|
-
check(this.inboxCallbacks?.dispatcher != null || this.router.has("inbox"), "inbox", actor.inboxId, "getPortableInboxUri", () => context.getPortableInboxUri(identifier, did));
|
|
815
|
-
check(this.followingCallbacks?.dispatcher != null, "following", actor.followingId, "getPortableFollowingUri", () => context.getPortableFollowingUri(identifier, did));
|
|
816
|
-
check(this.followersCallbacks?.dispatcher != null, "followers", actor.followersId, "getPortableFollowersUri", () => context.getPortableFollowersUri(identifier, did));
|
|
817
|
-
check(this.likedCallbacks?.dispatcher != null, "liked", actor.likedId, "getPortableLikedUri", () => context.getPortableLikedUri(identifier, did));
|
|
818
|
-
check(this.featuredCallbacks?.dispatcher != null, "featured", actor.featuredId, "getPortableFeaturedUri", () => context.getPortableFeaturedUri(identifier, did));
|
|
819
|
-
check(this.featuredTagsCallbacks?.dispatcher != null, "featuredTags", actor.featuredTagsId, "getPortableFeaturedTagsUri", () => context.getPortableFeaturedTagsUri(identifier, did));
|
|
820
|
-
}
|
|
821
|
-
/**
|
|
822
|
-
* Converts a name (string or symbol) to a unique string identifier.
|
|
823
|
-
* For symbols, generates and caches a UUID if not already present.
|
|
824
|
-
* For strings, returns the string as-is.
|
|
825
|
-
* @param name The name to convert to a unique identifier
|
|
826
|
-
* @returns A unique string identifier
|
|
827
|
-
*/
|
|
828
|
-
#uniqueCollectionId(name) {
|
|
829
|
-
if (typeof name === "string") return name;
|
|
830
|
-
if (!this.#symbolRegistry.has(name)) this.#symbolRegistry.set(name, crypto.randomUUID());
|
|
831
|
-
return this.#symbolRegistry.get(name);
|
|
832
|
-
}
|
|
833
|
-
};
|
|
834
|
-
/**
|
|
835
|
-
* Creates a new {@link FederationBuilder} instance.
|
|
836
|
-
* @returns A new {@link FederationBuilder} instance.
|
|
837
|
-
* @since 1.6.0
|
|
838
|
-
*/
|
|
839
|
-
function createFederationBuilder() {
|
|
840
|
-
return new FederationBuilderImpl();
|
|
841
|
-
}
|
|
842
|
-
function warnMismatchedTombstoneId(context, cls, values, tombstone) {
|
|
843
|
-
const logger = getLogger([
|
|
844
|
-
"fedify",
|
|
845
|
-
"federation",
|
|
846
|
-
"object"
|
|
847
|
-
]);
|
|
848
|
-
if (tombstone.id == null) {
|
|
849
|
-
logger.warn("Object dispatcher for {class} returned a tombstone without an id property. Set the property with Context.getObjectUri().", {
|
|
850
|
-
class: cls.name,
|
|
851
|
-
values
|
|
852
|
-
});
|
|
853
|
-
return;
|
|
854
|
-
}
|
|
855
|
-
if (isPortableId(tombstone.id)) return;
|
|
856
|
-
const expected = context.getObjectUri(cls, values);
|
|
857
|
-
if (tombstone.id.href !== expected.href) logger.warn("Object dispatcher for {class} returned a tombstone with an id property {tombstoneId} that does not match the object URI {objectUri}. Set the property with Context.getObjectUri().", {
|
|
858
|
-
class: cls.name,
|
|
859
|
-
values,
|
|
860
|
-
tombstoneId: tombstone.id.href,
|
|
861
|
-
objectUri: expected.href
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
/**
|
|
865
|
-
* Warns about an FEP-ef61 portable actor whose `gateways` is empty or has
|
|
866
|
-
* an item that is not an HTTP(S) origin, which FEP-ef61 does not allow.
|
|
867
|
-
* Every item is checked, since the list and its URLs can be mutated after
|
|
868
|
-
* the actor is constructed.
|
|
869
|
-
*/
|
|
870
|
-
function warnPortableActorGateways(actorId, gateways) {
|
|
871
|
-
if (gateways.length > 0 && gateways.every(isGatewayUrl)) return;
|
|
872
|
-
getLogger([
|
|
873
|
-
"fedify",
|
|
874
|
-
"federation",
|
|
875
|
-
"actor"
|
|
876
|
-
]).warn("Actor dispatcher returned an FEP-ef61 portable actor, {actorId}, whose gateways property is empty or has an item that is not an HTTP(S) origin. FEP-ef61 requires a portable actor to have at least one gateway, and every gateway to be an HTTP(S) URI with an empty path, query, and fragment. Set the gateways property.", {
|
|
877
|
-
actorId: actorId.href,
|
|
878
|
-
gateways: gateways.map((g) => g.href)
|
|
879
|
-
});
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Warns about an FEP-ef61 portable actor identified by a compatible identifier
|
|
883
|
-
* that is malformed, or is not on the actor's first gateway, where FEP-ef61
|
|
884
|
-
* requires publishers to construct compatible identifiers. A missing or
|
|
885
|
-
* invalid first gateway is reported by {@link warnPortableActorGateways}
|
|
886
|
-
* instead.
|
|
887
|
-
*/
|
|
888
|
-
function warnCompatibleActorId(actorId, gateway) {
|
|
889
|
-
const logger = getLogger([
|
|
890
|
-
"fedify",
|
|
891
|
-
"federation",
|
|
892
|
-
"actor"
|
|
893
|
-
]);
|
|
894
|
-
try {
|
|
895
|
-
fromCompatibleEf61Id(actorId);
|
|
896
|
-
} catch (error) {
|
|
897
|
-
if (!(error instanceof TypeError)) throw error;
|
|
898
|
-
logger.warn("Actor dispatcher returned an actor whose id property, {actorId}, is a malformed FEP-ef61 compatible identifier: {error}", {
|
|
899
|
-
actorId: actorId.href,
|
|
900
|
-
error
|
|
901
|
-
});
|
|
902
|
-
return;
|
|
903
|
-
}
|
|
904
|
-
if (gateway == null || !isGatewayUrl(gateway)) return;
|
|
905
|
-
if (actorId.origin !== gateway.origin) logger.warn("Actor dispatcher returned an actor whose id property, {actorId}, is an FEP-ef61 compatible identifier on another gateway than its first gateway, {gateway}. FEP-ef61 requires publishers to construct compatible identifiers with the first gateway in the actor's gateways.", {
|
|
906
|
-
actorId: actorId.href,
|
|
907
|
-
gateway: gateway.origin
|
|
908
|
-
});
|
|
909
|
-
}
|
|
910
|
-
//#endregion
|
|
911
|
-
export { snapshotHeaders as a, snapshotHeaderPolicy as i, FederationBuilderImpl as n, createFederationBuilder as r, ACTOR_ALIAS_PREFIX as t };
|