@fedify/fedify 2.0.35-dev.2480 → 2.0.35
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-cEjyBwpD.mjs → builder-CpxZPa7I.mjs} +3 -3
- package/dist/{client-CAM_bQXx.d.cts → client-BIBzqEIp.d.cts} +0 -1
- package/dist/{client-BUqbea1d.mjs → client-DGNacEx_.mjs} +113 -64
- package/dist/{client-CSddvgWN.d.ts → client-jE7oGvRh.d.ts} +0 -1
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-r8sjhltN.d.cts → context-CnoWxuoB.d.cts} +2 -2
- package/dist/{context-B2iX3heK.d.ts → context-lxjaUTAI.d.ts} +2 -2
- package/dist/{deno-BcnGeGr2.mjs → deno-BAtjc8bx.mjs} +1 -1
- package/dist/docloader-CyBB50Om.mjs +124 -0
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +6 -6
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +42 -23
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +445 -70
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-BD9izRp9.cjs → http-5u2wDmjl.cjs} +114 -56
- package/dist/{http-D0cjeL8a.mjs → http-9wCo74JF.mjs} +136 -49
- package/dist/{http-Bs6thuCC.d.cts → http-Cd8UD1ym.d.ts} +1 -2
- package/dist/{http-CDupyfOc.d.ts → http-DFqAb11b.d.cts} +1 -2
- package/dist/{http-IYRDhhnT.js → http-Dwj7bNhv.js} +113 -55
- package/dist/{inbox-D2fsxjqC.mjs → inbox-De2IaCfd.mjs} +1 -1
- package/dist/{key-BFzQ3Hef.mjs → key-BD-PBpNB.mjs} +1 -1
- package/dist/{kv-cache-C-RyNMt6.js → kv-cache-5TdAMHng.js} +60 -18
- package/dist/{kv-cache-B4sDuLjb.cjs → kv-cache-ivTOKx4b.cjs} +59 -17
- package/dist/{ld-D2bkYBIz.mjs → ld-34_mZbyP.mjs} +2 -2
- package/dist/{middleware-3mc-kq3v.mjs → middleware-BI7Hldd0.mjs} +1 -1
- package/dist/{middleware-DxX8ZL-q.cjs → middleware-Co4IpMca.cjs} +118 -33
- package/dist/{middleware-DRZp7Odv.js → middleware-DTJ9dnYC.js} +118 -33
- package/dist/{middleware-B2UC8mtN.cjs → middleware-DhwZ4gNG.cjs} +1 -1
- package/dist/{middleware-CXIBpN4y.mjs → middleware-DzaMP9BP.mjs} +12 -12
- package/dist/{mod-BkPB4hPe.d.cts → mod-BPDfu4Ey.d.cts} +2 -7
- package/dist/{mod-E7YM72JZ.d.ts → mod-BS-jg3Wx.d.ts} +1 -1
- package/dist/{mod-BKJyD7nk.d.ts → mod-DGP89q0u.d.ts} +2 -7
- package/dist/{mod-IOWUF5Yr.d.cts → mod-DVPS4yam.d.cts} +1 -1
- package/dist/{mod-CM_eR8hQ.d.ts → mod-I-34OMN3.d.ts} +1 -1
- package/dist/{mod-DDTLbfce.d.cts → mod-w1oyHseQ.d.cts} +1 -1
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +337 -19
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/{owner-BuJXJDhl.mjs → owner-CxBLBD2K.mjs} +2 -2
- package/dist/{proof-BJ_6nKhb.js → proof-D5IUmaZ0.js} +1 -1
- package/dist/{proof-JxVhLZA3.mjs → proof-DhW1tGUz.mjs} +2 -2
- package/dist/{proof-DfmHAmtr.cjs → proof-yX6qSpxk.cjs} +1 -1
- package/dist/{send-CDaWmeqV.mjs → send-CdfEXNS7.mjs} +117 -32
- package/dist/sig/http.test.mjs +411 -2
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/{temporal-Bv6Zn1C5.mjs → temporal-BbywNJ81.mjs} +1 -1
- package/dist/testing/mod.d.mts +0 -1
- package/dist/{types-miAYfiGO.js → types-B1_pRFE_.js} +112 -63
- package/dist/{types-DRPjmHVV.cjs → types-DOvyymM4.cjs} +111 -62
- package/dist/utils/docloader.test.mjs +316 -32
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +5 -5
- package/dist/docloader-BqDq3fDF.mjs +0 -82
package/dist/mod.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-
|
|
3
|
-
import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryptoKeyPair, i as VerifyRequestOptions, l as KeyCache, n as HttpMessageSignaturesSpecDeterminer, o as verifyRequest, p as importJwk, r as SignRequestOptions, s as FetchKeyOptions, t as HttpMessageSignaturesSpec, u as exportJwk } from "./http-
|
|
2
|
+
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-BIBzqEIp.cjs";
|
|
3
|
+
import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryptoKeyPair, i as VerifyRequestOptions, l as KeyCache, n as HttpMessageSignaturesSpecDeterminer, o as verifyRequest, p as importJwk, r as SignRequestOptions, s as FetchKeyOptions, t as HttpMessageSignaturesSpec, u as exportJwk } from "./http-DFqAb11b.cjs";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-B3hNQCG8.cjs";
|
|
5
|
-
import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, bt as ActivityTransformer, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "./context-
|
|
5
|
+
import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, bt as ActivityTransformer, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "./context-CnoWxuoB.cjs";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-CZKl1IUS.cjs";
|
|
7
7
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
|
|
8
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "./mod-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-w1oyHseQ.cjs";
|
|
9
|
+
import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "./mod-DVPS4yam.cjs";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-BPDfu4Ey.cjs";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-
|
|
3
|
-
import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryptoKeyPair, i as VerifyRequestOptions, l as KeyCache, n as HttpMessageSignaturesSpecDeterminer, o as verifyRequest, p as importJwk, r as SignRequestOptions, s as FetchKeyOptions, t as HttpMessageSignaturesSpec, u as exportJwk } from "./http-
|
|
2
|
+
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-jE7oGvRh.js";
|
|
3
|
+
import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryptoKeyPair, i as VerifyRequestOptions, l as KeyCache, n as HttpMessageSignaturesSpecDeterminer, o as verifyRequest, p as importJwk, r as SignRequestOptions, s as FetchKeyOptions, t as HttpMessageSignaturesSpec, u as exportJwk } from "./http-Cd8UD1ym.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CiBPcC6F.js";
|
|
5
|
-
import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, bt as ActivityTransformer, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "./context-
|
|
5
|
+
import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, bt as ActivityTransformer, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "./context-lxjaUTAI.js";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-CxaI4eGo.js";
|
|
7
7
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
|
|
8
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "./mod-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-I-34OMN3.js";
|
|
9
|
+
import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "./mod-BS-jg3Wx.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DGP89q0u.js";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
package/dist/mod.js
CHANGED
|
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
import "./chunk-CRNNMoPX.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-
|
|
7
|
-
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-
|
|
8
|
-
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-
|
|
9
|
-
import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
6
|
+
import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-Dwj7bNhv.js";
|
|
7
|
+
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-DTJ9dnYC.js";
|
|
8
|
+
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-B1_pRFE_.js";
|
|
9
|
+
import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-D5IUmaZ0.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-5TdAMHng.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
@@ -5,12 +5,21 @@ import { t as esm_default } from "../esm-DVILvP5e.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-DflMZha5.mjs";
|
|
7
7
|
import { n as assertInstanceOf } from "../assert-BhQd8QHP.mjs";
|
|
8
|
-
import { a as
|
|
8
|
+
import { a as parseOutboundService, c as parseSoftware, i as parseNodeInfo, l as parseUsage, n as getNodeInfoInternal, o as parseProtocol, r as parseInboundService, s as parseServices, t as getNodeInfo } from "../client-DGNacEx_.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
import { UrlError } from "@fedify/vocab-runtime";
|
|
11
|
+
import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
|
|
11
12
|
import { configure, reset } from "@logtape/logtape";
|
|
12
|
-
import dns from "node:dns/promises";
|
|
13
13
|
//#region src/nodeinfo/client.test.ts
|
|
14
|
+
function getNodeInfoDirect(url, options) {
|
|
15
|
+
return getNodeInfoInternal(url, options, { openHop: openDirectFetch });
|
|
16
|
+
}
|
|
17
|
+
function getNodeInfoValidated(url, options) {
|
|
18
|
+
return getNodeInfoInternal(url, options, { openHop: (hopUrl) => new URL(hopUrl).hostname === "example.com" ? openDirectFetch(hopUrl) : openPublicFetch(hopUrl, { lookup: () => Promise.resolve([{
|
|
19
|
+
address: "93.184.215.14",
|
|
20
|
+
family: 4
|
|
21
|
+
}]) }) });
|
|
22
|
+
}
|
|
14
23
|
test("getNodeInfo()", async (t) => {
|
|
15
24
|
esm_default.spyGlobal();
|
|
16
25
|
esm_default.get("https://example.com/.well-known/nodeinfo", { body: { links: [{
|
|
@@ -44,25 +53,25 @@ test("getNodeInfo()", async (t) => {
|
|
|
44
53
|
}
|
|
45
54
|
};
|
|
46
55
|
await t.step("indirect", async () => {
|
|
47
|
-
assertEquals(await
|
|
48
|
-
assertEquals(await
|
|
56
|
+
assertEquals(await getNodeInfoDirect("https://example.com/"), expected);
|
|
57
|
+
assertEquals(await getNodeInfoDirect("https://example.com/", { parse: "none" }), rawExpected);
|
|
49
58
|
});
|
|
50
59
|
await t.step("direct", async () => {
|
|
51
|
-
assertEquals(await
|
|
60
|
+
assertEquals(await getNodeInfoDirect("https://example.com/nodeinfo/2.1", { direct: true }), expected);
|
|
52
61
|
});
|
|
53
62
|
esm_default.removeRoutes();
|
|
54
63
|
esm_default.get("https://example.com/.well-known/nodeinfo", { body: { links: [] } });
|
|
55
64
|
await t.step("indirect: no links", async () => {
|
|
56
|
-
assertEquals(await
|
|
65
|
+
assertEquals(await getNodeInfoDirect("https://example.com/"), void 0);
|
|
57
66
|
});
|
|
58
67
|
esm_default.removeRoutes();
|
|
59
68
|
esm_default.get("https://example.com/.well-known/nodeinfo", { status: 404 });
|
|
60
69
|
await t.step("indirect: 404", async () => {
|
|
61
|
-
assertEquals(await
|
|
70
|
+
assertEquals(await getNodeInfoDirect("https://example.com/"), void 0);
|
|
62
71
|
});
|
|
63
72
|
await t.step("direct: 404", async () => {
|
|
64
|
-
assertEquals(await
|
|
65
|
-
assertEquals(await
|
|
73
|
+
assertEquals(await getNodeInfoDirect("https://example.com/nodeinfo/2.0", { direct: true }), void 0);
|
|
74
|
+
assertEquals(await getNodeInfoDirect("https://example.com/404", { direct: true }), void 0);
|
|
66
75
|
});
|
|
67
76
|
esm_default.hardReset();
|
|
68
77
|
});
|
|
@@ -79,7 +88,7 @@ test("getNodeInfo() blocks SSRF", async (t) => {
|
|
|
79
88
|
internalFetched = true;
|
|
80
89
|
return { body: { secret: "INTERNAL_DATA_LEAKED" } };
|
|
81
90
|
});
|
|
82
|
-
assertEquals(await
|
|
91
|
+
assertEquals(await getNodeInfoValidated("https://example.com/", { parse: "none" }), void 0);
|
|
83
92
|
assertEquals(internalFetched, false);
|
|
84
93
|
});
|
|
85
94
|
await t.step("link href using a data: URL", async () => {
|
|
@@ -88,7 +97,7 @@ test("getNodeInfo() blocks SSRF", async (t) => {
|
|
|
88
97
|
rel: "http://nodeinfo.diaspora.software/ns/schema/2.0",
|
|
89
98
|
href: "data:application/json,{\"software\":{\"name\":\"x\"}}"
|
|
90
99
|
}] } });
|
|
91
|
-
assertEquals(await
|
|
100
|
+
assertEquals(await getNodeInfoValidated("https://example.com/", { parse: "none" }), void 0);
|
|
92
101
|
});
|
|
93
102
|
await t.step("redirect to a private address", async () => {
|
|
94
103
|
esm_default.removeRoutes();
|
|
@@ -105,7 +114,7 @@ test("getNodeInfo() blocks SSRF", async (t) => {
|
|
|
105
114
|
internalFetched = true;
|
|
106
115
|
return { body: { secret: "INTERNAL_DATA_LEAKED" } };
|
|
107
116
|
});
|
|
108
|
-
assertEquals(await
|
|
117
|
+
assertEquals(await getNodeInfoValidated("https://example.com/", { parse: "none" }), void 0);
|
|
109
118
|
assertEquals(internalFetched, false);
|
|
110
119
|
});
|
|
111
120
|
await t.step("direct fetch of a private address", async () => {
|
|
@@ -118,7 +127,7 @@ test("getNodeInfo() blocks SSRF", async (t) => {
|
|
|
118
127
|
version: "1.0.0"
|
|
119
128
|
} } };
|
|
120
129
|
});
|
|
121
|
-
assertEquals(await
|
|
130
|
+
assertEquals(await getNodeInfoValidated("http://127.0.0.1:8080/nodeinfo", {
|
|
122
131
|
direct: true,
|
|
123
132
|
parse: "none"
|
|
124
133
|
}), void 0);
|
|
@@ -998,17 +1007,16 @@ test("getNodeInfo() bounds both discovery and document responses", async () => {
|
|
|
998
1007
|
esm_default.hardReset();
|
|
999
1008
|
}
|
|
1000
1009
|
});
|
|
1001
|
-
test("getNodeInfo() logs DNS failures as such",
|
|
1010
|
+
test("getNodeInfo() logs DNS failures as such", async (t) => {
|
|
1002
1011
|
for (const result of [
|
|
1003
1012
|
"throws",
|
|
1004
1013
|
"empty",
|
|
1005
1014
|
"private"
|
|
1006
1015
|
]) await t.step(result, async () => {
|
|
1007
|
-
const
|
|
1008
|
-
dns.lookup = (() => result === "throws" ? Promise.reject(/* @__PURE__ */ new Error("Resolver unavailable")) : Promise.resolve(result === "empty" ? [] : [{
|
|
1016
|
+
const lookup = () => result === "throws" ? Promise.reject(/* @__PURE__ */ new Error("Resolver unavailable")) : Promise.resolve(result === "empty" ? [] : [{
|
|
1009
1017
|
address: "127.0.0.1",
|
|
1010
1018
|
family: 4
|
|
1011
|
-
}])
|
|
1019
|
+
}]);
|
|
1012
1020
|
const records = [];
|
|
1013
1021
|
await configure({
|
|
1014
1022
|
sinks: { buffer: (record) => records.push(record) },
|
|
@@ -1023,7 +1031,7 @@ test("getNodeInfo() logs DNS failures as such", { ignore: "Deno" in globalThis &
|
|
|
1023
1031
|
reset: true
|
|
1024
1032
|
});
|
|
1025
1033
|
try {
|
|
1026
|
-
assertEquals(await
|
|
1034
|
+
assertEquals(await getNodeInfoInternal("https://dns-failure.invalid/", {}, { openHop: (url) => openPublicFetch(url, { lookup }) }), void 0);
|
|
1027
1035
|
assertEquals(records.map((r) => [
|
|
1028
1036
|
r.level,
|
|
1029
1037
|
r.rawMessage,
|
|
@@ -1038,9 +1046,319 @@ test("getNodeInfo() logs DNS failures as such", { ignore: "Deno" in globalThis &
|
|
|
1038
1046
|
assertEquals(error.reason, result === "private" ? "disallowed" : "dns");
|
|
1039
1047
|
} finally {
|
|
1040
1048
|
await reset();
|
|
1041
|
-
dns.lookup = originalLookup;
|
|
1042
1049
|
}
|
|
1043
1050
|
});
|
|
1044
1051
|
});
|
|
1052
|
+
function recordHops(respond) {
|
|
1053
|
+
const events = [];
|
|
1054
|
+
const unsettled = [];
|
|
1055
|
+
let opens = 0;
|
|
1056
|
+
let closes = 0;
|
|
1057
|
+
let responses = 0;
|
|
1058
|
+
return {
|
|
1059
|
+
events,
|
|
1060
|
+
async openHop(url) {
|
|
1061
|
+
opens++;
|
|
1062
|
+
events.push(`open ${url}`);
|
|
1063
|
+
const states = [];
|
|
1064
|
+
let closed = false;
|
|
1065
|
+
return {
|
|
1066
|
+
url: new URL(url),
|
|
1067
|
+
async fetch(input) {
|
|
1068
|
+
if (closed) throw new TypeError("The fetch session is closed.");
|
|
1069
|
+
const target = new URL(input instanceof Request ? input.url : input);
|
|
1070
|
+
const id = ++responses;
|
|
1071
|
+
events.push(`fetch ${target.href} #${id}`);
|
|
1072
|
+
const fake = respond(target);
|
|
1073
|
+
const state = {
|
|
1074
|
+
id,
|
|
1075
|
+
settled: false
|
|
1076
|
+
};
|
|
1077
|
+
states.push(state);
|
|
1078
|
+
let sent = false;
|
|
1079
|
+
const body = new ReadableStream({
|
|
1080
|
+
pull(controller) {
|
|
1081
|
+
if (!sent && fake.body != null && fake.body !== "") {
|
|
1082
|
+
sent = true;
|
|
1083
|
+
controller.enqueue(new TextEncoder().encode(fake.body));
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
state.settled = true;
|
|
1087
|
+
events.push(`consumed #${id}`);
|
|
1088
|
+
controller.close();
|
|
1089
|
+
},
|
|
1090
|
+
cancel() {
|
|
1091
|
+
state.settled = true;
|
|
1092
|
+
events.push(`cancel #${id}`);
|
|
1093
|
+
if (fake.cancelFails) throw new Error("Cancellation failed");
|
|
1094
|
+
if (fake.cancelNeverSettles) return new Promise(() => {});
|
|
1095
|
+
}
|
|
1096
|
+
}, { highWaterMark: 0 });
|
|
1097
|
+
const response = new Response(body, {
|
|
1098
|
+
status: fake.status ?? 200,
|
|
1099
|
+
headers: fake.headers
|
|
1100
|
+
});
|
|
1101
|
+
if (fake.url != null) Object.defineProperty(response, "url", { value: fake.url });
|
|
1102
|
+
return response;
|
|
1103
|
+
},
|
|
1104
|
+
async close() {
|
|
1105
|
+
if (closed) return;
|
|
1106
|
+
closed = true;
|
|
1107
|
+
closes++;
|
|
1108
|
+
for (const state of states) if (!state.settled) unsettled.push(`#${state.id}`);
|
|
1109
|
+
events.push(`close ${url}`);
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
},
|
|
1113
|
+
assertInvariants() {
|
|
1114
|
+
assertEquals(closes, opens);
|
|
1115
|
+
assertEquals(unsettled, []);
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
test("getNodeInfo() closes each hop after cleaning up its body", async (t) => {
|
|
1120
|
+
const wellKnown = "https://example.com/.well-known/nodeinfo";
|
|
1121
|
+
const wellKnown2 = "https://example.com/.well-known/nodeinfo2";
|
|
1122
|
+
const documentUrl = "https://example.com/nodeinfo/2.1";
|
|
1123
|
+
const rawDocument = {
|
|
1124
|
+
software: {
|
|
1125
|
+
name: "foo",
|
|
1126
|
+
version: "1.2.3"
|
|
1127
|
+
},
|
|
1128
|
+
protocols: ["activitypub"],
|
|
1129
|
+
usage: {
|
|
1130
|
+
users: {},
|
|
1131
|
+
localPosts: 0,
|
|
1132
|
+
localComments: 0
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
const descriptor = JSON.stringify({ links: [{
|
|
1136
|
+
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
|
1137
|
+
href: documentUrl
|
|
1138
|
+
}] });
|
|
1139
|
+
await t.step("redirect", async () => {
|
|
1140
|
+
const recorder = recordHops((url) => {
|
|
1141
|
+
switch (url.href) {
|
|
1142
|
+
case wellKnown: return {
|
|
1143
|
+
status: 302,
|
|
1144
|
+
headers: { Location: "/.well-known/nodeinfo2" },
|
|
1145
|
+
body: "redirecting",
|
|
1146
|
+
url: "https://93.184.215.14/.well-known/nodeinfo"
|
|
1147
|
+
};
|
|
1148
|
+
case wellKnown2: return { body: descriptor };
|
|
1149
|
+
default: return { body: JSON.stringify(rawDocument) };
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
assertEquals(await getNodeInfoInternal("https://example.com/", { parse: "none" }, { openHop: recorder.openHop }), rawDocument);
|
|
1153
|
+
assertEquals(recorder.events, [
|
|
1154
|
+
`open ${wellKnown}`,
|
|
1155
|
+
`fetch ${wellKnown} #1`,
|
|
1156
|
+
"cancel #1",
|
|
1157
|
+
`close ${wellKnown}`,
|
|
1158
|
+
`open ${wellKnown2}`,
|
|
1159
|
+
`fetch ${wellKnown2} #2`,
|
|
1160
|
+
"consumed #2",
|
|
1161
|
+
`close ${wellKnown2}`,
|
|
1162
|
+
`open ${documentUrl}`,
|
|
1163
|
+
`fetch ${documentUrl} #3`,
|
|
1164
|
+
"consumed #3",
|
|
1165
|
+
`close ${documentUrl}`
|
|
1166
|
+
]);
|
|
1167
|
+
recorder.assertInvariants();
|
|
1168
|
+
});
|
|
1169
|
+
await t.step("non-2xx responses", async () => {
|
|
1170
|
+
const recorder = recordHops(() => ({
|
|
1171
|
+
status: 404,
|
|
1172
|
+
body: "not found"
|
|
1173
|
+
}));
|
|
1174
|
+
assertEquals(await getNodeInfoInternal("https://example.com/", {}, { openHop: recorder.openHop }), void 0);
|
|
1175
|
+
assertEquals(await getNodeInfoInternal(documentUrl, { direct: true }, { openHop: recorder.openHop }), void 0);
|
|
1176
|
+
assertEquals(recorder.events, [
|
|
1177
|
+
`open ${wellKnown}`,
|
|
1178
|
+
`fetch ${wellKnown} #1`,
|
|
1179
|
+
"cancel #1",
|
|
1180
|
+
`close ${wellKnown}`,
|
|
1181
|
+
`open ${documentUrl}`,
|
|
1182
|
+
`fetch ${documentUrl} #2`,
|
|
1183
|
+
"cancel #2",
|
|
1184
|
+
`close ${documentUrl}`
|
|
1185
|
+
]);
|
|
1186
|
+
recorder.assertInvariants();
|
|
1187
|
+
});
|
|
1188
|
+
await t.step("too many redirections", async () => {
|
|
1189
|
+
const recorder = recordHops(() => ({
|
|
1190
|
+
status: 302,
|
|
1191
|
+
headers: { Location: "/.well-known/nodeinfo" },
|
|
1192
|
+
body: "redirecting"
|
|
1193
|
+
}));
|
|
1194
|
+
assertEquals(await getNodeInfoInternal("https://example.com/", {}, { openHop: recorder.openHop }), void 0);
|
|
1195
|
+
assertEquals(recorder.events.filter((e) => e.startsWith("open ")).length, 5);
|
|
1196
|
+
assertEquals(recorder.events.filter((e) => e.startsWith("cancel ")).length, 5);
|
|
1197
|
+
recorder.assertInvariants();
|
|
1198
|
+
});
|
|
1199
|
+
await t.step("failed redirect body cancellation", async () => {
|
|
1200
|
+
const recorder = recordHops((url) => {
|
|
1201
|
+
switch (url.href) {
|
|
1202
|
+
case wellKnown: return {
|
|
1203
|
+
status: 302,
|
|
1204
|
+
headers: { Location: "/.well-known/nodeinfo2" },
|
|
1205
|
+
body: "redirecting",
|
|
1206
|
+
cancelFails: true
|
|
1207
|
+
};
|
|
1208
|
+
case wellKnown2: return { body: descriptor };
|
|
1209
|
+
default: return {
|
|
1210
|
+
status: 404,
|
|
1211
|
+
body: "not found",
|
|
1212
|
+
cancelFails: true
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1216
|
+
const records = [];
|
|
1217
|
+
await configure({
|
|
1218
|
+
sinks: { buffer: (record) => records.push(record) },
|
|
1219
|
+
loggers: [{
|
|
1220
|
+
category: "fedify",
|
|
1221
|
+
sinks: ["buffer"],
|
|
1222
|
+
lowestLevel: "debug"
|
|
1223
|
+
}, {
|
|
1224
|
+
category: ["logtape", "meta"],
|
|
1225
|
+
sinks: []
|
|
1226
|
+
}],
|
|
1227
|
+
reset: true
|
|
1228
|
+
});
|
|
1229
|
+
try {
|
|
1230
|
+
assertEquals(await getNodeInfoInternal("https://example.com/", {}, { openHop: recorder.openHop }), void 0);
|
|
1231
|
+
const failures = records.filter((r) => r.rawMessage === "Failed to cancel the response body from {url}: {error}");
|
|
1232
|
+
assertEquals(failures.map((r) => [r.level, r.properties.url]), [["debug", wellKnown], ["debug", documentUrl]]);
|
|
1233
|
+
for (const { properties: { error } } of failures) {
|
|
1234
|
+
assertInstanceOf(error, Error);
|
|
1235
|
+
assertEquals(error.message, "Cancellation failed");
|
|
1236
|
+
}
|
|
1237
|
+
} finally {
|
|
1238
|
+
await reset();
|
|
1239
|
+
}
|
|
1240
|
+
assertEquals(recorder.events, [
|
|
1241
|
+
`open ${wellKnown}`,
|
|
1242
|
+
`fetch ${wellKnown} #1`,
|
|
1243
|
+
"cancel #1",
|
|
1244
|
+
`close ${wellKnown}`,
|
|
1245
|
+
`open ${wellKnown2}`,
|
|
1246
|
+
`fetch ${wellKnown2} #2`,
|
|
1247
|
+
"consumed #2",
|
|
1248
|
+
`close ${wellKnown2}`,
|
|
1249
|
+
`open ${documentUrl}`,
|
|
1250
|
+
`fetch ${documentUrl} #3`,
|
|
1251
|
+
"cancel #3",
|
|
1252
|
+
`close ${documentUrl}`
|
|
1253
|
+
]);
|
|
1254
|
+
recorder.assertInvariants();
|
|
1255
|
+
});
|
|
1256
|
+
await t.step("never-settling body cancellation", async () => {
|
|
1257
|
+
const recorder = recordHops((url) => {
|
|
1258
|
+
switch (url.href) {
|
|
1259
|
+
case wellKnown: return {
|
|
1260
|
+
status: 302,
|
|
1261
|
+
headers: { Location: "/.well-known/nodeinfo2" },
|
|
1262
|
+
body: "redirecting",
|
|
1263
|
+
cancelNeverSettles: true
|
|
1264
|
+
};
|
|
1265
|
+
case wellKnown2: return { body: descriptor };
|
|
1266
|
+
default: return {
|
|
1267
|
+
status: 404,
|
|
1268
|
+
body: "not found",
|
|
1269
|
+
cancelNeverSettles: true
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
assertEquals(await settleWithin(getNodeInfoInternal("https://example.com/", {}, { openHop: recorder.openHop })), void 0);
|
|
1274
|
+
assertEquals(recorder.events, [
|
|
1275
|
+
`open ${wellKnown}`,
|
|
1276
|
+
`fetch ${wellKnown} #1`,
|
|
1277
|
+
"cancel #1",
|
|
1278
|
+
`close ${wellKnown}`,
|
|
1279
|
+
`open ${wellKnown2}`,
|
|
1280
|
+
`fetch ${wellKnown2} #2`,
|
|
1281
|
+
"consumed #2",
|
|
1282
|
+
`close ${wellKnown2}`,
|
|
1283
|
+
`open ${documentUrl}`,
|
|
1284
|
+
`fetch ${documentUrl} #3`,
|
|
1285
|
+
"cancel #3",
|
|
1286
|
+
`close ${documentUrl}`
|
|
1287
|
+
]);
|
|
1288
|
+
recorder.assertInvariants();
|
|
1289
|
+
});
|
|
1290
|
+
await t.step("failure while consuming", async () => {
|
|
1291
|
+
const recorder = recordHops(() => ({ body: "not json" }));
|
|
1292
|
+
assertEquals(await getNodeInfoInternal("https://example.com/", {}, { openHop: recorder.openHop }), void 0);
|
|
1293
|
+
assertEquals(recorder.events, [
|
|
1294
|
+
`open ${wellKnown}`,
|
|
1295
|
+
`fetch ${wellKnown} #1`,
|
|
1296
|
+
"consumed #1",
|
|
1297
|
+
`close ${wellKnown}`
|
|
1298
|
+
]);
|
|
1299
|
+
recorder.assertInvariants();
|
|
1300
|
+
});
|
|
1301
|
+
});
|
|
1302
|
+
/**
|
|
1303
|
+
* Rejects if the given promise does not settle within the timeout, so that
|
|
1304
|
+
* a hang fails the test instead of blocking it.
|
|
1305
|
+
*/
|
|
1306
|
+
async function settleWithin(promise, ms = 5e3) {
|
|
1307
|
+
let timer;
|
|
1308
|
+
try {
|
|
1309
|
+
return await Promise.race([promise, new Promise((_, reject) => {
|
|
1310
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`Did not settle within ${ms} ms.`)), ms);
|
|
1311
|
+
})]);
|
|
1312
|
+
} finally {
|
|
1313
|
+
clearTimeout(timer);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
function neverCancellableResponse(init) {
|
|
1317
|
+
return new Response(new ReadableStream({
|
|
1318
|
+
start(controller) {
|
|
1319
|
+
controller.enqueue(new TextEncoder().encode("never cancelled"));
|
|
1320
|
+
},
|
|
1321
|
+
cancel: () => new Promise(() => {})
|
|
1322
|
+
}), init);
|
|
1323
|
+
}
|
|
1324
|
+
test("getNodeInfo() does not wait for cancelling response bodies", async (t) => {
|
|
1325
|
+
const rawDocument = {
|
|
1326
|
+
software: {
|
|
1327
|
+
name: "foo",
|
|
1328
|
+
version: "1.2.3"
|
|
1329
|
+
},
|
|
1330
|
+
protocols: ["activitypub"],
|
|
1331
|
+
usage: {
|
|
1332
|
+
users: {},
|
|
1333
|
+
localPosts: 0,
|
|
1334
|
+
localComments: 0
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
esm_default.mockGlobal();
|
|
1338
|
+
try {
|
|
1339
|
+
await t.step("redirect", async () => {
|
|
1340
|
+
esm_default.removeRoutes();
|
|
1341
|
+
esm_default.get("https://example.com/.well-known/nodeinfo", () => neverCancellableResponse({
|
|
1342
|
+
status: 302,
|
|
1343
|
+
headers: { Location: "/.well-known/nodeinfo2" }
|
|
1344
|
+
}));
|
|
1345
|
+
esm_default.get("https://example.com/.well-known/nodeinfo2", () => Response.json({ links: [{
|
|
1346
|
+
rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
|
1347
|
+
href: "https://example.com/nodeinfo/2.1"
|
|
1348
|
+
}] }));
|
|
1349
|
+
esm_default.get("https://example.com/nodeinfo/2.1", () => Response.json(rawDocument));
|
|
1350
|
+
assertEquals(await settleWithin(getNodeInfoDirect("https://example.com/", { parse: "none" })), rawDocument);
|
|
1351
|
+
});
|
|
1352
|
+
await t.step("non-2xx responses", async () => {
|
|
1353
|
+
esm_default.removeRoutes();
|
|
1354
|
+
esm_default.get("https://example.com/.well-known/nodeinfo", () => neverCancellableResponse({ status: 404 }));
|
|
1355
|
+
esm_default.get("https://example.com/nodeinfo/2.1", () => neverCancellableResponse({ status: 404 }));
|
|
1356
|
+
assertEquals(await settleWithin(getNodeInfoDirect("https://example.com/")), void 0);
|
|
1357
|
+
assertEquals(await settleWithin(getNodeInfoDirect("https://example.com/nodeinfo/2.1", { direct: true })), void 0);
|
|
1358
|
+
});
|
|
1359
|
+
} finally {
|
|
1360
|
+
esm_default.hardReset();
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1045
1363
|
//#endregion
|
|
1046
1364
|
export {};
|
|
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-DflMZha5.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
|
|
8
|
-
import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-
|
|
8
|
+
import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-DzaMP9BP.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
package/dist/nodeinfo/mod.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_types = require("../types-
|
|
4
|
+
const require_types = require("../types-DOvyymM4.cjs");
|
|
5
5
|
exports.getNodeInfo = require_types.getNodeInfo;
|
|
6
6
|
exports.nodeInfoToJson = require_types.nodeInfoToJson;
|
|
7
7
|
exports.parseNodeInfo = require_types.parseNodeInfo;
|
package/dist/nodeinfo/mod.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-
|
|
2
|
+
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-BIBzqEIp.cjs";
|
|
3
3
|
export { type GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, type ParseNodeInfoOptions, Protocol, Services, Software, Usage, getNodeInfo, nodeInfoToJson, parseNodeInfo };
|
package/dist/nodeinfo/mod.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-
|
|
2
|
+
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-jE7oGvRh.js";
|
|
3
3
|
export { type GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, type ParseNodeInfoOptions, Protocol, Services, Software, Usage, getNodeInfo, nodeInfoToJson, parseNodeInfo };
|
package/dist/nodeinfo/mod.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-
|
|
3
|
+
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-B1_pRFE_.js";
|
|
4
4
|
export { getNodeInfo, nodeInfoToJson, parseNodeInfo };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-BAtjc8bx.mjs";
|
|
5
|
+
import { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-BD-PBpNB.mjs";
|
|
6
6
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-
|
|
3
|
+
import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-Dwj7bNhv.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { o as validateCryptoKey, r as fetchKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-BAtjc8bx.mjs";
|
|
5
|
+
import { o as validateCryptoKey, r as fetchKey } from "./key-BD-PBpNB.mjs";
|
|
6
6
|
import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
const require_chunk = require("./chunk-DDcVe30Y.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
4
|
+
const require_http = require("./http-5u2wDmjl.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let _fedify_vocab = require("@fedify/vocab");
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|