@fedify/fedify 2.3.0-dev.1114 → 2.3.0-dev.1131
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-YlEusQth.mjs → builder-DckAhD27.mjs} +2 -2
- 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-cSUMk2da.d.ts → context-Cq18Gplu.d.ts} +3 -208
- package/dist/{context-Ch-ZLyTQ.d.cts → context-tc6VOOOL.d.cts} +3 -208
- package/dist/{deno-CF3jMgip.mjs → deno--CS-SBS9.mjs} +1 -1
- package/dist/{docloader-BENj6vQ4.mjs → docloader-k6huZLQL.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.d.mts +2 -0
- package/dist/federation/metrics.test.mjs +335 -0
- package/dist/federation/middleware.test.mjs +444 -6
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -2
- package/dist/federation/mod.d.ts +3 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-CKCgOPkX.cjs → http-CJfvRL7D.cjs} +352 -22
- package/dist/{http-BmOZYc-8.mjs → http-IywnQdiX.mjs} +7 -5
- package/dist/{http-D6LP89UO.d.ts → http-VyDTd4G3.d.cts} +8 -1
- package/dist/{http-CpzZ9zsb.js → http-cqujdCRz.js} +323 -23
- package/dist/{http-D6aw3j2U.d.cts → http-lf8Hsd91.d.ts} +8 -1
- package/dist/{key-B4I8H5Lc.mjs → key-Df3tMleh.mjs} +42 -17
- package/dist/{kv-cache-DY-XWOqM.cjs → kv-cache-L0SMQkcd.cjs} +19 -2
- package/dist/{kv-cache-Wc5ezcVW.js → kv-cache-pEejzYq4.js} +19 -2
- package/dist/{kv-cache-DihufyAQ.mjs → kv-cache-q9Ec2ryS.mjs} +19 -1
- package/dist/{ld-B5D5THhl.mjs → ld-BGwiJpl3.mjs} +3 -3
- package/dist/{metrics-ek3ilf6c.mjs → metrics-BTOMkW8C.mjs} +280 -5
- package/dist/{middleware-EqTYPG4F.cjs → middleware-B2rtdpFV.cjs} +75 -28
- package/dist/{middleware-DlcecZMq.mjs → middleware-BB0IbDow.mjs} +84 -37
- package/dist/{middleware-EI7OU6BR.mjs → middleware-Dnql59Y8.mjs} +1 -1
- package/dist/{middleware-CuZbBw-N.js → middleware-DtOddSVg.js} +75 -28
- package/dist/{mod-BDhgfjP7.d.cts → mod-B0hW12_O.d.cts} +1 -1
- package/dist/{mod-B-Lin9Sy.d.ts → mod-COIAjwRS.d.ts} +1 -1
- package/dist/{mod-C6E8rkcz.d.ts → mod-CajNYYkt.d.ts} +1 -1
- package/dist/{mod-DLrRb0dx.d.ts → mod-DFvNJcNb.d.ts} +54 -3
- package/dist/{mod-P9tE2WmM.d.cts → mod-DnzgcPcy.d.cts} +1 -1
- package/dist/{mod-BR_BB0bh.d.cts → mod-yvIXFAEi.d.cts} +54 -3
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +6 -5
- package/dist/mod.d.ts +6 -5
- package/dist/mod.js +4 -4
- package/dist/mq-D-nlpY04.d.ts +208 -0
- package/dist/mq-D8uSFzxe.d.cts +208 -0
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-DO810N24.mjs → owner-CIt4hvmM.mjs} +2 -2
- package/dist/{proof-DIoqrKnX.cjs → proof-B1_u25UV.cjs} +1 -1
- package/dist/{proof-BgfyWv7b.mjs → proof-BYlrRSmZ.mjs} +3 -3
- package/dist/{proof-Vd8-1EWh.js → proof-DMGIjHYH.js} +1 -1
- package/dist/{send-CAYXdUTk.mjs → send-DJFpze7B.mjs} +3 -3
- package/dist/sig/http.test.mjs +6 -2
- package/dist/sig/key.test.mjs +99 -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/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +67 -2
- 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 +6 -6
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-
|
|
2
|
+
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-VyDTd4G3.cjs";
|
|
3
3
|
import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
|
|
4
4
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
5
|
-
import { TracerProvider } from "@opentelemetry/api";
|
|
5
|
+
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
|
|
7
7
|
//#region src/utils/docloader.d.ts
|
|
8
8
|
/**
|
|
@@ -48,6 +48,37 @@ declare function getAuthenticatedDocumentLoader(identity: {
|
|
|
48
48
|
tracerProvider
|
|
49
49
|
}?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
|
|
50
50
|
//#endregion
|
|
51
|
+
//#region src/federation/metrics.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* The kind of remote ActivityPub lookup, recorded as
|
|
54
|
+
* `activitypub.lookup.kind` on the public-key lookup and remote document
|
|
55
|
+
* fetch metric families.
|
|
56
|
+
*
|
|
57
|
+
* - `public_key`: a public key lookup performed by `fetchKey` /
|
|
58
|
+
* `fetchKeyDetailed` (always recorded on `activitypub.key.lookup*`).
|
|
59
|
+
* - `actor`: a document fetch whose resolved value is an Actor. The
|
|
60
|
+
* bucket exists in the taxonomy for future actor-aware call sites;
|
|
61
|
+
* today, actor documents fetched through Fedify's generic document
|
|
62
|
+
* loader are still classified as `object` because the kind is decided
|
|
63
|
+
* at the loader boundary, before the response is parsed.
|
|
64
|
+
* - `object`: a generic ActivityPub object fetch through Fedify's
|
|
65
|
+
* document loader. This is the default classification for
|
|
66
|
+
* `documentLoader` invocations that do not match a more specific
|
|
67
|
+
* bucket.
|
|
68
|
+
* - `context`: a JSON-LD `@context` document fetch through Fedify's
|
|
69
|
+
* context loader.
|
|
70
|
+
* - `other`: a fetch that does not fit any of the above classifications.
|
|
71
|
+
* @since 2.3.0
|
|
72
|
+
*/
|
|
73
|
+
type LookupKind = "public_key" | "actor" | "object" | "context" | "other";
|
|
74
|
+
/**
|
|
75
|
+
* The {@link LookupKind} values that can appear on remote document fetch
|
|
76
|
+
* metrics. `public_key` lookups are reported on the
|
|
77
|
+
* `activitypub.key.lookup` metric family instead, so it is excluded here.
|
|
78
|
+
* @since 2.3.0
|
|
79
|
+
*/
|
|
80
|
+
type DocumentFetchKind = Exclude<LookupKind, "public_key">;
|
|
81
|
+
//#endregion
|
|
51
82
|
//#region src/utils/kv-cache.d.ts
|
|
52
83
|
/**
|
|
53
84
|
* The parameters for {@link kvCache} function.
|
|
@@ -75,6 +106,24 @@ interface KvCacheParameters {
|
|
|
75
106
|
* By default, 5 minutes for all URLs.
|
|
76
107
|
*/
|
|
77
108
|
readonly rules?: readonly [string | URL | URLPattern, Temporal.Duration | Temporal.DurationLike][];
|
|
109
|
+
/**
|
|
110
|
+
* The OpenTelemetry meter provider used to record
|
|
111
|
+
* `activitypub.document.cache` measurements. When omitted, the wrapper
|
|
112
|
+
* does not emit any metric measurements, preserving the previous
|
|
113
|
+
* unobserved-cache behavior.
|
|
114
|
+
* @since 2.3.0
|
|
115
|
+
*/
|
|
116
|
+
readonly meterProvider?: MeterProvider;
|
|
117
|
+
/**
|
|
118
|
+
* The lookup kind to record on the `activitypub.lookup.kind` attribute of
|
|
119
|
+
* `activitypub.document.cache` measurements. Defaults to `"object"` so
|
|
120
|
+
* the generic document loader case does not require an explicit option.
|
|
121
|
+
* Set to `"context"` for context-loader wrappers; the
|
|
122
|
+
* authenticated-loader path does not use `kvCache()` and is therefore
|
|
123
|
+
* out of scope.
|
|
124
|
+
* @since 2.3.0
|
|
125
|
+
*/
|
|
126
|
+
readonly kind?: DocumentFetchKind;
|
|
78
127
|
}
|
|
79
128
|
/**
|
|
80
129
|
* Decorates a {@link DocumentLoader} with a cache backed by a {@link KvStore}.
|
|
@@ -85,7 +134,9 @@ declare function kvCache({
|
|
|
85
134
|
loader,
|
|
86
135
|
kv,
|
|
87
136
|
prefix,
|
|
88
|
-
rules
|
|
137
|
+
rules,
|
|
138
|
+
meterProvider,
|
|
139
|
+
kind
|
|
89
140
|
}: KvCacheParameters): DocumentLoader;
|
|
90
141
|
//#endregion
|
|
91
142
|
export { getAuthenticatedDocumentLoader as n, kvCache as t };
|
package/dist/mod.cjs
CHANGED
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
require("./chunk-DDcVe30Y.cjs");
|
|
5
5
|
const require_transformers = require("./transformers-NeAONrAq.cjs");
|
|
6
6
|
require("./compat/mod.cjs");
|
|
7
|
-
const require_http = require("./http-
|
|
8
|
-
const require_middleware = require("./middleware-
|
|
9
|
-
const require_proof = require("./proof-
|
|
7
|
+
const require_http = require("./http-CJfvRL7D.cjs");
|
|
8
|
+
const require_middleware = require("./middleware-B2rtdpFV.cjs");
|
|
9
|
+
const require_proof = require("./proof-B1_u25UV.cjs");
|
|
10
10
|
const require_types = require("./types-KC4QAoxe.cjs");
|
|
11
|
-
const require_kv_cache = require("./kv-cache-
|
|
11
|
+
const require_kv_cache = require("./kv-cache-L0SMQkcd.cjs");
|
|
12
12
|
const require_federation_mod = require("./federation/mod.cjs");
|
|
13
13
|
require("./nodeinfo/mod.cjs");
|
|
14
14
|
require("./runtime/mod.cjs");
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
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-CAM_bQXx.cjs";
|
|
3
|
-
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-
|
|
3
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-VyDTd4G3.cjs";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-DEvZuyOE.cjs";
|
|
5
|
-
import { $ as
|
|
5
|
+
import { $ as CollectionCursor, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as ActorDispatcher, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CollectionCounter, R as Message, S as FederationStartQueueOptions, St as ActivityTransformer, T as InboxChallengePolicy, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as ActorKeyPairsDispatcher, Y as ActorHandleMapper, Z as AuthorizePredicate, _ as Federatable, _t as SendActivityError, a as GetSignedKeyOptions, at as InboxListener, b as FederationFetchOptions, bt as buildCollectionSynchronizationHeader, c as ParseUriResult, ct as ObjectDispatcher, d as SendActivityOptions, dt as OutboxListenerErrorHandler, et as CollectionDispatcher, f as SendActivityOptionsForCollection, ft as OutboxPermanentFailureHandler, g as CustomCollectionCallbackSetters, gt as WebFingerLinksDispatcher, h as ConstructorWithTypeId, ht as UnverifiedActivityReason, i as GetActorOptions, it as InboxErrorHandler, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as OutboxErrorHandler, m as CollectionCallbackSetters, mt as UnverifiedActivityHandler, n as Context, nt as CustomCollectionCursor, o as InboxContext, ot as NodeInfoDispatcher, p as ActorCallbackSetters, pt as SharedInboxKeyDispatcher, q as ActorAliasMapper, r as ForwardActivityOptions, rt as CustomCollectionDispatcher, s as OutboxContext, st as ObjectAuthorizePredicate, t as ActorKeyPair, tt as CustomCollectionCounter, u as RouteActivityOptions, ut as OutboxListener, v as Federation, vt as SenderKeyPair, w as IdempotencyStrategy, x as FederationOptions, xt as digest, y as FederationBuilder, yt as PageItems, z as createFederationBuilder } from "./context-tc6VOOOL.cjs";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-gJ8LYbxX.cjs";
|
|
7
|
+
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";
|
|
7
8
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
|
|
8
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
9
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-DnzgcPcy.cjs";
|
|
10
|
+
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-B0hW12_O.cjs";
|
|
11
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-yvIXFAEi.cjs";
|
|
11
12
|
export * from "@fedify/vocab-runtime";
|
|
12
13
|
|
|
13
14
|
//#region src/mod.d.ts
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
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-CSddvgWN.js";
|
|
3
|
-
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-
|
|
3
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-lf8Hsd91.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CnngXDNJ.js";
|
|
5
|
-
import { $ as
|
|
5
|
+
import { $ as CollectionCursor, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as ActorDispatcher, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CollectionCounter, R as Message, S as FederationStartQueueOptions, St as ActivityTransformer, T as InboxChallengePolicy, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as ActorKeyPairsDispatcher, Y as ActorHandleMapper, Z as AuthorizePredicate, _ as Federatable, _t as SendActivityError, a as GetSignedKeyOptions, at as InboxListener, b as FederationFetchOptions, bt as buildCollectionSynchronizationHeader, c as ParseUriResult, ct as ObjectDispatcher, d as SendActivityOptions, dt as OutboxListenerErrorHandler, et as CollectionDispatcher, f as SendActivityOptionsForCollection, ft as OutboxPermanentFailureHandler, g as CustomCollectionCallbackSetters, gt as WebFingerLinksDispatcher, h as ConstructorWithTypeId, ht as UnverifiedActivityReason, i as GetActorOptions, it as InboxErrorHandler, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as OutboxErrorHandler, m as CollectionCallbackSetters, mt as UnverifiedActivityHandler, n as Context, nt as CustomCollectionCursor, o as InboxContext, ot as NodeInfoDispatcher, p as ActorCallbackSetters, pt as SharedInboxKeyDispatcher, q as ActorAliasMapper, r as ForwardActivityOptions, rt as CustomCollectionDispatcher, s as OutboxContext, st as ObjectAuthorizePredicate, t as ActorKeyPair, tt as CustomCollectionCounter, u as RouteActivityOptions, ut as OutboxListener, v as Federation, vt as SenderKeyPair, w as IdempotencyStrategy, x as FederationOptions, xt as digest, y as FederationBuilder, yt as PageItems, z as createFederationBuilder } from "./context-Cq18Gplu.js";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-D6hNiMTK.js";
|
|
7
|
+
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";
|
|
7
8
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
|
|
8
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
9
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-CajNYYkt.js";
|
|
10
|
+
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-COIAjwRS.js";
|
|
11
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DFvNJcNb.js";
|
|
11
12
|
export * from "@fedify/vocab-runtime";
|
|
12
13
|
|
|
13
14
|
//#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 {
|
|
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 { a as verifyProof, c as getKeyOwner, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyObject, l as attachSignature, m as verifyJsonLd, n as hasProofLike, p as signJsonLd, r as signObject, s as doesActorOwnKey, t as createProof, u as createSignature } from "./proof-
|
|
6
|
+
import { C as formatAcceptSignature, E as validateAcceptSignature, T as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk, w as fulfillAcceptSignature } from "./http-cqujdCRz.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-DtOddSVg.js";
|
|
8
|
+
import { a as verifyProof, c as getKeyOwner, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyObject, l as attachSignature, m as verifyJsonLd, n as hasProofLike, p as signJsonLd, r as signObject, s as doesActorOwnKey, t as createProof, u as createSignature } from "./proof-DMGIjHYH.js";
|
|
9
9
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-CAY3OdLq.js";
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-pEejzYq4.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
//#region src/federation/mq.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Additional options for enqueuing a message in a queue.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.5.0
|
|
7
|
+
*/
|
|
8
|
+
interface MessageQueueEnqueueOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The delay before the message is enqueued. No delay by default.
|
|
11
|
+
*
|
|
12
|
+
* It must not be negative.
|
|
13
|
+
*/
|
|
14
|
+
readonly delay?: Temporal.Duration;
|
|
15
|
+
/**
|
|
16
|
+
* An optional key that ensures messages with the same ordering key are
|
|
17
|
+
* processed sequentially (one at a time). Messages with different ordering
|
|
18
|
+
* keys (or no ordering key) may be processed in parallel.
|
|
19
|
+
*
|
|
20
|
+
* This is useful for ensuring that related messages are processed in order,
|
|
21
|
+
* such as ensuring that a `Delete` activity is processed after a `Create`
|
|
22
|
+
* activity for the same object.
|
|
23
|
+
*
|
|
24
|
+
* @since 2.0.0
|
|
25
|
+
*/
|
|
26
|
+
readonly orderingKey?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Additional options for listening to a message queue.
|
|
30
|
+
*
|
|
31
|
+
* @since 1.0.0
|
|
32
|
+
*/
|
|
33
|
+
interface MessageQueueListenOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The signal to abort listening to the message queue.
|
|
36
|
+
*/
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The number of messages waiting in a message queue.
|
|
41
|
+
*
|
|
42
|
+
* @since 2.3.0
|
|
43
|
+
*/
|
|
44
|
+
interface MessageQueueDepth {
|
|
45
|
+
/**
|
|
46
|
+
* The total number of messages still waiting in the backend queue.
|
|
47
|
+
*
|
|
48
|
+
* This does not include messages that have already been handed to a worker
|
|
49
|
+
* for processing.
|
|
50
|
+
*/
|
|
51
|
+
readonly queued: number;
|
|
52
|
+
/**
|
|
53
|
+
* The number of queued messages eligible for immediate processing.
|
|
54
|
+
*
|
|
55
|
+
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
56
|
+
* may omit this field.
|
|
57
|
+
*/
|
|
58
|
+
readonly ready?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The number of queued messages scheduled for later delivery.
|
|
61
|
+
*
|
|
62
|
+
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
63
|
+
* may omit this field.
|
|
64
|
+
*/
|
|
65
|
+
readonly delayed?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An abstract interface for a message queue.
|
|
69
|
+
*
|
|
70
|
+
* @since 0.5.0
|
|
71
|
+
*/
|
|
72
|
+
interface MessageQueue {
|
|
73
|
+
/**
|
|
74
|
+
* Whether the message queue backend provides native retry mechanisms.
|
|
75
|
+
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
76
|
+
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
77
|
+
* using its own retry policies.
|
|
78
|
+
*
|
|
79
|
+
* @default `false`
|
|
80
|
+
* @since 1.7.0
|
|
81
|
+
*/
|
|
82
|
+
readonly nativeRetrial?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Enqueues a message in the queue.
|
|
85
|
+
* @param message The message to enqueue.
|
|
86
|
+
* @param options Additional options for enqueuing the message.
|
|
87
|
+
*/
|
|
88
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Enqueues multiple messages in the queue. This operation is optional,
|
|
91
|
+
* and may not be supported by all implementations. If not supported,
|
|
92
|
+
* Fedify will invoke {@link enqueue} for each message.
|
|
93
|
+
*
|
|
94
|
+
* @param messages The messages to enqueue.
|
|
95
|
+
* @param options Additional options for enqueuing the messages.
|
|
96
|
+
*/
|
|
97
|
+
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Listens for messages in the queue.
|
|
100
|
+
* @param handler The handler for messages in the queue.
|
|
101
|
+
* @param options Additional options for listening to the message queue.
|
|
102
|
+
* @returns A promise that resolves when the listening is done. It never
|
|
103
|
+
* rejects, and is resolved when the signal is aborted. If no
|
|
104
|
+
* signal is provided, it never resolves.
|
|
105
|
+
*/
|
|
106
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the number of messages waiting in the queue.
|
|
109
|
+
*
|
|
110
|
+
* This operation is optional, and may not be supported by all
|
|
111
|
+
* implementations. The returned counts exclude messages currently being
|
|
112
|
+
* handled by a worker.
|
|
113
|
+
*
|
|
114
|
+
* @since 2.3.0
|
|
115
|
+
*/
|
|
116
|
+
getDepth?(): Promise<MessageQueueDepth>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Additional options for {@link InProcessMessageQueue}.
|
|
120
|
+
* @since 1.0.0
|
|
121
|
+
*/
|
|
122
|
+
interface InProcessMessageQueueOptions {
|
|
123
|
+
/**
|
|
124
|
+
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
125
|
+
* @default `{ seconds: 5 }`
|
|
126
|
+
*/
|
|
127
|
+
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A message queue that processes messages in the same process.
|
|
131
|
+
* Do not use this in production as it does neither persist messages nor
|
|
132
|
+
* distribute them across multiple processes.
|
|
133
|
+
*
|
|
134
|
+
* @since 0.5.0
|
|
135
|
+
*/
|
|
136
|
+
declare class InProcessMessageQueue implements MessageQueue {
|
|
137
|
+
#private;
|
|
138
|
+
/**
|
|
139
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
140
|
+
* @since 1.7.0
|
|
141
|
+
*/
|
|
142
|
+
readonly nativeRetrial = false;
|
|
143
|
+
/**
|
|
144
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
145
|
+
* @param options Additional options for the in-process message queue.
|
|
146
|
+
*/
|
|
147
|
+
constructor(options?: InProcessMessageQueueOptions);
|
|
148
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
149
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
150
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
151
|
+
getDepth(): Promise<MessageQueueDepth>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A message queue that processes messages in parallel. It takes another
|
|
155
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
156
|
+
* number of workers.
|
|
157
|
+
*
|
|
158
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
159
|
+
*
|
|
160
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
161
|
+
* are not running in separate threads or processes. They are running in the
|
|
162
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
163
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
164
|
+
* workloads.
|
|
165
|
+
*
|
|
166
|
+
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
167
|
+
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
168
|
+
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
169
|
+
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
170
|
+
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
171
|
+
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
172
|
+
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
173
|
+
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
174
|
+
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
175
|
+
*
|
|
176
|
+
* Messages with the same ordering key will never be processed concurrently
|
|
177
|
+
* by different workers, ensuring sequential processing within each key.
|
|
178
|
+
* Messages with different ordering keys (or no ordering key) can still be
|
|
179
|
+
* processed in parallel.
|
|
180
|
+
*
|
|
181
|
+
* @since 1.0.0
|
|
182
|
+
*/
|
|
183
|
+
declare class ParallelMessageQueue implements MessageQueue {
|
|
184
|
+
#private;
|
|
185
|
+
readonly queue: MessageQueue;
|
|
186
|
+
readonly workers: number;
|
|
187
|
+
/**
|
|
188
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
189
|
+
* @since 1.7.0
|
|
190
|
+
*/
|
|
191
|
+
readonly nativeRetrial?: boolean;
|
|
192
|
+
readonly getDepth?: () => Promise<MessageQueueDepth>;
|
|
193
|
+
/**
|
|
194
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
195
|
+
* number of workers.
|
|
196
|
+
* @param queue The message queue to use under the hood. Note that
|
|
197
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
198
|
+
* @param workers The number of workers to process messages in parallel.
|
|
199
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
200
|
+
* {@link ParallelMessageQueue}.
|
|
201
|
+
*/
|
|
202
|
+
constructor(queue: MessageQueue, workers: number);
|
|
203
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
204
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
205
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { MessageQueueEnqueueOptions as a, MessageQueueDepth as i, InProcessMessageQueueOptions as n, MessageQueueListenOptions as o, MessageQueue as r, ParallelMessageQueue as s, InProcessMessageQueue as t };
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
//#region src/federation/mq.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Additional options for enqueuing a message in a queue.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.5.0
|
|
7
|
+
*/
|
|
8
|
+
interface MessageQueueEnqueueOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The delay before the message is enqueued. No delay by default.
|
|
11
|
+
*
|
|
12
|
+
* It must not be negative.
|
|
13
|
+
*/
|
|
14
|
+
readonly delay?: Temporal.Duration;
|
|
15
|
+
/**
|
|
16
|
+
* An optional key that ensures messages with the same ordering key are
|
|
17
|
+
* processed sequentially (one at a time). Messages with different ordering
|
|
18
|
+
* keys (or no ordering key) may be processed in parallel.
|
|
19
|
+
*
|
|
20
|
+
* This is useful for ensuring that related messages are processed in order,
|
|
21
|
+
* such as ensuring that a `Delete` activity is processed after a `Create`
|
|
22
|
+
* activity for the same object.
|
|
23
|
+
*
|
|
24
|
+
* @since 2.0.0
|
|
25
|
+
*/
|
|
26
|
+
readonly orderingKey?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Additional options for listening to a message queue.
|
|
30
|
+
*
|
|
31
|
+
* @since 1.0.0
|
|
32
|
+
*/
|
|
33
|
+
interface MessageQueueListenOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The signal to abort listening to the message queue.
|
|
36
|
+
*/
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The number of messages waiting in a message queue.
|
|
41
|
+
*
|
|
42
|
+
* @since 2.3.0
|
|
43
|
+
*/
|
|
44
|
+
interface MessageQueueDepth {
|
|
45
|
+
/**
|
|
46
|
+
* The total number of messages still waiting in the backend queue.
|
|
47
|
+
*
|
|
48
|
+
* This does not include messages that have already been handed to a worker
|
|
49
|
+
* for processing.
|
|
50
|
+
*/
|
|
51
|
+
readonly queued: number;
|
|
52
|
+
/**
|
|
53
|
+
* The number of queued messages eligible for immediate processing.
|
|
54
|
+
*
|
|
55
|
+
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
56
|
+
* may omit this field.
|
|
57
|
+
*/
|
|
58
|
+
readonly ready?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The number of queued messages scheduled for later delivery.
|
|
61
|
+
*
|
|
62
|
+
* Queue backends that cannot cheaply distinguish ready and delayed messages
|
|
63
|
+
* may omit this field.
|
|
64
|
+
*/
|
|
65
|
+
readonly delayed?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An abstract interface for a message queue.
|
|
69
|
+
*
|
|
70
|
+
* @since 0.5.0
|
|
71
|
+
*/
|
|
72
|
+
interface MessageQueue {
|
|
73
|
+
/**
|
|
74
|
+
* Whether the message queue backend provides native retry mechanisms.
|
|
75
|
+
* When `true`, Fedify will skip its own retry logic and rely on the backend
|
|
76
|
+
* to handle retries. When `false` or omitted, Fedify will handle retries
|
|
77
|
+
* using its own retry policies.
|
|
78
|
+
*
|
|
79
|
+
* @default `false`
|
|
80
|
+
* @since 1.7.0
|
|
81
|
+
*/
|
|
82
|
+
readonly nativeRetrial?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Enqueues a message in the queue.
|
|
85
|
+
* @param message The message to enqueue.
|
|
86
|
+
* @param options Additional options for enqueuing the message.
|
|
87
|
+
*/
|
|
88
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Enqueues multiple messages in the queue. This operation is optional,
|
|
91
|
+
* and may not be supported by all implementations. If not supported,
|
|
92
|
+
* Fedify will invoke {@link enqueue} for each message.
|
|
93
|
+
*
|
|
94
|
+
* @param messages The messages to enqueue.
|
|
95
|
+
* @param options Additional options for enqueuing the messages.
|
|
96
|
+
*/
|
|
97
|
+
enqueueMany?: (messages: readonly any[], options?: MessageQueueEnqueueOptions) => Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Listens for messages in the queue.
|
|
100
|
+
* @param handler The handler for messages in the queue.
|
|
101
|
+
* @param options Additional options for listening to the message queue.
|
|
102
|
+
* @returns A promise that resolves when the listening is done. It never
|
|
103
|
+
* rejects, and is resolved when the signal is aborted. If no
|
|
104
|
+
* signal is provided, it never resolves.
|
|
105
|
+
*/
|
|
106
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the number of messages waiting in the queue.
|
|
109
|
+
*
|
|
110
|
+
* This operation is optional, and may not be supported by all
|
|
111
|
+
* implementations. The returned counts exclude messages currently being
|
|
112
|
+
* handled by a worker.
|
|
113
|
+
*
|
|
114
|
+
* @since 2.3.0
|
|
115
|
+
*/
|
|
116
|
+
getDepth?(): Promise<MessageQueueDepth>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Additional options for {@link InProcessMessageQueue}.
|
|
120
|
+
* @since 1.0.0
|
|
121
|
+
*/
|
|
122
|
+
interface InProcessMessageQueueOptions {
|
|
123
|
+
/**
|
|
124
|
+
* The interval to poll for messages in the queue. 5 seconds by default.
|
|
125
|
+
* @default `{ seconds: 5 }`
|
|
126
|
+
*/
|
|
127
|
+
pollInterval?: Temporal.Duration | Temporal.DurationLike;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A message queue that processes messages in the same process.
|
|
131
|
+
* Do not use this in production as it does neither persist messages nor
|
|
132
|
+
* distribute them across multiple processes.
|
|
133
|
+
*
|
|
134
|
+
* @since 0.5.0
|
|
135
|
+
*/
|
|
136
|
+
declare class InProcessMessageQueue implements MessageQueue {
|
|
137
|
+
#private;
|
|
138
|
+
/**
|
|
139
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
140
|
+
* @since 1.7.0
|
|
141
|
+
*/
|
|
142
|
+
readonly nativeRetrial = false;
|
|
143
|
+
/**
|
|
144
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
145
|
+
* @param options Additional options for the in-process message queue.
|
|
146
|
+
*/
|
|
147
|
+
constructor(options?: InProcessMessageQueueOptions);
|
|
148
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
149
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
150
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
151
|
+
getDepth(): Promise<MessageQueueDepth>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A message queue that processes messages in parallel. It takes another
|
|
155
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
156
|
+
* number of workers.
|
|
157
|
+
*
|
|
158
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
159
|
+
*
|
|
160
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
161
|
+
* are not running in separate threads or processes. They are running in the
|
|
162
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
163
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
164
|
+
* workloads.
|
|
165
|
+
*
|
|
166
|
+
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
167
|
+
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
168
|
+
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
169
|
+
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
170
|
+
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
171
|
+
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
172
|
+
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
173
|
+
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
174
|
+
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
175
|
+
*
|
|
176
|
+
* Messages with the same ordering key will never be processed concurrently
|
|
177
|
+
* by different workers, ensuring sequential processing within each key.
|
|
178
|
+
* Messages with different ordering keys (or no ordering key) can still be
|
|
179
|
+
* processed in parallel.
|
|
180
|
+
*
|
|
181
|
+
* @since 1.0.0
|
|
182
|
+
*/
|
|
183
|
+
declare class ParallelMessageQueue implements MessageQueue {
|
|
184
|
+
#private;
|
|
185
|
+
readonly queue: MessageQueue;
|
|
186
|
+
readonly workers: number;
|
|
187
|
+
/**
|
|
188
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
189
|
+
* @since 1.7.0
|
|
190
|
+
*/
|
|
191
|
+
readonly nativeRetrial?: boolean;
|
|
192
|
+
readonly getDepth?: () => Promise<MessageQueueDepth>;
|
|
193
|
+
/**
|
|
194
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
195
|
+
* number of workers.
|
|
196
|
+
* @param queue The message queue to use under the hood. Note that
|
|
197
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
198
|
+
* @param workers The number of workers to process messages in parallel.
|
|
199
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
200
|
+
* {@link ParallelMessageQueue}.
|
|
201
|
+
*/
|
|
202
|
+
constructor(queue: MessageQueue, workers: number);
|
|
203
|
+
enqueue(message: any, options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
204
|
+
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
205
|
+
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { MessageQueueEnqueueOptions as a, MessageQueueDepth as i, InProcessMessageQueueOptions as n, MessageQueueListenOptions as o, MessageQueue as r, ParallelMessageQueue as s, InProcessMessageQueue as t };
|
|
@@ -5,7 +5,7 @@ import { r as createRequestContext } from "../context-BAE7AKLA.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-BTEgfoJo.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
|
|
8
|
-
import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-
|
|
8
|
+
import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-BB0IbDow.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -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 "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno--CS-SBS9.mjs";
|
|
5
|
+
import "./key-Df3tMleh.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,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-CJfvRL7D.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");
|
|
@@ -1,9 +1,9 @@
|
|
|
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 {
|
|
6
|
-
import { n as fetchKey, o as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno--CS-SBS9.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-BTOMkW8C.mjs";
|
|
6
|
+
import { n as fetchKey, o as validateCryptoKey } from "./key-Df3tMleh.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience-c9zmYKgA.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-BNL8AC14.mjs";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|