@fedify/fedify 2.0.0-pr.490.2 → 2.0.0-pr.559.4
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/LICENSE +1 -1
- package/README.md +64 -37
- package/dist/{builder-4syLV1-z.js → builder-DTlQwmVF.js} +10 -3
- package/dist/{client-BsGzbnV-.d.ts → client-CUTUGgvJ.d.ts} +18 -18
- package/dist/{client-pY7-3icS.js → client-Dg7OfUDA.js} +28 -23
- package/dist/{client-94iWEfQa.d.cts → client-by-PEGAJ.d.cts} +18 -18
- package/dist/compat/mod.cjs +1 -1
- package/dist/compat/mod.d.cts +6 -10
- package/dist/compat/mod.d.ts +6 -10
- package/dist/compat/mod.js +1 -1
- package/dist/compat/transformers.test.js +22 -21
- package/dist/{context-PxGADCsD.d.cts → context-B6X-7loD.d.cts} +206 -74
- package/dist/{context-V-XS2_6O.d.ts → context-CJaICYPw.d.ts} +206 -74
- package/dist/context-CZ5llAss.js +109 -0
- package/dist/deno-DGx1JZHr.js +124 -0
- package/dist/{testing-BslrM_9E.js → dist-B5f6a8Tt.js} +90 -110
- package/dist/{docloader-DndkGj0O.js → docloader-D8UHsyqD.js} +3 -3
- package/dist/{esm-VlKMJQqV.js → esm-DGl7uK1r.js} +1 -1
- package/dist/federation/builder.test.js +7 -5
- package/dist/federation/collection.test.js +2 -3
- package/dist/federation/handler.test.js +24 -23
- package/dist/federation/idempotency.test.js +59 -22
- package/dist/federation/inbox.test.js +4 -3
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +56 -3
- package/dist/federation/middleware.test.js +307 -93
- package/dist/federation/mod.cjs +9 -10
- package/dist/federation/mod.d.cts +7 -11
- package/dist/federation/mod.d.ts +7 -11
- package/dist/federation/mod.js +8 -11
- package/dist/federation/mq.test.js +167 -16
- package/dist/federation/negotiation.test.js +2 -3
- package/dist/federation/retry.test.js +2 -3
- package/dist/federation/router.test.js +2 -2
- package/dist/federation/send.test.js +93 -11
- package/dist/{webfinger/handler.test.js → federation/webfinger.test.js} +24 -22
- package/dist/{federation-CRpdnOMS.cjs → federation-CE0CJ_0G.cjs} +116 -10
- package/dist/{federation-jcR8-ZxP.js → federation-D6FVaeAR.js} +122 -16
- package/dist/{http-YhR_TMMQ.js → http-CL3G0rnf.js} +126 -9
- package/dist/{http-M8k5mKc0.d.cts → http-ClB3pLcL.d.cts} +1 -1
- package/dist/{http-Dxpqz4hE.cjs → http-DKBUv5zZ.cjs} +139 -16
- package/dist/{http-BbO0ejuk.d.ts → http-DLBDPal9.d.ts} +1 -1
- package/dist/{http-DH47B-h3.js → http-LGtYlSfN.js} +3 -2
- package/dist/{inbox-CEyHvxOo.js → inbox-DbtWQY2D.js} +2 -1
- package/dist/{key-x7E5PYI0.js → key-BCtt1Ugy.js} +3 -3
- package/dist/{keycache-BRXuBDuy.js → keycache-DRxpZ5r9.js} +1 -1
- package/dist/{keys-DLk_8H-l.js → keys-ZbcByPg9.js} +1 -1
- package/dist/{kv-Bxr0Q87_.d.cts → kv-B4vFhIYL.d.cts} +30 -1
- package/dist/{kv-BKNZ-Tb-.d.ts → kv-CYySNrsn.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-QzKcOQgP.js} +22 -0
- package/dist/{kv-cache-HFnFIjSD.js → kv-cache-0786BfqY.js} +3 -3
- package/dist/{kv-cache-DN9pfMBe.js → kv-cache-B__dHl7g.js} +15 -2
- package/dist/{kv-cache-BMpfJFTx.cjs → kv-cache-DCJojeTn.cjs} +3 -3
- package/dist/{ld-CRPaU6c8.js → ld-QlZPwGEH.js} +4 -3
- package/dist/middleware-B3jUPnDa.js +12 -0
- package/dist/middleware-BFiwWMA2.cjs +12 -0
- package/dist/middleware-DMx6DyIw.js +26 -0
- package/dist/{middleware-DfLpMu7C.js → middleware-Dm58nObp.js} +280 -166
- package/dist/{middleware-BIqFwRwI.js → middleware-WokE4qxc.js} +245 -178
- package/dist/{middleware-Ck7O6mb0.cjs → middleware-hWyKOO_6.cjs} +332 -206
- package/dist/{mod-DMpuiKXi.d.cts → mod-BHXq4Q3x.d.cts} +7 -7
- package/dist/{mod-DgxG-byT.d.cts → mod-BrS8tiad.d.cts} +2 -2
- package/dist/mod-CoMP50Rf.d.ts +64 -0
- package/dist/{mod-BoRKfJPE.d.cts → mod-DScazwCW.d.cts} +4 -4
- package/dist/mod-DTzN6Pv3.d.cts +62 -0
- package/dist/{mod-aAE2wOWV.d.ts → mod-DZmuPaKv.d.ts} +7 -7
- package/dist/{mod-D5Z2tISD.d.ts → mod-jOa7W503.d.ts} +2 -2
- package/dist/{mod-Cdo6SYlJ.d.ts → mod-xKJ57rwu.d.ts} +4 -4
- package/dist/mod.cjs +12 -93
- package/dist/mod.d.cts +11 -15
- package/dist/mod.d.ts +11 -15
- package/dist/mod.js +11 -15
- package/dist/nodeinfo/client.test.js +3 -4
- package/dist/nodeinfo/handler.test.js +22 -21
- package/dist/nodeinfo/mod.cjs +2 -2
- package/dist/nodeinfo/mod.d.cts +2 -2
- package/dist/nodeinfo/mod.d.ts +2 -2
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/types.test.js +2 -3
- package/dist/otel/exporter.test.js +893 -0
- package/dist/otel/mod.cjs +256 -0
- package/dist/otel/mod.d.cts +230 -0
- package/dist/otel/mod.d.ts +232 -0
- package/dist/otel/mod.js +255 -0
- package/dist/{owner-kQRGVXG1.d.ts → owner-BgI8C-VY.d.ts} +1 -2
- package/dist/{owner-B4HbyP8s.d.cts → owner-C-zfmVAD.d.cts} +1 -2
- package/dist/{owner-CIWnopkT.js → owner-Cejm-F7S.js} +2 -2
- package/dist/{proof-D-5ri6rf.js → proof-BOQBHd-i.js} +3 -2
- package/dist/{proof-fEwcA7LA.cjs → proof-Bmi8ZIcW.cjs} +24 -25
- package/dist/{proof-C8-2l0zH.js → proof-CnaEQ_Ev.js} +4 -5
- package/dist/router-D9eI0s4b.js +118 -0
- package/dist/{send-CPGk9QKZ.js → send-jFxXfsN8.js} +38 -4
- package/dist/sig/http.test.js +6 -7
- package/dist/sig/key.test.js +5 -5
- package/dist/sig/ld.test.js +6 -6
- package/dist/sig/mod.cjs +3 -5
- package/dist/sig/mod.d.cts +3 -5
- package/dist/sig/mod.d.ts +3 -5
- package/dist/sig/mod.js +3 -5
- package/dist/sig/owner.test.js +6 -7
- package/dist/sig/proof.test.js +6 -6
- package/dist/testing/mod.d.ts +173 -7006
- package/dist/testing/mod.js +4 -3
- package/dist/{transformers-CoBS-oFG.cjs → transformers-BjBg6Lag.cjs} +2 -2
- package/dist/{transformers-BFT6d7J5.js → transformers-N_ip_y4P.js} +2 -2
- package/dist/{types-BtUjyi5y.js → types-8l28uC8o.js} +30 -25
- package/dist/{types-CWgzGaqk.cjs → types-B6z6CqIz.cjs} +30 -25
- package/dist/{types-C2XVl6gj.js → types-CPz01LGH.js} +3 -3
- package/dist/utils/docloader.test.js +7 -8
- package/dist/utils/kv-cache.test.js +5 -3
- package/dist/utils/mod.cjs +3 -5
- package/dist/utils/mod.d.cts +3 -4
- package/dist/utils/mod.d.ts +3 -4
- package/dist/utils/mod.js +3 -5
- package/dist/vocab/mod.cjs +8 -81
- package/dist/vocab/mod.d.cts +1 -4
- package/dist/vocab/mod.d.ts +1 -4
- package/dist/vocab/mod.js +1 -5
- package/package.json +27 -27
- package/dist/actor-BT-e5fn9.js +0 -146
- package/dist/actor-B_gRMloq.js +0 -41647
- package/dist/actor-CBfPjuWj.cjs +0 -42079
- package/dist/actor-DqFajh9s.d.ts +0 -130
- package/dist/actor-f2NtjyCg.d.cts +0 -128
- package/dist/fixtures/activitypub.academy/users/brauca_darradiul.json +0 -83
- package/dist/fixtures/example.com/announce.json +0 -6
- package/dist/fixtures/example.com/collection.json +0 -19
- package/dist/fixtures/example.com/create.json +0 -6
- package/dist/fixtures/example.com/cross-origin-actor.json +0 -6
- package/dist/fixtures/example.com/hong-gildong.json +0 -11
- package/dist/fixtures/example.com/invite.json +0 -7
- package/dist/fixtures/example.com/key.json +0 -7
- package/dist/fixtures/example.com/key2.json +0 -6
- package/dist/fixtures/example.com/object.json +0 -6
- package/dist/fixtures/example.com/orderedcollectionpage.json +0 -24
- package/dist/fixtures/example.com/paged/a.json +0 -13
- package/dist/fixtures/example.com/paged/b.json +0 -16
- package/dist/fixtures/example.com/paged-collection.json +0 -6
- package/dist/fixtures/example.com/person.json +0 -22
- package/dist/fixtures/example.com/person2.json +0 -40
- package/dist/fixtures/example.com/test.json +0 -5
- package/dist/fixtures/example.com/users/handle.json +0 -16
- package/dist/fixtures/example.com/wrong-type.json +0 -3
- package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +0 -6
- package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +0 -24
- package/dist/fixtures/remote.domain/users/bob.json +0 -20
- package/dist/fixtures/server.example/users/alice.json +0 -20
- package/dist/fixtures/w3id.org/identity/v1.json +0 -152
- package/dist/fixtures/w3id.org/security/data-integrity/v1.json +0 -74
- package/dist/fixtures/w3id.org/security/multikey/v1.json +0 -35
- package/dist/fixtures/w3id.org/security/v1.json +0 -50
- package/dist/fixtures/wizard.casa/users/hongminhee.json +0 -69
- package/dist/fixtures/www.w3.org/ns/activitystreams.json +0 -379
- package/dist/fixtures/www.w3.org/ns/did/v1.json +0 -58
- package/dist/lookup-BTqtVATt.cjs +0 -266
- package/dist/lookup-DOSnR912.js +0 -254
- package/dist/lookup-Dj9-mgOn.js +0 -42184
- package/dist/middleware-CxswDtQn.js +0 -15
- package/dist/middleware-CyITsnX0.js +0 -26
- package/dist/middleware-Z8lc_drL.cjs +0 -15
- package/dist/mod-BlVovdcy.d.ts +0 -309
- package/dist/mod-BxRCHTz-.d.cts +0 -307
- package/dist/mod-C58MZ7Wx.d.cts +0 -113
- package/dist/mod-CcDPcLJW.d.cts +0 -1
- package/dist/mod-Ds0mpFZU.d.ts +0 -115
- package/dist/mod-bjzj5QIb.d.ts +0 -2
- package/dist/otel-1BmGPuZc.js +0 -64
- package/dist/src/vocab/accept.yaml +0 -15
- package/dist/src/vocab/activity.yaml +0 -98
- package/dist/src/vocab/add.yaml +0 -16
- package/dist/src/vocab/announce.yaml +0 -30
- package/dist/src/vocab/application.yaml +0 -324
- package/dist/src/vocab/arrive.yaml +0 -15
- package/dist/src/vocab/article.yaml +0 -46
- package/dist/src/vocab/audio.yaml +0 -11
- package/dist/src/vocab/block.yaml +0 -16
- package/dist/src/vocab/chatmessage.yaml +0 -50
- package/dist/src/vocab/collection.yaml +0 -154
- package/dist/src/vocab/collectionpage.yaml +0 -55
- package/dist/src/vocab/create.yaml +0 -28
- package/dist/src/vocab/dataintegrityproof.yaml +0 -56
- package/dist/src/vocab/delete.yaml +0 -27
- package/dist/src/vocab/didservice.yaml +0 -22
- package/dist/src/vocab/dislike.yaml +0 -14
- package/dist/src/vocab/document.yaml +0 -31
- package/dist/src/vocab/emoji.yaml +0 -12
- package/dist/src/vocab/emojireact.yaml +0 -17
- package/dist/src/vocab/endpoints.yaml +0 -85
- package/dist/src/vocab/event.yaml +0 -11
- package/dist/src/vocab/export.yaml +0 -9
- package/dist/src/vocab/flag.yaml +0 -15
- package/dist/src/vocab/follow.yaml +0 -19
- package/dist/src/vocab/group.yaml +0 -324
- package/dist/src/vocab/hashtag.yaml +0 -14
- package/dist/src/vocab/ignore.yaml +0 -14
- package/dist/src/vocab/image.yaml +0 -9
- package/dist/src/vocab/intransitiveactivity.yaml +0 -15
- package/dist/src/vocab/invite.yaml +0 -14
- package/dist/src/vocab/join.yaml +0 -14
- package/dist/src/vocab/key.yaml +0 -28
- package/dist/src/vocab/leave.yaml +0 -14
- package/dist/src/vocab/like.yaml +0 -16
- package/dist/src/vocab/link.yaml +0 -101
- package/dist/src/vocab/listen.yaml +0 -12
- package/dist/src/vocab/mention.yaml +0 -9
- package/dist/src/vocab/move.yaml +0 -15
- package/dist/src/vocab/multikey.yaml +0 -36
- package/dist/src/vocab/note.yaml +0 -48
- package/dist/src/vocab/object.yaml +0 -404
- package/dist/src/vocab/offer.yaml +0 -15
- package/dist/src/vocab/orderedcollection.yaml +0 -39
- package/dist/src/vocab/orderedcollectionpage.yaml +0 -50
- package/dist/src/vocab/organization.yaml +0 -324
- package/dist/src/vocab/page.yaml +0 -11
- package/dist/src/vocab/person.yaml +0 -324
- package/dist/src/vocab/place.yaml +0 -75
- package/dist/src/vocab/profile.yaml +0 -26
- package/dist/src/vocab/propertyvalue.yaml +0 -32
- package/dist/src/vocab/question.yaml +0 -103
- package/dist/src/vocab/read.yaml +0 -13
- package/dist/src/vocab/reject.yaml +0 -14
- package/dist/src/vocab/relationship.yaml +0 -52
- package/dist/src/vocab/remove.yaml +0 -14
- package/dist/src/vocab/service.yaml +0 -324
- package/dist/src/vocab/source.yaml +0 -26
- package/dist/src/vocab/tentativeaccept.yaml +0 -14
- package/dist/src/vocab/tentativereject.yaml +0 -14
- package/dist/src/vocab/tombstone.yaml +0 -24
- package/dist/src/vocab/travel.yaml +0 -16
- package/dist/src/vocab/undo.yaml +0 -26
- package/dist/src/vocab/update.yaml +0 -58
- package/dist/src/vocab/video.yaml +0 -11
- package/dist/src/vocab/view.yaml +0 -13
- package/dist/testing/docloader.test.js +0 -22
- package/dist/vocab/actor.test.js +0 -5963
- package/dist/vocab/lookup.test.d.ts +0 -3
- package/dist/vocab/lookup.test.js +0 -476
- package/dist/vocab/type.test.d.ts +0 -3
- package/dist/vocab/type.test.js +0 -24
- package/dist/vocab/vocab.test.d.ts +0 -3
- package/dist/vocab/vocab.test.js +0 -9397
- package/dist/vocab-BCWe1Ih5.d.ts +0 -14905
- package/dist/vocab-ByUp-A2_.js +0 -260
- package/dist/vocab-CeDBzu-f.d.cts +0 -14903
- package/dist/vocab-X_X5T8D3.cjs +0 -296
- package/dist/webfinger/handler.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.js +0 -193
- package/dist/webfinger/mod.cjs +0 -8
- package/dist/webfinger/mod.d.cts +0 -2
- package/dist/webfinger/mod.d.ts +0 -4
- package/dist/webfinger/mod.js +0 -8
- package/dist/webfinger-C72Y8lrh.js +0 -4
- package/dist/webfinger-vAtLmxOF.cjs +0 -4
- /package/dist/{collection-BzWsN9pB.js → collection-CcnIw1qY.js} +0 -0
- /package/dist/{testing/docloader.test.d.ts → federation/webfinger.test.d.ts} +0 -0
- /package/dist/{mod-CVgZgliM.d.ts → mod-1E3W847c.d.ts} +0 -0
- /package/dist/{mod-B-hUPT2N.d.cts → mod-C81L6_lQ.d.cts} +0 -0
- /package/dist/{negotiation-C4nFufNk.js → negotiation-5NPJL6zp.js} +0 -0
- /package/dist/{nodeinfo-BnthBobC.js → nodeinfo-BlLsRSiT.js} +0 -0
- /package/dist/{nodeinfo-CdN0rEnZ.cjs → nodeinfo-DuMYTpbZ.cjs} +0 -0
- /package/dist/{vocab/actor.test.d.ts → otel/exporter.test.d.ts} +0 -0
- /package/dist/{retry-CfF8Gn4d.js → retry-D4GJ670a.js} +0 -0
- /package/dist/{sig-C34-oHBl.js → sig-CwuONEzF.js} +0 -0
- /package/dist/{sig-YYj5tCnr.cjs → sig-DeXX2xnj.cjs} +0 -0
- /package/dist/{utils-DyRU1gdZ.cjs → utils-Db0ZmjcD.cjs} +0 -0
- /package/dist/{utils-D-Va7aXC.js → utils-Wranxuoe.js} +0 -0
package/dist/federation/mod.cjs
CHANGED
|
@@ -2,26 +2,25 @@
|
|
|
2
2
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
|
-
require('../transformers-
|
|
6
|
-
require('../
|
|
7
|
-
require('../
|
|
8
|
-
|
|
9
|
-
require('../
|
|
10
|
-
require('../
|
|
11
|
-
|
|
12
|
-
require('../types-CWgzGaqk.cjs');
|
|
13
|
-
require('../kv-cache-BMpfJFTx.cjs');
|
|
14
|
-
require('../vocab-X_X5T8D3.cjs');
|
|
5
|
+
require('../transformers-BjBg6Lag.cjs');
|
|
6
|
+
require('../http-DKBUv5zZ.cjs');
|
|
7
|
+
const require_middleware = require('../middleware-hWyKOO_6.cjs');
|
|
8
|
+
require('../proof-Bmi8ZIcW.cjs');
|
|
9
|
+
const require_federation = require('../federation-CE0CJ_0G.cjs');
|
|
10
|
+
require('../types-B6z6CqIz.cjs');
|
|
11
|
+
require('../kv-cache-DCJojeTn.cjs');
|
|
15
12
|
|
|
16
13
|
exports.InProcessMessageQueue = require_federation.InProcessMessageQueue;
|
|
17
14
|
exports.MemoryKvStore = require_federation.MemoryKvStore;
|
|
18
15
|
exports.ParallelMessageQueue = require_federation.ParallelMessageQueue;
|
|
19
16
|
exports.Router = require_middleware.Router;
|
|
20
17
|
exports.RouterError = require_middleware.RouterError;
|
|
18
|
+
exports.SendActivityError = require_middleware.SendActivityError;
|
|
21
19
|
exports.buildCollectionSynchronizationHeader = require_middleware.buildCollectionSynchronizationHeader;
|
|
22
20
|
exports.createExponentialBackoffPolicy = require_middleware.createExponentialBackoffPolicy;
|
|
23
21
|
exports.createFederation = require_middleware.createFederation;
|
|
24
22
|
exports.createFederationBuilder = require_middleware.createFederationBuilder;
|
|
25
23
|
exports.digest = require_middleware.digest;
|
|
24
|
+
exports.handleWebFinger = require_middleware.handleWebFinger;
|
|
26
25
|
exports.respondWithObject = require_middleware.respondWithObject;
|
|
27
26
|
exports.respondWithObjectIfAcceptable = require_middleware.respondWithObjectIfAcceptable;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import "../client-
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "../
|
|
5
|
-
import "../
|
|
6
|
-
import "../mod-
|
|
7
|
-
|
|
8
|
-
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-PxGADCsD.cjs";
|
|
9
|
-
import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-Bxr0Q87_.cjs";
|
|
10
|
-
import "../mod-CcDPcLJW.cjs";
|
|
11
|
-
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
1
|
+
import "../client-by-PEGAJ.cjs";
|
|
2
|
+
import "../http-ClB3pLcL.cjs";
|
|
3
|
+
import "../owner-C-zfmVAD.cjs";
|
|
4
|
+
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-B6X-7loD.cjs";
|
|
5
|
+
import { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore } from "../kv-B4vFhIYL.cjs";
|
|
6
|
+
import { WebFingerHandlerParameters, handleWebFinger } from "../mod-DTzN6Pv3.cjs";
|
|
7
|
+
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import "../client-
|
|
4
|
-
import "../
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
7
|
-
import "../
|
|
8
|
-
import "../mod-
|
|
9
|
-
|
|
10
|
-
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-V-XS2_6O.js";
|
|
11
|
-
import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-BKNZ-Tb-.js";
|
|
12
|
-
import "../mod-bjzj5QIb.js";
|
|
13
|
-
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
3
|
+
import "../client-CUTUGgvJ.js";
|
|
4
|
+
import "../http-DLBDPal9.js";
|
|
5
|
+
import "../owner-BgI8C-VY.js";
|
|
6
|
+
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-CJaICYPw.js";
|
|
7
|
+
import { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore } from "../kv-CYySNrsn.js";
|
|
8
|
+
import { WebFingerHandlerParameters, handleWebFinger } from "../mod-CoMP50Rf.js";
|
|
9
|
+
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import "../transformers-
|
|
6
|
-
import "../
|
|
7
|
-
import "../
|
|
8
|
-
import
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
11
|
-
import
|
|
12
|
-
import "../types-BtUjyi5y.js";
|
|
13
|
-
import "../kv-cache-HFnFIjSD.js";
|
|
14
|
-
import "../vocab-ByUp-A2_.js";
|
|
5
|
+
import "../transformers-N_ip_y4P.js";
|
|
6
|
+
import "../http-CL3G0rnf.js";
|
|
7
|
+
import { Router, RouterError, SendActivityError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-Dm58nObp.js";
|
|
8
|
+
import "../proof-CnaEQ_Ev.js";
|
|
9
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-D6FVaeAR.js";
|
|
10
|
+
import "../types-8l28uC8o.js";
|
|
11
|
+
import "../kv-cache-0786BfqY.js";
|
|
15
12
|
|
|
16
|
-
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
13
|
+
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, SendActivityError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../
|
|
6
|
+
import { test } from "../dist-B5f6a8Tt.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import { test } from "../testing-BslrM_9E.js";
|
|
11
10
|
import { assertGreater, assertGreaterOrEqual } from "../std__assert-DWivtrGR.js";
|
|
12
11
|
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
|
13
12
|
import "../assert_throws-BNXdRGWP.js";
|
|
@@ -27,6 +26,11 @@ var InProcessMessageQueue = class {
|
|
|
27
26
|
#monitors;
|
|
28
27
|
#pollIntervalMs;
|
|
29
28
|
/**
|
|
29
|
+
* Tracks which ordering keys are currently being processed to ensure
|
|
30
|
+
* sequential processing for messages with the same key.
|
|
31
|
+
*/
|
|
32
|
+
#processingKeys;
|
|
33
|
+
/**
|
|
30
34
|
* In-process message queue does not provide native retry mechanisms.
|
|
31
35
|
* @since 1.7.0
|
|
32
36
|
*/
|
|
@@ -39,6 +43,7 @@ var InProcessMessageQueue = class {
|
|
|
39
43
|
this.#messages = [];
|
|
40
44
|
this.#monitors = {};
|
|
41
45
|
this.#pollIntervalMs = Temporal.Duration.from(options.pollInterval ?? { seconds: 5 }).total("millisecond");
|
|
46
|
+
this.#processingKeys = /* @__PURE__ */ new Set();
|
|
42
47
|
}
|
|
43
48
|
enqueue(message, options) {
|
|
44
49
|
const delay$1 = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
|
@@ -49,7 +54,11 @@ var InProcessMessageQueue = class {
|
|
|
49
54
|
}), delay$1);
|
|
50
55
|
return Promise.resolve();
|
|
51
56
|
}
|
|
52
|
-
|
|
57
|
+
const orderingKey = options?.orderingKey ?? null;
|
|
58
|
+
this.#messages.push({
|
|
59
|
+
message,
|
|
60
|
+
orderingKey
|
|
61
|
+
});
|
|
53
62
|
for (const monitorId in this.#monitors) this.#monitors[monitorId]();
|
|
54
63
|
return Promise.resolve();
|
|
55
64
|
}
|
|
@@ -63,18 +72,29 @@ var InProcessMessageQueue = class {
|
|
|
63
72
|
}), delay$1);
|
|
64
73
|
return Promise.resolve();
|
|
65
74
|
}
|
|
66
|
-
|
|
75
|
+
const orderingKey = options?.orderingKey ?? null;
|
|
76
|
+
for (const message of messages) this.#messages.push({
|
|
77
|
+
message,
|
|
78
|
+
orderingKey
|
|
79
|
+
});
|
|
67
80
|
for (const monitorId in this.#monitors) this.#monitors[monitorId]();
|
|
68
81
|
return Promise.resolve();
|
|
69
82
|
}
|
|
70
83
|
async listen(handler, options = {}) {
|
|
71
84
|
const signal = options.signal;
|
|
72
85
|
while (signal == null || !signal.aborted) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
const idx = this.#messages.findIndex((m) => m.orderingKey == null || !this.#processingKeys.has(m.orderingKey));
|
|
87
|
+
if (idx >= 0) {
|
|
88
|
+
const queued = this.#messages.splice(idx, 1)[0];
|
|
89
|
+
const { message, orderingKey } = queued;
|
|
90
|
+
if (orderingKey != null) this.#processingKeys.add(orderingKey);
|
|
91
|
+
try {
|
|
92
|
+
await handler(message);
|
|
93
|
+
} finally {
|
|
94
|
+
if (orderingKey != null) this.#processingKeys.delete(orderingKey);
|
|
95
|
+
}
|
|
96
|
+
} else if (this.#messages.length === 0) await this.#wait(this.#pollIntervalMs, signal);
|
|
97
|
+
else await this.#wait(10, signal);
|
|
78
98
|
}
|
|
79
99
|
}
|
|
80
100
|
#wait(ms, signal) {
|
|
@@ -106,6 +126,21 @@ var InProcessMessageQueue = class {
|
|
|
106
126
|
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
107
127
|
* workloads.
|
|
108
128
|
*
|
|
129
|
+
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
130
|
+
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
131
|
+
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
132
|
+
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
133
|
+
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
134
|
+
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
135
|
+
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
136
|
+
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
137
|
+
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
138
|
+
*
|
|
139
|
+
* Messages with the same ordering key will never be processed concurrently
|
|
140
|
+
* by different workers, ensuring sequential processing within each key.
|
|
141
|
+
* Messages with different ordering keys (or no ordering key) can still be
|
|
142
|
+
* processed in parallel.
|
|
143
|
+
*
|
|
109
144
|
* @since 1.0.0
|
|
110
145
|
*/
|
|
111
146
|
var ParallelMessageQueue = class ParallelMessageQueue {
|
|
@@ -117,6 +152,15 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
|
117
152
|
*/
|
|
118
153
|
nativeRetrial;
|
|
119
154
|
/**
|
|
155
|
+
* Tracks which ordering keys are currently being processed to ensure
|
|
156
|
+
* sequential processing for messages with the same key.
|
|
157
|
+
*/
|
|
158
|
+
#processingKeys = /* @__PURE__ */ new Set();
|
|
159
|
+
/**
|
|
160
|
+
* Pending messages waiting for their ordering key to become available.
|
|
161
|
+
*/
|
|
162
|
+
#pendingMessages = [];
|
|
163
|
+
/**
|
|
120
164
|
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
121
165
|
* number of workers.
|
|
122
166
|
* @param queue The message queue to use under the hood. Note that
|
|
@@ -144,6 +188,25 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
|
144
188
|
}
|
|
145
189
|
await this.queue.enqueueMany(messages, options);
|
|
146
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Extracts ordering key from a message if present.
|
|
193
|
+
*
|
|
194
|
+
* This method only works for queue implementations that deliver messages
|
|
195
|
+
* in the wrapper format with `__fedify_ordering_key__` property. Currently,
|
|
196
|
+
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
197
|
+
*
|
|
198
|
+
* For other queue implementations (`InProcessMessageQueue`,
|
|
199
|
+
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
200
|
+
* `AmqpMessageQueue`), messages are delivered as raw payloads without the
|
|
201
|
+
* wrapper, so the ordering key cannot be detected here. Those
|
|
202
|
+
* implementations handle ordering guarantees internally.
|
|
203
|
+
*/
|
|
204
|
+
#extractOrderingKey(message) {
|
|
205
|
+
if (message != null && typeof message === "object") {
|
|
206
|
+
if ("__fedify_ordering_key__" in message) return message.__fedify_ordering_key__;
|
|
207
|
+
}
|
|
208
|
+
return void 0;
|
|
209
|
+
}
|
|
147
210
|
listen(handler, options = {}) {
|
|
148
211
|
const workers = /* @__PURE__ */ new Map();
|
|
149
212
|
return this.queue.listen(async (message) => {
|
|
@@ -152,13 +215,33 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
|
152
215
|
workers.delete(consumedId);
|
|
153
216
|
}
|
|
154
217
|
const workerId = crypto.randomUUID();
|
|
155
|
-
const
|
|
218
|
+
const orderingKey = this.#extractOrderingKey(message);
|
|
219
|
+
if (orderingKey != null && this.#processingKeys.has(orderingKey)) await new Promise((resolve) => {
|
|
220
|
+
this.#pendingMessages.push({
|
|
221
|
+
message,
|
|
222
|
+
orderingKey,
|
|
223
|
+
resolve
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
if (orderingKey != null) this.#processingKeys.add(orderingKey);
|
|
227
|
+
const promise = this.#work(workerId, handler, message, orderingKey);
|
|
156
228
|
workers.set(workerId, promise);
|
|
157
229
|
}, options);
|
|
158
230
|
}
|
|
159
|
-
async #work(workerId, handler, message) {
|
|
231
|
+
async #work(workerId, handler, message, orderingKey) {
|
|
160
232
|
await this.#sleep(0);
|
|
161
|
-
|
|
233
|
+
try {
|
|
234
|
+
await handler(message);
|
|
235
|
+
} finally {
|
|
236
|
+
if (orderingKey != null) {
|
|
237
|
+
this.#processingKeys.delete(orderingKey);
|
|
238
|
+
const pendingIdx = this.#pendingMessages.findIndex((p) => p.orderingKey === orderingKey);
|
|
239
|
+
if (pendingIdx >= 0) {
|
|
240
|
+
const pending = this.#pendingMessages.splice(pendingIdx, 1)[0];
|
|
241
|
+
pending.resolve();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
162
245
|
return workerId;
|
|
163
246
|
}
|
|
164
247
|
#sleep(ms) {
|
|
@@ -223,10 +306,78 @@ test("InProcessMessageQueue", async (t) => {
|
|
|
223
306
|
controller.abort();
|
|
224
307
|
await listening;
|
|
225
308
|
});
|
|
309
|
+
test("InProcessMessageQueue orderingKey", async (t) => {
|
|
310
|
+
const mq = new InProcessMessageQueue();
|
|
311
|
+
const orderTracker = {
|
|
312
|
+
keyA: [],
|
|
313
|
+
keyB: [],
|
|
314
|
+
noKey: []
|
|
315
|
+
};
|
|
316
|
+
const allMessages = [];
|
|
317
|
+
const controller = new AbortController();
|
|
318
|
+
const listening = mq.listen((message) => {
|
|
319
|
+
allMessages.push(message);
|
|
320
|
+
const trackKey = message.key ?? "noKey";
|
|
321
|
+
if (trackKey in orderTracker) orderTracker[trackKey].push(message.value);
|
|
322
|
+
}, controller);
|
|
323
|
+
await t.step("enqueue with ordering key", async () => {
|
|
324
|
+
await mq.enqueue({
|
|
325
|
+
key: "keyA",
|
|
326
|
+
value: 1
|
|
327
|
+
}, { orderingKey: "keyA" });
|
|
328
|
+
await mq.enqueue({
|
|
329
|
+
key: "keyB",
|
|
330
|
+
value: 1
|
|
331
|
+
}, { orderingKey: "keyB" });
|
|
332
|
+
await mq.enqueue({
|
|
333
|
+
key: "keyA",
|
|
334
|
+
value: 2
|
|
335
|
+
}, { orderingKey: "keyA" });
|
|
336
|
+
await mq.enqueue({
|
|
337
|
+
key: "keyB",
|
|
338
|
+
value: 2
|
|
339
|
+
}, { orderingKey: "keyB" });
|
|
340
|
+
await mq.enqueue({
|
|
341
|
+
key: "keyA",
|
|
342
|
+
value: 3
|
|
343
|
+
}, { orderingKey: "keyA" });
|
|
344
|
+
await mq.enqueue({
|
|
345
|
+
key: "keyB",
|
|
346
|
+
value: 3
|
|
347
|
+
}, { orderingKey: "keyB" });
|
|
348
|
+
await mq.enqueue({
|
|
349
|
+
key: null,
|
|
350
|
+
value: 1
|
|
351
|
+
});
|
|
352
|
+
await mq.enqueue({
|
|
353
|
+
key: null,
|
|
354
|
+
value: 2
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
await waitFor(() => allMessages.length >= 8, 3e4);
|
|
358
|
+
await t.step("verify ordering key order", () => {
|
|
359
|
+
assertEquals(orderTracker.keyA, [
|
|
360
|
+
1,
|
|
361
|
+
2,
|
|
362
|
+
3
|
|
363
|
+
], "Messages with orderingKey 'keyA' should be processed in order");
|
|
364
|
+
assertEquals(orderTracker.keyB, [
|
|
365
|
+
1,
|
|
366
|
+
2,
|
|
367
|
+
3
|
|
368
|
+
], "Messages with orderingKey 'keyB' should be processed in order");
|
|
369
|
+
});
|
|
370
|
+
await t.step("verify messages without ordering key", () => {
|
|
371
|
+
assertEquals(orderTracker.noKey.length, 2, "Messages without ordering key should all be received");
|
|
372
|
+
assert(orderTracker.noKey.includes(1) && orderTracker.noKey.includes(2), "Messages without ordering key should contain values 1 and 2");
|
|
373
|
+
});
|
|
374
|
+
controller.abort();
|
|
375
|
+
await listening;
|
|
376
|
+
});
|
|
226
377
|
test("MessageQueue.nativeRetrial", async (t) => {
|
|
227
378
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") await t.step("DenoKvMessageQueue", async () => {
|
|
228
|
-
const packageName = "@fedify/denokv";
|
|
229
|
-
const { DenoKvMessageQueue } = await import(packageName);
|
|
379
|
+
const packageName = () => "@fedify/denokv";
|
|
380
|
+
const { DenoKvMessageQueue } = await import(packageName());
|
|
230
381
|
const mq = new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
|
231
382
|
assert(mq.nativeRetrial);
|
|
232
383
|
if (Symbol.dispose in mq) {
|
|
@@ -265,8 +416,8 @@ test("MessageQueue.nativeRetrial", async (t) => {
|
|
|
265
416
|
});
|
|
266
417
|
const queues = { InProcessMessageQueue: () => Promise.resolve(new InProcessMessageQueue()) };
|
|
267
418
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") {
|
|
268
|
-
const packageName = "@fedify/denokv";
|
|
269
|
-
const { DenoKvMessageQueue } = await import(packageName);
|
|
419
|
+
const packageName = () => "@fedify/denokv";
|
|
420
|
+
const { DenoKvMessageQueue } = await import(packageName());
|
|
270
421
|
queues.DenoKvMessageQueue = async () => new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
|
271
422
|
}
|
|
272
423
|
for (const mqName in queues) test({
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../
|
|
6
|
+
import { test } from "../dist-B5f6a8Tt.js";
|
|
7
7
|
import "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import { acceptsJsonLd } from "../negotiation-
|
|
11
|
-
import { test } from "../testing-BslrM_9E.js";
|
|
10
|
+
import { acceptsJsonLd } from "../negotiation-5NPJL6zp.js";
|
|
12
11
|
import "../std__assert-DWivtrGR.js";
|
|
13
12
|
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
|
14
13
|
import "../assert_throws-BNXdRGWP.js";
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../
|
|
6
|
+
import { test } from "../dist-B5f6a8Tt.js";
|
|
7
7
|
import { AssertionError, assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
|
-
import { createExponentialBackoffPolicy } from "../retry-
|
|
9
|
-
import { test } from "../testing-BslrM_9E.js";
|
|
8
|
+
import { createExponentialBackoffPolicy } from "../retry-D4GJ670a.js";
|
|
10
9
|
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
|
11
10
|
|
|
12
11
|
//#region src/federation/retry.test.ts
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { test } from "../dist-B5f6a8Tt.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import {
|
|
10
|
+
import { Router, RouterError } from "../router-D9eI0s4b.js";
|
|
11
11
|
import "../std__assert-DWivtrGR.js";
|
|
12
12
|
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
|
13
13
|
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
@@ -3,23 +3,22 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { createTestTracerProvider, mockDocumentLoader, test } from "../dist-B5f6a8Tt.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
|
-
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import "../
|
|
11
|
-
import "../key-
|
|
12
|
-
import { verifyRequest } from "../http-
|
|
13
|
-
import { doesActorOwnKey } from "../owner-
|
|
14
|
-
import { extractInboxes, sendActivity } from "../send-
|
|
15
|
-
import { mockDocumentLoader, test } from "../testing-BslrM_9E.js";
|
|
9
|
+
import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
+
import "../deno-DGx1JZHr.js";
|
|
11
|
+
import "../key-BCtt1Ugy.js";
|
|
12
|
+
import { verifyRequest } from "../http-LGtYlSfN.js";
|
|
13
|
+
import { doesActorOwnKey } from "../owner-Cejm-F7S.js";
|
|
14
|
+
import { SendActivityError, extractInboxes, sendActivity } from "../send-jFxXfsN8.js";
|
|
16
15
|
import "../std__assert-DWivtrGR.js";
|
|
17
16
|
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
|
18
17
|
import "../assert_throws-BNXdRGWP.js";
|
|
19
18
|
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
|
20
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
19
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-ZbcByPg9.js";
|
|
20
|
+
import { esm_default } from "../esm-DGl7uK1r.js";
|
|
21
|
+
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
23
22
|
|
|
24
23
|
//#region src/federation/send.test.ts
|
|
25
24
|
test("extractInboxes()", () => {
|
|
@@ -211,6 +210,89 @@ test("sendActivity()", async (t) => {
|
|
|
211
210
|
inbox: new URL("https://example.com/inbox2")
|
|
212
211
|
}), Error, "Failed to send activity https://example.com/activity to https://example.com/inbox2 (500 Internal Server Error):\nsomething went wrong");
|
|
213
212
|
});
|
|
213
|
+
await t.step("failure throws SendActivityError", async () => {
|
|
214
|
+
const activity = {
|
|
215
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
216
|
+
"type": "Create",
|
|
217
|
+
"id": "https://example.com/activity",
|
|
218
|
+
"actor": "https://example.com/person"
|
|
219
|
+
};
|
|
220
|
+
try {
|
|
221
|
+
await sendActivity({
|
|
222
|
+
activity,
|
|
223
|
+
activityId: "https://example.com/activity",
|
|
224
|
+
keys: [{
|
|
225
|
+
privateKey: rsaPrivateKey2,
|
|
226
|
+
keyId: rsaPublicKey2.id
|
|
227
|
+
}],
|
|
228
|
+
inbox: new URL("https://example.com/inbox2")
|
|
229
|
+
});
|
|
230
|
+
assert(false, "Should have thrown");
|
|
231
|
+
} catch (e) {
|
|
232
|
+
assertInstanceOf(e, SendActivityError);
|
|
233
|
+
assertEquals(e.statusCode, 500);
|
|
234
|
+
assertEquals(e.inbox, new URL("https://example.com/inbox2"));
|
|
235
|
+
assertEquals(e.responseBody, "something went wrong");
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
esm_default.post("https://example.com/inbox-gone", {
|
|
239
|
+
status: 410,
|
|
240
|
+
body: "Gone"
|
|
241
|
+
});
|
|
242
|
+
await t.step("410 Gone throws SendActivityError", async () => {
|
|
243
|
+
const activity = {
|
|
244
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
245
|
+
"type": "Create",
|
|
246
|
+
"id": "https://example.com/activity",
|
|
247
|
+
"actor": "https://example.com/person"
|
|
248
|
+
};
|
|
249
|
+
try {
|
|
250
|
+
await sendActivity({
|
|
251
|
+
activity,
|
|
252
|
+
activityId: "https://example.com/activity",
|
|
253
|
+
keys: [{
|
|
254
|
+
privateKey: rsaPrivateKey2,
|
|
255
|
+
keyId: rsaPublicKey2.id
|
|
256
|
+
}],
|
|
257
|
+
inbox: new URL("https://example.com/inbox-gone")
|
|
258
|
+
});
|
|
259
|
+
assert(false, "Should have thrown");
|
|
260
|
+
} catch (e) {
|
|
261
|
+
assertInstanceOf(e, SendActivityError);
|
|
262
|
+
assertEquals(e.statusCode, 410);
|
|
263
|
+
assertEquals(e.inbox, new URL("https://example.com/inbox-gone"));
|
|
264
|
+
assertEquals(e.responseBody, "Gone");
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
esm_default.post("https://example.com/inbox-notfound", {
|
|
268
|
+
status: 404,
|
|
269
|
+
body: "Not Found"
|
|
270
|
+
});
|
|
271
|
+
await t.step("404 Not Found throws SendActivityError", async () => {
|
|
272
|
+
const activity = {
|
|
273
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
274
|
+
"type": "Create",
|
|
275
|
+
"id": "https://example.com/activity",
|
|
276
|
+
"actor": "https://example.com/person"
|
|
277
|
+
};
|
|
278
|
+
try {
|
|
279
|
+
await sendActivity({
|
|
280
|
+
activity,
|
|
281
|
+
activityId: "https://example.com/activity",
|
|
282
|
+
keys: [{
|
|
283
|
+
privateKey: rsaPrivateKey2,
|
|
284
|
+
keyId: rsaPublicKey2.id
|
|
285
|
+
}],
|
|
286
|
+
inbox: new URL("https://example.com/inbox-notfound")
|
|
287
|
+
});
|
|
288
|
+
assert(false, "Should have thrown");
|
|
289
|
+
} catch (e) {
|
|
290
|
+
assertInstanceOf(e, SendActivityError);
|
|
291
|
+
assertEquals(e.statusCode, 404);
|
|
292
|
+
assertEquals(e.inbox, new URL("https://example.com/inbox-notfound"));
|
|
293
|
+
assertEquals(e.responseBody, "Not Found");
|
|
294
|
+
}
|
|
295
|
+
});
|
|
214
296
|
esm_default.hardReset();
|
|
215
297
|
});
|
|
216
298
|
test("sendActivity() records OpenTelemetry span events", async (t) => {
|
|
@@ -3,36 +3,38 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { test } from "../dist-B5f6a8Tt.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import { MemoryKvStore } from "../kv-
|
|
11
|
-
import
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import "../
|
|
19
|
-
import "../
|
|
20
|
-
import "../
|
|
21
|
-
import "../
|
|
22
|
-
import "../
|
|
23
|
-
import "../
|
|
24
|
-
import "../
|
|
25
|
-
import "../
|
|
26
|
-
import "../
|
|
27
|
-
import "../
|
|
28
|
-
import "../
|
|
29
|
-
import
|
|
10
|
+
import { MemoryKvStore } from "../kv-QzKcOQgP.js";
|
|
11
|
+
import "../deno-DGx1JZHr.js";
|
|
12
|
+
import { createFederation, handleWebFinger } from "../middleware-WokE4qxc.js";
|
|
13
|
+
import "../client-Dg7OfUDA.js";
|
|
14
|
+
import "../router-D9eI0s4b.js";
|
|
15
|
+
import "../types-CPz01LGH.js";
|
|
16
|
+
import "../key-BCtt1Ugy.js";
|
|
17
|
+
import "../http-LGtYlSfN.js";
|
|
18
|
+
import "../ld-QlZPwGEH.js";
|
|
19
|
+
import "../owner-Cejm-F7S.js";
|
|
20
|
+
import "../proof-BOQBHd-i.js";
|
|
21
|
+
import "../docloader-D8UHsyqD.js";
|
|
22
|
+
import "../kv-cache-B__dHl7g.js";
|
|
23
|
+
import "../inbox-DbtWQY2D.js";
|
|
24
|
+
import "../builder-DTlQwmVF.js";
|
|
25
|
+
import "../collection-CcnIw1qY.js";
|
|
26
|
+
import "../keycache-DRxpZ5r9.js";
|
|
27
|
+
import "../negotiation-5NPJL6zp.js";
|
|
28
|
+
import "../retry-D4GJ670a.js";
|
|
29
|
+
import "../send-jFxXfsN8.js";
|
|
30
30
|
import "../std__assert-DWivtrGR.js";
|
|
31
31
|
import "../assert_rejects-Ce45JcFg.js";
|
|
32
32
|
import "../assert_throws-BNXdRGWP.js";
|
|
33
33
|
import "../assert_not_equals-C80BG-_5.js";
|
|
34
|
+
import { createRequestContext } from "../context-CZ5llAss.js";
|
|
35
|
+
import { Image, Link, Person } from "@fedify/vocab";
|
|
34
36
|
|
|
35
|
-
//#region src/webfinger
|
|
37
|
+
//#region src/federation/webfinger.test.ts
|
|
36
38
|
test("handleWebFinger()", async (t) => {
|
|
37
39
|
const url = new URL("https://example.com/.well-known/webfinger");
|
|
38
40
|
function createContext(url$1) {
|