@fedify/fedify 2.3.0-dev.1184 → 2.3.0-dev.1190

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.
Files changed (76) hide show
  1. package/dist/{builder-xf4uGHKt.mjs → builder-BzgNpXoY.mjs} +2 -2
  2. package/dist/circuit-breaker-CSWsyoef.mjs +337 -0
  3. package/dist/compat/mod.d.cts +1 -1
  4. package/dist/compat/mod.d.ts +1 -1
  5. package/dist/compat/transformers.test.mjs +1 -1
  6. package/dist/{context-CRXCkTM6.d.cts → context-DMHK7jqX.d.cts} +224 -3
  7. package/dist/{context-MgCh7YGu.d.ts → context-K9cg8oGx.d.ts} +224 -3
  8. package/dist/{deno-DQ_yA8Nd.mjs → deno-CoAwVm1I.mjs} +1 -1
  9. package/dist/{docloader-DrvKyR5O.mjs → docloader-hPqZT20O.mjs} +2 -2
  10. package/dist/federation/builder.test.mjs +1 -1
  11. package/dist/federation/circuit-breaker.test.d.mts +2 -0
  12. package/dist/federation/circuit-breaker.test.mjs +446 -0
  13. package/dist/federation/collection.test.mjs +1 -1
  14. package/dist/federation/handler.test.mjs +3 -3
  15. package/dist/federation/idempotency.test.mjs +2 -2
  16. package/dist/federation/keycache.test.mjs +1 -1
  17. package/dist/federation/metrics.test.mjs +16 -1
  18. package/dist/federation/middleware.test.mjs +817 -6
  19. package/dist/federation/mod.cjs +4 -1
  20. package/dist/federation/mod.d.cts +3 -3
  21. package/dist/federation/mod.d.ts +3 -3
  22. package/dist/federation/mod.js +2 -2
  23. package/dist/federation/negotiation.test.mjs +1 -1
  24. package/dist/federation/retry.test.mjs +1 -1
  25. package/dist/federation/send.test.mjs +43 -10
  26. package/dist/federation/temporal.test.mjs +1 -1
  27. package/dist/federation/webfinger.test.mjs +1 -1
  28. package/dist/{getMachineId-bsd-BY01PL1n.mjs → getMachineId-bsd-Bn0le7-J.mjs} +1 -1
  29. package/dist/{getMachineId-darwin-Dr1gkBkp.mjs → getMachineId-darwin-CVjKuDgj.mjs} +1 -1
  30. package/dist/{getMachineId-win-QEYwcJiy.mjs → getMachineId-win-c5zxTSS1.mjs} +1 -1
  31. package/dist/{http-fmumSl9Q.cjs → http-BAarxBe5.cjs} +30 -5
  32. package/dist/{http-CevxpgFA.mjs → http-CSwCAQ-H.mjs} +3 -3
  33. package/dist/{http-CYANb3Kf.js → http-Dq_qElWc.js} +25 -6
  34. package/dist/{key-343lgYrZ.mjs → key-DYK_T_PD.mjs} +2 -2
  35. package/dist/{kv-cache-gsEcr_hP.js → kv-cache-BhPocHdd.js} +1 -1
  36. package/dist/{kv-cache-BPzk3HyE.mjs → kv-cache-CFzIDCMJ.mjs} +1 -1
  37. package/dist/{kv-cache-owsCV_hm.cjs → kv-cache-Ds1kjvnu.cjs} +1 -1
  38. package/dist/{ld-DbTiidUm.mjs → ld-BdcT_irA.mjs} +3 -3
  39. package/dist/{metrics-CE6rG2kw.mjs → metrics-Ci97wkob.mjs} +25 -6
  40. package/dist/{middleware-WclBYQsJ.mjs → middleware-BUGT2LmO.mjs} +279 -40
  41. package/dist/{middleware-CbSTUiWU.js → middleware-C-C_I_wJ.js} +615 -32
  42. package/dist/{middleware-DWiKzrOa.cjs → middleware-ddMAHsyF.cjs} +632 -31
  43. package/dist/{middleware-BgTxce56.mjs → middleware-hWs3qtrr.mjs} +1 -1
  44. package/dist/{mod-CpQHB3Ys.d.ts → mod-CfOFqS0w.d.ts} +1 -1
  45. package/dist/{mod-C7HOzGqH.d.cts → mod-YLnSsEHY.d.cts} +1 -1
  46. package/dist/mod.cjs +7 -4
  47. package/dist/mod.d.cts +4 -4
  48. package/dist/mod.d.ts +4 -4
  49. package/dist/mod.js +5 -5
  50. package/dist/nodeinfo/handler.test.mjs +1 -1
  51. package/dist/{owner-Curbe8kx.mjs → owner-B8ePZh4q.mjs} +2 -2
  52. package/dist/{proof-BgsSe250.cjs → proof-CXdtqYKw.cjs} +1 -1
  53. package/dist/{proof-AVmt2hSm.mjs → proof-CzqluPMh.mjs} +3 -3
  54. package/dist/{proof-CmCCjMkp.js → proof-Dq_RyTjd.js} +1 -1
  55. package/dist/{send-DZIiaTas.mjs → send-NzJqiStx.mjs} +21 -7
  56. package/dist/sig/http.test.mjs +2 -2
  57. package/dist/sig/key.test.mjs +1 -1
  58. package/dist/sig/ld.test.mjs +2 -2
  59. package/dist/sig/mod.cjs +2 -2
  60. package/dist/sig/mod.js +2 -2
  61. package/dist/sig/owner.test.mjs +1 -1
  62. package/dist/sig/proof.test.mjs +1 -1
  63. package/dist/{temporal-Fwsn9wyy.mjs → temporal-CnhE0LLn.mjs} +1 -1
  64. package/dist/testing/mod.d.mts +36 -2
  65. package/dist/utils/docloader.test.mjs +2 -2
  66. package/dist/utils/kv-cache.test.mjs +1 -1
  67. package/dist/utils/mod.cjs +1 -1
  68. package/dist/utils/mod.js +1 -1
  69. package/package.json +7 -7
  70. /package/dist/{collection-CA3V5zyK.mjs → collection-Cc3DVAhE.mjs} +0 -0
  71. /package/dist/{execAsync-Dxb7rNf3.mjs → execAsync-Dmet7-28.mjs} +0 -0
  72. /package/dist/{getMachineId-linux-Bbhofx-s.mjs → getMachineId-linux-DbG4BXa-.mjs} +0 -0
  73. /package/dist/{getMachineId-unsupported-dIOte2Ct.mjs → getMachineId-unsupported-lC8T9hPE.mjs} +0 -0
  74. /package/dist/{keycache-BYMd8q7F.mjs → keycache-BeU0LCII.mjs} +0 -0
  75. /package/dist/{negotiation-CDW-_gUU.mjs → negotiation-DDstyBvc.mjs} +0 -0
  76. /package/dist/{retry-_VvV0h9f.mjs → retry-CXg_MBI-.mjs} +0 -0
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("../chunk-DDcVe30Y.cjs");
5
- const require_middleware = require("../middleware-DWiKzrOa.cjs");
5
+ const require_middleware = require("../middleware-ddMAHsyF.cjs");
6
6
  let _logtape_logtape = require("@logtape/logtape");
7
7
  let _fedify_uri_template = require("@fedify/uri-template");
8
8
  let es_toolkit = require("es-toolkit");
@@ -499,6 +499,7 @@ function convertRouterError(func) {
499
499
  }
500
500
  }
501
501
  //#endregion
502
+ exports.CircuitBreaker = require_middleware.CircuitBreaker;
502
503
  exports.InProcessMessageQueue = InProcessMessageQueue;
503
504
  exports.MemoryKvStore = MemoryKvStore;
504
505
  exports.ParallelMessageQueue = ParallelMessageQueue;
@@ -511,5 +512,7 @@ exports.createFederation = require_middleware.createFederation;
511
512
  exports.createFederationBuilder = require_middleware.createFederationBuilder;
512
513
  exports.digest = require_middleware.digest;
513
514
  exports.handleWebFinger = require_middleware.handleWebFinger;
515
+ exports.normalizeCircuitBreakerOptions = require_middleware.normalizeCircuitBreakerOptions;
516
+ exports.parseCircuitBreakerKvState = require_middleware.parseCircuitBreakerKvState;
514
517
  exports.respondWithObject = require_middleware.respondWithObject;
515
518
  exports.respondWithObjectIfAcceptable = require_middleware.respondWithObjectIfAcceptable;
@@ -1,6 +1,6 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as CustomCollectionDispatcher, A as FederationKvPrefixes, B as RespondWithObjectOptions, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as ActorHandleMapper, H as respondWithObjectIfAcceptable, I as RetryPolicy, J as CollectionCounter, K as ActorKeyPairsDispatcher, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CustomCollectionCursor, R as Message, S as FederationStartQueueOptions, T as InboxChallengePolicy, U as ActorAliasMapper, V as respondWithObject, W as ActorDispatcher, X as CollectionDispatcher, Y as CollectionCursor, Z as CustomCollectionCounter, _ as Federatable, _t as digest, a as GetSignedKeyOptions, at as OutboxErrorHandler, b as FederationFetchOptions, c as ParseUriResult, ct as OutboxPermanentFailureHandler, d as SendActivityOptions, dt as UnverifiedActivityReason, et as InboxErrorHandler, f as SendActivityOptionsForCollection, ft as WebFingerLinksDispatcher, g as CustomCollectionCallbackSetters, gt as buildCollectionSynchronizationHeader, h as ConstructorWithTypeId, ht as PageItems, i as GetActorOptions, it as ObjectDispatcher, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as SharedInboxKeyDispatcher, m as CollectionCallbackSetters, mt as SenderKeyPair, n as Context, nt as NodeInfoDispatcher, o as InboxContext, ot as OutboxListener, p as ActorCallbackSetters, pt as SendActivityError, q as AuthorizePredicate, r as ForwardActivityOptions, rt as ObjectAuthorizePredicate, s as OutboxContext, st as OutboxListenerErrorHandler, t as ActorKeyPair, tt as InboxListener, u as RouteActivityOptions, ut as UnverifiedActivityHandler, v as Federation, w as IdempotencyStrategy, x as FederationOptions, y as FederationBuilder, z as createFederationBuilder } from "../context-CRXCkTM6.cjs";
2
+ import { $ as CustomCollectionDispatcher, A as FederationKvPrefixes, B as RespondWithObjectOptions, C as IdempotencyKeyCallback, Ct as CircuitBreakerKvState, D as ObjectCallbackSetters, Dt as NormalizedCircuitBreakerOptions, E as InboxListenerSetters, Et as CircuitBreakerStateChange, F as RetryContext, G as ActorHandleMapper, H as respondWithObjectIfAcceptable, I as RetryPolicy, J as CollectionCounter, K as ActorKeyPairsDispatcher, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as normalizeCircuitBreakerOptions, P as CreateExponentialBackoffPolicyOptions, Q as CustomCollectionCursor, R as Message, S as FederationStartQueueOptions, St as CircuitBreakerFailurePolicy, T as InboxChallengePolicy, Tt as CircuitBreakerState, U as ActorAliasMapper, V as respondWithObject, W as ActorDispatcher, X as CollectionDispatcher, Y as CollectionCursor, Z as CustomCollectionCounter, _ as Federatable, _t as digest, a as GetSignedKeyOptions, at as OutboxErrorHandler, b as FederationFetchOptions, bt as CircuitBreakerBeforeSendDecision, c as ParseUriResult, ct as OutboxPermanentFailureHandler, d as SendActivityOptions, dt as UnverifiedActivityReason, et as InboxErrorHandler, f as SendActivityOptionsForCollection, ft as WebFingerLinksDispatcher, g as CustomCollectionCallbackSetters, gt as buildCollectionSynchronizationHeader, h as ConstructorWithTypeId, ht as PageItems, i as GetActorOptions, it as ObjectDispatcher, j as FederationOrigin, k as Rfc6570Expression, kt as parseCircuitBreakerKvState, l as RequestContext, lt as SharedInboxKeyDispatcher, m as CollectionCallbackSetters, mt as SenderKeyPair, n as Context, nt as NodeInfoDispatcher, o as InboxContext, ot as OutboxListener, p as ActorCallbackSetters, pt as SendActivityError, q as AuthorizePredicate, r as ForwardActivityOptions, rt as ObjectAuthorizePredicate, s as OutboxContext, st as OutboxListenerErrorHandler, t as ActorKeyPair, tt as InboxListener, u as RouteActivityOptions, ut as UnverifiedActivityHandler, v as Federation, vt as CircuitBreaker, w as IdempotencyStrategy, wt as CircuitBreakerOptions, x as FederationOptions, xt as CircuitBreakerCreateOptions, y as FederationBuilder, yt as CircuitBreakerActivityDrop, z as createFederationBuilder } from "../context-DMHK7jqX.cjs";
3
3
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-gJ8LYbxX.cjs";
4
4
  import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-D8uSFzxe.cjs";
5
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-C7HOzGqH.cjs";
6
- export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
5
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-YLnSsEHY.cjs";
6
+ export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,6 +1,6 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as CustomCollectionDispatcher, A as FederationKvPrefixes, B as RespondWithObjectOptions, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as ActorHandleMapper, H as respondWithObjectIfAcceptable, I as RetryPolicy, J as CollectionCounter, K as ActorKeyPairsDispatcher, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CustomCollectionCursor, R as Message, S as FederationStartQueueOptions, T as InboxChallengePolicy, U as ActorAliasMapper, V as respondWithObject, W as ActorDispatcher, X as CollectionDispatcher, Y as CollectionCursor, Z as CustomCollectionCounter, _ as Federatable, _t as digest, a as GetSignedKeyOptions, at as OutboxErrorHandler, b as FederationFetchOptions, c as ParseUriResult, ct as OutboxPermanentFailureHandler, d as SendActivityOptions, dt as UnverifiedActivityReason, et as InboxErrorHandler, f as SendActivityOptionsForCollection, ft as WebFingerLinksDispatcher, g as CustomCollectionCallbackSetters, gt as buildCollectionSynchronizationHeader, h as ConstructorWithTypeId, ht as PageItems, i as GetActorOptions, it as ObjectDispatcher, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as SharedInboxKeyDispatcher, m as CollectionCallbackSetters, mt as SenderKeyPair, n as Context, nt as NodeInfoDispatcher, o as InboxContext, ot as OutboxListener, p as ActorCallbackSetters, pt as SendActivityError, q as AuthorizePredicate, r as ForwardActivityOptions, rt as ObjectAuthorizePredicate, s as OutboxContext, st as OutboxListenerErrorHandler, t as ActorKeyPair, tt as InboxListener, u as RouteActivityOptions, ut as UnverifiedActivityHandler, v as Federation, w as IdempotencyStrategy, x as FederationOptions, y as FederationBuilder, z as createFederationBuilder } from "../context-MgCh7YGu.js";
2
+ import { $ as CustomCollectionDispatcher, A as FederationKvPrefixes, B as RespondWithObjectOptions, C as IdempotencyKeyCallback, Ct as CircuitBreakerKvState, D as ObjectCallbackSetters, Dt as NormalizedCircuitBreakerOptions, E as InboxListenerSetters, Et as CircuitBreakerStateChange, F as RetryContext, G as ActorHandleMapper, H as respondWithObjectIfAcceptable, I as RetryPolicy, J as CollectionCounter, K as ActorKeyPairsDispatcher, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as normalizeCircuitBreakerOptions, P as CreateExponentialBackoffPolicyOptions, Q as CustomCollectionCursor, R as Message, S as FederationStartQueueOptions, St as CircuitBreakerFailurePolicy, T as InboxChallengePolicy, Tt as CircuitBreakerState, U as ActorAliasMapper, V as respondWithObject, W as ActorDispatcher, X as CollectionDispatcher, Y as CollectionCursor, Z as CustomCollectionCounter, _ as Federatable, _t as digest, a as GetSignedKeyOptions, at as OutboxErrorHandler, b as FederationFetchOptions, bt as CircuitBreakerBeforeSendDecision, c as ParseUriResult, ct as OutboxPermanentFailureHandler, d as SendActivityOptions, dt as UnverifiedActivityReason, et as InboxErrorHandler, f as SendActivityOptionsForCollection, ft as WebFingerLinksDispatcher, g as CustomCollectionCallbackSetters, gt as buildCollectionSynchronizationHeader, h as ConstructorWithTypeId, ht as PageItems, i as GetActorOptions, it as ObjectDispatcher, j as FederationOrigin, k as Rfc6570Expression, kt as parseCircuitBreakerKvState, l as RequestContext, lt as SharedInboxKeyDispatcher, m as CollectionCallbackSetters, mt as SenderKeyPair, n as Context, nt as NodeInfoDispatcher, o as InboxContext, ot as OutboxListener, p as ActorCallbackSetters, pt as SendActivityError, q as AuthorizePredicate, r as ForwardActivityOptions, rt as ObjectAuthorizePredicate, s as OutboxContext, st as OutboxListenerErrorHandler, t as ActorKeyPair, tt as InboxListener, u as RouteActivityOptions, ut as UnverifiedActivityHandler, v as Federation, vt as CircuitBreaker, w as IdempotencyStrategy, wt as CircuitBreakerOptions, x as FederationOptions, xt as CircuitBreakerCreateOptions, y as FederationBuilder, yt as CircuitBreakerActivityDrop, z as createFederationBuilder } from "../context-K9cg8oGx.js";
3
3
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-D6hNiMTK.js";
4
4
  import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-D-nlpY04.js";
5
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-CpQHB3Ys.js";
6
- export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
5
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-CfOFqS0w.js";
6
+ export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-CbSTUiWU.js";
3
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as SendActivityError, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "../middleware-C-C_I_wJ.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { Router as Router$1, RouterError as RouterError$1, assertPath, isPath } from "@fedify/uri-template";
6
6
  import { isEqual } from "es-toolkit";
@@ -497,4 +497,4 @@ function convertRouterError(func) {
497
497
  }
498
498
  }
499
499
  //#endregion
500
- export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, SendActivityError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
500
+ export { CircuitBreaker, InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, SendActivityError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-BBjXFNOb.mjs";
5
5
  import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
6
6
  import { t as assert } from "../assert-OguE97r2.mjs";
7
- import { t as acceptsJsonLd } from "../negotiation-CDW-_gUU.mjs";
7
+ import { t as acceptsJsonLd } from "../negotiation-DDstyBvc.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/negotiation.test.ts
10
10
  test("acceptsJsonLd()", () => {
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { l as AssertionError, t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
5
  import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
6
- import { t as createExponentialBackoffPolicy } from "../retry-_VvV0h9f.mjs";
6
+ import { t as createExponentialBackoffPolicy } from "../retry-CXg_MBI-.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  //#region src/federation/retry.test.ts
9
9
  test("createExponentialBackoffPolicy()", () => {
@@ -9,12 +9,13 @@ import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
10
10
  import { t as assert } from "../assert-OguE97r2.mjs";
11
11
  import { t as esm_default } from "../esm-BQRw925N.mjs";
12
- import { l as verifyRequest } from "../http-CevxpgFA.mjs";
12
+ import { l as verifyRequest } from "../http-CSwCAQ-H.mjs";
13
13
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
14
- import { t as doesActorOwnKey } from "../owner-Curbe8kx.mjs";
15
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-DZIiaTas.mjs";
14
+ import { t as doesActorOwnKey } from "../owner-B8ePZh4q.mjs";
15
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-NzJqiStx.mjs";
16
16
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
17
17
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
+ import { FetchError } from "@fedify/vocab-runtime";
18
19
  //#region ../../node_modules/.pnpm/@opentelemetry+sdk-metrics@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationTemporality.js
19
20
  var require_AggregationTemporality = /* @__PURE__ */ __commonJSMin(((exports) => {
20
21
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -2525,19 +2526,19 @@ var require_getMachineId = /* @__PURE__ */ __commonJSMin(((exports) => {
2525
2526
  async function getMachineId() {
2526
2527
  if (!getMachineIdImpl) switch (process$1.platform) {
2527
2528
  case "darwin":
2528
- getMachineIdImpl = (await import("../getMachineId-darwin-Dr1gkBkp.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2529
+ getMachineIdImpl = (await import("../getMachineId-darwin-CVjKuDgj.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2529
2530
  break;
2530
2531
  case "linux":
2531
- getMachineIdImpl = (await import("../getMachineId-linux-Bbhofx-s.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2532
+ getMachineIdImpl = (await import("../getMachineId-linux-DbG4BXa-.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2532
2533
  break;
2533
2534
  case "freebsd":
2534
- getMachineIdImpl = (await import("../getMachineId-bsd-BY01PL1n.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2535
+ getMachineIdImpl = (await import("../getMachineId-bsd-Bn0le7-J.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2535
2536
  break;
2536
2537
  case "win32":
2537
- getMachineIdImpl = (await import("../getMachineId-win-QEYwcJiy.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2538
+ getMachineIdImpl = (await import("../getMachineId-win-c5zxTSS1.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2538
2539
  break;
2539
2540
  default:
2540
- getMachineIdImpl = (await import("../getMachineId-unsupported-dIOte2Ct.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2541
+ getMachineIdImpl = (await import("../getMachineId-unsupported-lC8T9hPE.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
2541
2542
  break;
2542
2543
  }
2543
2544
  return getMachineIdImpl();
@@ -4604,6 +4605,7 @@ test("sendActivity()", async (t) => {
4604
4605
  });
4605
4606
  esm_default.post("https://example.com/inbox2", {
4606
4607
  status: 500,
4608
+ headers: { "Retry-After": "120" },
4607
4609
  body: "something went wrong"
4608
4610
  });
4609
4611
  await t.step("failure", async () => {
@@ -4646,8 +4648,39 @@ test("sendActivity()", async (t) => {
4646
4648
  assertEquals(e.statusCode, 500);
4647
4649
  assertEquals(e.inbox, new URL("https://example.com/inbox2"));
4648
4650
  assertEquals(e.responseBody, "something went wrong");
4651
+ assertEquals(e.responseHeaders.get("Retry-After"), "120");
4649
4652
  }
4650
4653
  });
4654
+ await t.step("signed challenge retry transport errors throw FetchError", async () => {
4655
+ const activity = {
4656
+ "@context": "https://www.w3.org/ns/activitystreams",
4657
+ "type": "Create",
4658
+ "id": "https://example.com/activity",
4659
+ "actor": "https://example.com/person"
4660
+ };
4661
+ const failure = /* @__PURE__ */ new TypeError("challenge retry connection reset");
4662
+ let requestCount = 0;
4663
+ esm_default.post("https://example.com/inbox-challenge-reset", () => {
4664
+ requestCount++;
4665
+ if (requestCount === 1) return new Response("Unauthorized", {
4666
+ status: 401,
4667
+ headers: { "Accept-Signature": "sig1=(\"@method\" \"@target-uri\" \"@authority\" \"content-digest\");created;nonce=\"retry-nonce\"" }
4668
+ });
4669
+ throw failure;
4670
+ });
4671
+ const error = await assertRejects(() => sendActivity({
4672
+ activity,
4673
+ activityId: "https://example.com/activity",
4674
+ keys: [{
4675
+ privateKey: rsaPrivateKey2,
4676
+ keyId: rsaPublicKey2.id
4677
+ }],
4678
+ inbox: new URL("https://example.com/inbox-challenge-reset")
4679
+ }), FetchError, "challenge retry connection reset");
4680
+ assertEquals(error.url.href, "https://example.com/inbox-challenge-reset");
4681
+ assertEquals(error.cause, failure);
4682
+ assertEquals(requestCount, 2);
4683
+ });
4651
4684
  esm_default.post("https://example.com/inbox-gone", {
4652
4685
  status: 410,
4653
4686
  body: "Gone"
@@ -4855,14 +4888,14 @@ test("sendActivity() records OpenTelemetry delivery metrics", async (t) => {
4855
4888
  assertEquals(sent.length, 1);
4856
4889
  assertEquals(sent[0].type, "counter");
4857
4890
  assertEquals(sent[0].value, 1);
4858
- assertEquals(sent[0].attributes["activitypub.remote.host"], "metrics.example");
4891
+ assertEquals(sent[0].attributes["activitypub.remote.host"], "metrics.example:8443");
4859
4892
  assertEquals(sent[0].attributes["activitypub.activity.type"], "https://www.w3.org/ns/activitystreams#Create");
4860
4893
  assertEquals(sent[0].attributes["activitypub.delivery.success"], true);
4861
4894
  const durations = recorder.getMeasurements("activitypub.delivery.duration");
4862
4895
  assertEquals(durations.length, 1);
4863
4896
  assertEquals(durations[0].type, "histogram");
4864
4897
  assertGreaterOrEqual(durations[0].value, 0);
4865
- assertEquals(durations[0].attributes["activitypub.remote.host"], "metrics.example");
4898
+ assertEquals(durations[0].attributes["activitypub.remote.host"], "metrics.example:8443");
4866
4899
  assertEquals(durations[0].attributes["activitypub.activity.type"], "https://www.w3.org/ns/activitystreams#Create");
4867
4900
  assertEquals(durations[0].attributes["activitypub.delivery.success"], true);
4868
4901
  recorder.clear();
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-BBjXFNOb.mjs";
5
5
  import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
6
6
  import { t as assert } from "../assert-OguE97r2.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-Fwsn9wyy.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-CnhE0LLn.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/temporal.test.ts
10
10
  test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
@@ -6,7 +6,7 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
6
  import "../std__assert-BBjXFNOb.mjs";
7
7
  import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
9
- import { o as createFederation, s as handleWebFinger } from "../middleware-WclBYQsJ.mjs";
9
+ import { o as createFederation, s as handleWebFinger } from "../middleware-BUGT2LmO.mjs";
10
10
  import { Image, Link, Person, Tombstone } from "@fedify/vocab";
11
11
  import { createTestMeterProvider, test } from "@fedify/fixture";
12
12
  //#region src/federation/webfinger.test.ts
@@ -2,7 +2,7 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as __require, t as __commonJSMin } from "./chunk-DNRtMIoB.mjs";
5
- import { t as require_execAsync } from "./execAsync-Dxb7rNf3.mjs";
5
+ import { t as require_execAsync } from "./execAsync-Dmet7-28.mjs";
6
6
  //#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-bsd.js
7
7
  var require_getMachineId_bsd = /* @__PURE__ */ __commonJSMin(((exports) => {
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,7 +2,7 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as __require, t as __commonJSMin } from "./chunk-DNRtMIoB.mjs";
5
- import { t as require_execAsync } from "./execAsync-Dxb7rNf3.mjs";
5
+ import { t as require_execAsync } from "./execAsync-Dmet7-28.mjs";
6
6
  //#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js
7
7
  var require_getMachineId_darwin = /* @__PURE__ */ __commonJSMin(((exports) => {
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,7 +2,7 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as __require, t as __commonJSMin } from "./chunk-DNRtMIoB.mjs";
5
- import { t as require_execAsync } from "./execAsync-Dxb7rNf3.mjs";
5
+ import { t as require_execAsync } from "./execAsync-Dmet7-28.mjs";
6
6
  //#region ../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-win.js
7
7
  var require_getMachineId_win = /* @__PURE__ */ __commonJSMin(((exports) => {
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,7 +11,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
11
11
  let byte_encodings_base64 = require("byte-encodings/base64");
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "2.3.0-dev.1184+caede1e4";
14
+ var version = "2.3.0-dev.1190+2dfa46e0";
15
15
  //#endregion
16
16
  //#region src/sig/accept.ts
17
17
  /**
@@ -172,6 +172,7 @@ var FederationMetrics = class {
172
172
  fanoutRecipients;
173
173
  inboxActivity;
174
174
  outboxActivity;
175
+ circuitBreakerStateChange;
175
176
  keyLookup;
176
177
  keyLookupDuration;
177
178
  documentFetch;
@@ -289,6 +290,10 @@ var FederationMetrics = class {
289
290
  description: "ActivityPub activities observed at the outbox lifecycle level: queued, retried, or abandoned. Per-recipient delivery counters live on `activitypub.delivery.*`.",
290
291
  unit: "{activity}"
291
292
  });
293
+ this.circuitBreakerStateChange = meter.createCounter("activitypub.circuit_breaker.state_change", {
294
+ description: "Outbound ActivityPub delivery circuit breaker changes.",
295
+ unit: "{change}"
296
+ });
292
297
  this.keyLookup = meter.createCounter("activitypub.key.lookup", {
293
298
  description: "Public-key lookup attempts performed by Fedify, including both cache hits and remote fetches.",
294
299
  unit: "{lookup}"
@@ -480,6 +485,12 @@ var FederationMetrics = class {
480
485
  recordOutboxActivity(result, activityType) {
481
486
  this.outboxActivity.add(1, buildActivityLifecycleAttributes(result, activityType));
482
487
  }
488
+ recordCircuitBreakerStateChange(remoteHost, state) {
489
+ this.circuitBreakerStateChange.add(1, {
490
+ "activitypub.remote.host": remoteHost,
491
+ "activitypub.circuit_breaker.state": state
492
+ });
493
+ }
483
494
  recordKeyLookup(attrs) {
484
495
  const attributes = {
485
496
  "activitypub.lookup.kind": "public_key",
@@ -627,6 +638,13 @@ function recordOutboxActivity(meterProvider, result, activityType) {
627
638
  getFederationMetrics(meterProvider).recordOutboxActivity(result, activityType);
628
639
  }
629
640
  /**
641
+ * Records one outbound delivery circuit breaker state transition.
642
+ * @since 2.3.0
643
+ */
644
+ function recordCircuitBreakerStateChange(meterProvider, remoteHost, state) {
645
+ getFederationMetrics(meterProvider).recordCircuitBreakerStateChange(remoteHost, state);
646
+ }
647
+ /**
630
648
  * Records one measurement on `activitypub.key.lookup` (counter) and
631
649
  * `activitypub.key.lookup.duration` (histogram) for a public-key lookup.
632
650
  *
@@ -747,9 +765,10 @@ function classifyFetchError(error) {
747
765
  * and as `fetched` on success. The wrapper rethrows whatever the
748
766
  * wrapped loader throws so caller behavior is unchanged.
749
767
  *
750
- * The wrapper records the hostname of the requested URL on
751
- * `activitypub.remote.host` when the URL parses; full URLs, paths, and
752
- * query strings are deliberately excluded to keep cardinality bounded.
768
+ * The wrapper records the host of the requested URL, including any
769
+ * non-default port, on `activitypub.remote.host` when the URL parses; full
770
+ * URLs, paths, and query strings are deliberately excluded to keep
771
+ * cardinality bounded.
753
772
  * HTTP status codes are recorded only when the failure carries a
754
773
  * `Response` (currently, when the wrapped loader throws a
755
774
  * {@link FetchError} with a non-`null` `response`).
@@ -860,7 +879,7 @@ function getFederationMetrics(meterProvider = _opentelemetry_api.metrics.getMete
860
879
  * @since 2.3.0
861
880
  */
862
881
  function getRemoteHost(url) {
863
- return url.hostname;
882
+ return url.host;
864
883
  }
865
884
  /**
866
885
  * Gets an elapsed duration in milliseconds from a `performance.now()` value.
@@ -2415,6 +2434,12 @@ Object.defineProperty(exports, "parseRfc9421SignatureInput", {
2415
2434
  return parseRfc9421SignatureInput;
2416
2435
  }
2417
2436
  });
2437
+ Object.defineProperty(exports, "recordCircuitBreakerStateChange", {
2438
+ enumerable: true,
2439
+ get: function() {
2440
+ return recordCircuitBreakerStateChange;
2441
+ }
2442
+ });
2418
2443
  Object.defineProperty(exports, "recordCollectionDispatchDuration", {
2419
2444
  enumerable: true,
2420
2445
  get: function() {
@@ -1,10 +1,10 @@
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-DQ_yA8Nd.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CE6rG2kw.mjs";
4
+ import { n as version, t as name } from "./deno-CoAwVm1I.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-Ci97wkob.mjs";
6
6
  import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CceiKpCy.mjs";
7
- import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-343lgYrZ.mjs";
7
+ import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-DYK_T_PD.mjs";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { CryptographicKey } from "@fedify/vocab";
10
10
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -10,7 +10,7 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } fro
10
10
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "2.3.0-dev.1184+caede1e4";
13
+ var version = "2.3.0-dev.1190+2dfa46e0";
14
14
  //#endregion
15
15
  //#region src/sig/accept.ts
16
16
  /**
@@ -171,6 +171,7 @@ var FederationMetrics = class {
171
171
  fanoutRecipients;
172
172
  inboxActivity;
173
173
  outboxActivity;
174
+ circuitBreakerStateChange;
174
175
  keyLookup;
175
176
  keyLookupDuration;
176
177
  documentFetch;
@@ -288,6 +289,10 @@ var FederationMetrics = class {
288
289
  description: "ActivityPub activities observed at the outbox lifecycle level: queued, retried, or abandoned. Per-recipient delivery counters live on `activitypub.delivery.*`.",
289
290
  unit: "{activity}"
290
291
  });
292
+ this.circuitBreakerStateChange = meter.createCounter("activitypub.circuit_breaker.state_change", {
293
+ description: "Outbound ActivityPub delivery circuit breaker changes.",
294
+ unit: "{change}"
295
+ });
291
296
  this.keyLookup = meter.createCounter("activitypub.key.lookup", {
292
297
  description: "Public-key lookup attempts performed by Fedify, including both cache hits and remote fetches.",
293
298
  unit: "{lookup}"
@@ -479,6 +484,12 @@ var FederationMetrics = class {
479
484
  recordOutboxActivity(result, activityType) {
480
485
  this.outboxActivity.add(1, buildActivityLifecycleAttributes(result, activityType));
481
486
  }
487
+ recordCircuitBreakerStateChange(remoteHost, state) {
488
+ this.circuitBreakerStateChange.add(1, {
489
+ "activitypub.remote.host": remoteHost,
490
+ "activitypub.circuit_breaker.state": state
491
+ });
492
+ }
482
493
  recordKeyLookup(attrs) {
483
494
  const attributes = {
484
495
  "activitypub.lookup.kind": "public_key",
@@ -626,6 +637,13 @@ function recordOutboxActivity(meterProvider, result, activityType) {
626
637
  getFederationMetrics(meterProvider).recordOutboxActivity(result, activityType);
627
638
  }
628
639
  /**
640
+ * Records one outbound delivery circuit breaker state transition.
641
+ * @since 2.3.0
642
+ */
643
+ function recordCircuitBreakerStateChange(meterProvider, remoteHost, state) {
644
+ getFederationMetrics(meterProvider).recordCircuitBreakerStateChange(remoteHost, state);
645
+ }
646
+ /**
629
647
  * Records one measurement on `activitypub.key.lookup` (counter) and
630
648
  * `activitypub.key.lookup.duration` (histogram) for a public-key lookup.
631
649
  *
@@ -746,9 +764,10 @@ function classifyFetchError(error) {
746
764
  * and as `fetched` on success. The wrapper rethrows whatever the
747
765
  * wrapped loader throws so caller behavior is unchanged.
748
766
  *
749
- * The wrapper records the hostname of the requested URL on
750
- * `activitypub.remote.host` when the URL parses; full URLs, paths, and
751
- * query strings are deliberately excluded to keep cardinality bounded.
767
+ * The wrapper records the host of the requested URL, including any
768
+ * non-default port, on `activitypub.remote.host` when the URL parses; full
769
+ * URLs, paths, and query strings are deliberately excluded to keep
770
+ * cardinality bounded.
752
771
  * HTTP status codes are recorded only when the failure carries a
753
772
  * `Response` (currently, when the wrapped loader throws a
754
773
  * {@link FetchError} with a non-`null` `response`).
@@ -859,7 +878,7 @@ function getFederationMetrics(meterProvider = metrics.getMeterProvider()) {
859
878
  * @since 2.3.0
860
879
  */
861
880
  function getRemoteHost(url) {
862
- return url.hostname;
881
+ return url.host;
863
882
  }
864
883
  /**
865
884
  * Gets an elapsed duration in milliseconds from a `performance.now()` value.
@@ -2312,4 +2331,4 @@ function timingSafeEqual(a, b) {
2312
2331
  return result === 0;
2313
2332
  }
2314
2333
  //#endregion
2315
- export { parseAcceptSignature as A, recordFanoutRecipients as C, recordWebFingerHandle as D, recordOutboxEnqueue as E, name as M, version as N, formatAcceptSignature as O, recordDocumentCache as S, recordOutboxActivity as T, measureSignatureKeyFetch as _, verifyRequestDetailed as a, recordCollectionRequest as b, fetchKeyDetailed as c, validateCryptoKey as d, getDurationMs as f, isAbortError$1 as g, instrumentDocumentLoader as h, verifyRequest as i, validateAcceptSignature as j, fulfillAcceptSignature as k, generateCryptoKeyPair as l, getRemoteHost as m, parseRfc9421SignatureInput as n, exportJwk as o, getFederationMetrics as p, signRequest as r, fetchKey as s, doubleKnock as t, importJwk as u, recordCollectionDispatchDuration as v, recordInboxActivity as w, recordCollectionTotalItems as x, recordCollectionPageItems as y };
2334
+ export { fulfillAcceptSignature as A, recordDocumentCache as C, recordOutboxEnqueue as D, recordOutboxActivity as E, validateAcceptSignature as M, name as N, recordWebFingerHandle as O, version as P, recordCollectionTotalItems as S, recordInboxActivity as T, measureSignatureKeyFetch as _, verifyRequestDetailed as a, recordCollectionPageItems as b, fetchKeyDetailed as c, validateCryptoKey as d, getDurationMs as f, isAbortError$1 as g, instrumentDocumentLoader as h, verifyRequest as i, parseAcceptSignature as j, formatAcceptSignature as k, generateCryptoKeyPair as l, getRemoteHost as m, parseRfc9421SignatureInput as n, exportJwk as o, getFederationMetrics as p, signRequest as r, fetchKey as s, doubleKnock as t, importJwk as u, recordCircuitBreakerStateChange as v, recordFanoutRecipients as w, recordCollectionRequest as x, recordCollectionDispatchDuration as y };
@@ -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-DQ_yA8Nd.mjs";
5
- import { g as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-CE6rG2kw.mjs";
4
+ import { n as version, t as name } from "./deno-CoAwVm1I.mjs";
5
+ import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-Ci97wkob.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { S as recordDocumentCache, d as validateCryptoKey, t as doubleKnock } from "./http-CYANb3Kf.js";
3
+ import { C as recordDocumentCache, d as validateCryptoKey, t as doubleKnock } from "./http-Dq_qElWc.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { curry } from "es-toolkit";
6
6
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { f as recordDocumentCache } from "./metrics-CE6rG2kw.mjs";
4
+ import { p as recordDocumentCache } from "./metrics-Ci97wkob.mjs";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import { preloadedContexts } from "@fedify/vocab-runtime";
7
7
  //#region src/utils/kv-cache.ts
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-fmumSl9Q.cjs");
4
+ const require_http = require("./http-BAarxBe5.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
@@ -1,9 +1,9 @@
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-DQ_yA8Nd.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CE6rG2kw.mjs";
6
- import { n as fetchKey, o as validateCryptoKey } from "./key-343lgYrZ.mjs";
4
+ import { n as version, t as name } from "./deno-CoAwVm1I.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-Ci97wkob.mjs";
6
+ import { n as fetchKey, o as validateCryptoKey } from "./key-DYK_T_PD.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,7 +1,7 @@
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-DQ_yA8Nd.mjs";
4
+ import { n as version, t as name } from "./deno-CoAwVm1I.mjs";
5
5
  import { metrics } from "@opentelemetry/api";
6
6
  import { FetchError } from "@fedify/vocab-runtime";
7
7
  //#region src/federation/metrics.ts
@@ -24,6 +24,7 @@ var FederationMetrics = class {
24
24
  fanoutRecipients;
25
25
  inboxActivity;
26
26
  outboxActivity;
27
+ circuitBreakerStateChange;
27
28
  keyLookup;
28
29
  keyLookupDuration;
29
30
  documentFetch;
@@ -141,6 +142,10 @@ var FederationMetrics = class {
141
142
  description: "ActivityPub activities observed at the outbox lifecycle level: queued, retried, or abandoned. Per-recipient delivery counters live on `activitypub.delivery.*`.",
142
143
  unit: "{activity}"
143
144
  });
145
+ this.circuitBreakerStateChange = meter.createCounter("activitypub.circuit_breaker.state_change", {
146
+ description: "Outbound ActivityPub delivery circuit breaker changes.",
147
+ unit: "{change}"
148
+ });
144
149
  this.keyLookup = meter.createCounter("activitypub.key.lookup", {
145
150
  description: "Public-key lookup attempts performed by Fedify, including both cache hits and remote fetches.",
146
151
  unit: "{lookup}"
@@ -332,6 +337,12 @@ var FederationMetrics = class {
332
337
  recordOutboxActivity(result, activityType) {
333
338
  this.outboxActivity.add(1, buildActivityLifecycleAttributes(result, activityType));
334
339
  }
340
+ recordCircuitBreakerStateChange(remoteHost, state) {
341
+ this.circuitBreakerStateChange.add(1, {
342
+ "activitypub.remote.host": remoteHost,
343
+ "activitypub.circuit_breaker.state": state
344
+ });
345
+ }
335
346
  recordKeyLookup(attrs) {
336
347
  const attributes = {
337
348
  "activitypub.lookup.kind": "public_key",
@@ -479,6 +490,13 @@ function recordOutboxActivity(meterProvider, result, activityType) {
479
490
  getFederationMetrics(meterProvider).recordOutboxActivity(result, activityType);
480
491
  }
481
492
  /**
493
+ * Records one outbound delivery circuit breaker state transition.
494
+ * @since 2.3.0
495
+ */
496
+ function recordCircuitBreakerStateChange(meterProvider, remoteHost, state) {
497
+ getFederationMetrics(meterProvider).recordCircuitBreakerStateChange(remoteHost, state);
498
+ }
499
+ /**
482
500
  * Records one measurement on `activitypub.key.lookup` (counter) and
483
501
  * `activitypub.key.lookup.duration` (histogram) for a public-key lookup.
484
502
  *
@@ -599,9 +617,10 @@ function classifyFetchError(error) {
599
617
  * and as `fetched` on success. The wrapper rethrows whatever the
600
618
  * wrapped loader throws so caller behavior is unchanged.
601
619
  *
602
- * The wrapper records the hostname of the requested URL on
603
- * `activitypub.remote.host` when the URL parses; full URLs, paths, and
604
- * query strings are deliberately excluded to keep cardinality bounded.
620
+ * The wrapper records the host of the requested URL, including any
621
+ * non-default port, on `activitypub.remote.host` when the URL parses; full
622
+ * URLs, paths, and query strings are deliberately excluded to keep
623
+ * cardinality bounded.
605
624
  * HTTP status codes are recorded only when the failure carries a
606
625
  * `Response` (currently, when the wrapped loader throws a
607
626
  * {@link FetchError} with a non-`null` `response`).
@@ -712,7 +731,7 @@ function getFederationMetrics(meterProvider = metrics.getMeterProvider()) {
712
731
  * @since 2.3.0
713
732
  */
714
733
  function getRemoteHost(url) {
715
- return url.hostname;
734
+ return url.host;
716
735
  }
717
736
  /**
718
737
  * Gets an elapsed duration in milliseconds from a `performance.now()` value.
@@ -722,4 +741,4 @@ function getDurationMs(start) {
722
741
  return Math.max(0, performance.now() - start);
723
742
  }
724
743
  //#endregion
725
- export { recordOutboxActivity as _, instrumentDocumentLoader as a, recordCollectionDispatchDuration as c, recordCollectionTotalItems as d, recordDocumentCache as f, recordKeyLookup as g, recordInboxActivity as h, getRemoteHost as i, recordCollectionPageItems as l, recordFanoutRecipients as m, getDurationMs as n, isAbortError as o, recordDocumentFetch as p, getFederationMetrics as r, measureSignatureKeyFetch as s, classifyFetchError as t, recordCollectionRequest as u, recordOutboxEnqueue as v, recordWebFingerHandle as y };
744
+ export { recordKeyLookup as _, instrumentDocumentLoader as a, recordWebFingerHandle as b, recordCircuitBreakerStateChange as c, recordCollectionRequest as d, recordCollectionTotalItems as f, recordInboxActivity as g, recordFanoutRecipients as h, getRemoteHost as i, recordCollectionDispatchDuration as l, recordDocumentFetch as m, getDurationMs as n, isAbortError as o, recordDocumentCache as p, getFederationMetrics as r, measureSignatureKeyFetch as s, classifyFetchError as t, recordCollectionPageItems as u, recordOutboxActivity as v, recordOutboxEnqueue as y };