@fedify/fedify 1.6.4 → 1.7.0-dev.888
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/{actor-BfzxE2QN.js → actor-D_TAErPk.js} +184 -199
- package/dist/{actor-CHPy3MD6.js → actor-DtsixKAW.js} +3 -3
- package/dist/{assert-0DSnLFa8.js → assert-YJk-1DlZ.js} +1 -1
- package/dist/{assert_equals-XhPMqqO2.js → assert_equals-Dnj7ejjL.js} +7 -19
- package/dist/{assert_instance_of-v5adm_-K.js → assert_instance_of-DBIoG5k7.js} +1 -1
- package/dist/{assert_is_error-Drwb_yQp.js → assert_is_error-jyzqjHud.js} +1 -1
- package/dist/{assert_not_equals-BRPdeJ9D.js → assert_not_equals-wx-SRs4i.js} +1 -1
- package/dist/{assert_rejects-D_nYI1gs.js → assert_rejects-BZjUwo62.js} +2 -2
- package/dist/{assert_throws-DNuPhPNp.js → assert_throws-gBPv3v2V.js} +2 -2
- package/dist/{authdocloader-8yB-xGBR.js → authdocloader-Cj8NhE13.js} +3 -3
- package/dist/{authdocloader-qBxZEEi9.js → authdocloader-D3lP3oQJ.js} +3 -3
- package/dist/{builder-NApTRrpC.js → builder-q1rdJ7Qu.js} +3 -3
- package/dist/{client-DFAp6PBu.js → client-DUX3b6Xa.js} +2 -2
- package/dist/compat/mod.d.ts +3 -3
- package/dist/compat/transformers.test.js +23 -23
- package/dist/{context-DPm_2m4V.js → context-CJunwlbH.js} +2 -2
- package/dist/{context-DRhhOsMk.d.ts → context-DdICJaUT.d.ts} +1 -1
- package/dist/{denokv-B_GFWjrl.js → denokv-CvROlGYX.js} +5 -0
- package/dist/{docloader-Chzwgszm.js → docloader-CD0wlEX1.js} +1 -1
- package/dist/{docloader-BGQB_PFT.js → docloader-D933g4kZ.js} +1 -1
- package/dist/{esm-CASHO3OR.js → esm-Btx3E8og.js} +12 -18
- package/dist/federation/builder.test.js +14 -14
- package/dist/federation/collection.test.js +9 -9
- package/dist/federation/handler.test.js +31 -34
- package/dist/federation/inbox.test.js +7 -7
- package/dist/federation/keycache.test.js +7 -7
- package/dist/federation/kv.test.js +9 -9
- package/dist/federation/middleware.test.js +167 -31
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +11 -11
- package/dist/federation/mq.test.js +66 -10
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +19 -19
- package/dist/{federation-3B6BDKCK.js → federation-lZOZyLAo.js} +11 -0
- package/dist/{http-DJcO8N65.js → http-CQmvdqnv.js} +9 -23
- package/dist/{http-CoPwpYGd.js → http-fivRSxPO.js} +9 -23
- package/dist/{inbox-CL7Y2POM.js → inbox-Dxm3dzXC.js} +2 -2
- package/dist/{key-vNs-KWCR.js → key-8FgmjBQw.js} +2 -2
- package/dist/{key-5iwxfdk7.js → key-Bd9x5bZc.js} +3 -3
- package/dist/{key-BQEmzABV.js → key-CDrBZp4z.js} +4 -4
- package/dist/{key-dki_alWE.js → key-DA2WNLBR.js} +5 -5
- package/dist/{keycache-oIWQCIss.js → keycache-DpxW9Koh.js} +1 -1
- package/dist/{keys-BF9Wnizj.js → keys-B0uS_qcm.js} +1 -1
- package/dist/{ld-Bro1OUaC.js → ld-EwYuTK6H.js} +3 -3
- package/dist/{lookup-DVLRiy-x.js → lookup-DEkWpnDW.js} +1 -1
- package/dist/{lookup-BE2D88-F.js → lookup-DF-Kf8aT.js} +1 -1
- package/dist/{lookup-BNZr2r1q.js → lookup-DJEy1utC.js} +3 -3
- package/dist/{middleware-BoJeFg8A.js → middleware-BP-bBD2r.js} +37 -16
- package/dist/{middleware-DIMI9i2M.js → middleware-CQ7qEYyO.js} +31 -10
- package/dist/middleware-CWgW_9AC.js +17 -0
- package/dist/middleware-D9gKZ14Q.js +33 -0
- package/dist/{mod-CgmTOt4z.d.ts → mod-5orySGMZ.d.ts} +1 -1
- package/dist/mod.d.ts +3 -3
- package/dist/mod.js +11 -11
- package/dist/{mq-nceTGCuc.d.ts → mq-DYKDDJmp.d.ts} +20 -0
- package/dist/nodeinfo/client.test.js +13 -13
- package/dist/nodeinfo/handler.test.js +29 -29
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +10 -10
- package/dist/nodeinfo/types.test.js +11 -11
- package/dist/{owner-B5psHPX0.js → owner-Cc4nwvMO.js} +3 -3
- package/dist/{proof-Bxho-Eev.js → proof-CQOQgQLC.js} +3 -3
- package/dist/{proof-Ck9qUTzW.js → proof-dej36xUb.js} +3 -3
- package/dist/runtime/authdocloader.test.js +18 -18
- package/dist/runtime/docloader.test.js +11 -11
- package/dist/runtime/key.test.js +14 -14
- package/dist/runtime/langstr.test.js +9 -9
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +9 -9
- package/dist/runtime/url.test.js +5 -5
- package/dist/{semver-DWClQt_5.js → semver-CbbIgUsa.js} +2 -2
- package/dist/{send-D4-hN_vq.js → send-Cs6hGpVz.js} +2 -2
- package/dist/sig/http.test.js +23 -51
- package/dist/sig/key.test.js +15 -15
- package/dist/sig/ld.test.js +13 -13
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +17 -17
- package/dist/sig/proof.test.js +17 -17
- package/dist/{std__assert-CmyZxqPw.js → std__assert-CHXwj7zk.js} +1 -1
- package/dist/testing/docloader.test.js +9 -9
- package/dist/testing/mod.js +1 -1
- package/dist/{testing-BZ0dJ4qn.js → testing-jcGLO9Lp.js} +1 -1
- package/dist/{types-BaxpHQDE.js → types-Bn2FleIz.js} +3 -3
- package/dist/{types-C7C_l-jz.js → types-CqoqWDkp.js} +1 -1
- package/dist/vocab/actor.test.js +15 -15
- package/dist/vocab/announce.yaml +1 -3
- package/dist/vocab/create.yaml +1 -3
- package/dist/vocab/delete.yaml +1 -3
- package/dist/vocab/lookup.test.js +14 -14
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/question.yaml +1 -3
- package/dist/vocab/type.test.js +4 -4
- package/dist/vocab/update.yaml +1 -3
- package/dist/vocab/vocab.test.js +34 -37
- package/dist/{vocab-Bcgf3ubZ.js → vocab-BKrOvMEW.js} +3 -3
- package/dist/{vocab-DrV5TQKL.js → vocab-BeUz_sCd.js} +184 -199
- package/dist/webfinger/handler.test.js +29 -29
- package/dist/webfinger/lookup.test.js +12 -12
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.d.ts +7 -1
- package/dist/x/cfworkers.js +6 -0
- package/dist/x/cfworkers.test.js +15 -9
- package/dist/x/hono.d.ts +2 -2
- package/dist/x/sveltekit.d.ts +2 -2
- package/package.json +1 -1
- package/dist/middleware-30sYf6H-.js +0 -17
- package/dist/middleware-DvIti4UE.js +0 -33
@@ -3,17 +3,17 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import "../docloader-CD0wlEX1.js";
|
8
8
|
import "../url-kTAI6_KP.js";
|
9
9
|
import "../multibase-DeCHcK8L.js";
|
10
|
-
import { Activity, Create, Invite, Offer, Update } from "../vocab-
|
10
|
+
import { Activity, Create, Invite, Offer, Update } from "../vocab-BeUz_sCd.js";
|
11
11
|
import "../langstr-DbWheeIS.js";
|
12
12
|
import "../type-D2s5lmbZ.js";
|
13
|
-
import { InboxListenerSet } from "../inbox-
|
14
|
-
import { test } from "../testing-
|
15
|
-
import "../assert_is_error-
|
16
|
-
import { assertThrows } from "../assert_throws-
|
13
|
+
import { InboxListenerSet } from "../inbox-Dxm3dzXC.js";
|
14
|
+
import { test } from "../testing-jcGLO9Lp.js";
|
15
|
+
import "../assert_is_error-jyzqjHud.js";
|
16
|
+
import { assertThrows } from "../assert_throws-gBPv3v2V.js";
|
17
17
|
|
18
18
|
//#region federation/inbox.test.ts
|
19
19
|
test("InboxListenerSet", () => {
|
@@ -3,17 +3,17 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
8
|
-
import { assertInstanceOf } from "../assert_instance_of-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import { assert } from "../assert-YJk-1DlZ.js";
|
8
|
+
import { assertInstanceOf } from "../assert_instance_of-DBIoG5k7.js";
|
9
9
|
import { MemoryKvStore } from "../kv-DohFOP2C.js";
|
10
|
-
import "../docloader-
|
10
|
+
import "../docloader-CD0wlEX1.js";
|
11
11
|
import "../url-kTAI6_KP.js";
|
12
12
|
import "../multibase-DeCHcK8L.js";
|
13
|
-
import { CryptographicKey, Multikey } from "../vocab-
|
13
|
+
import { CryptographicKey, Multikey } from "../vocab-BeUz_sCd.js";
|
14
14
|
import "../langstr-DbWheeIS.js";
|
15
|
-
import { KvKeyCache } from "../keycache-
|
16
|
-
import { test } from "../testing-
|
15
|
+
import { KvKeyCache } from "../keycache-DpxW9Koh.js";
|
16
|
+
import { test } from "../testing-jcGLO9Lp.js";
|
17
17
|
|
18
18
|
//#region federation/keycache.test.ts
|
19
19
|
test("KvKeyCache.set()", async () => {
|
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import "../assert-
|
8
|
-
import "../assert_instance_of-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import "../assert-YJk-1DlZ.js";
|
8
|
+
import "../assert_instance_of-DBIoG5k7.js";
|
9
9
|
import { MemoryKvStore } from "../kv-DohFOP2C.js";
|
10
|
-
import { test } from "../testing-
|
11
|
-
import "../std__assert-
|
12
|
-
import "../assert_rejects-
|
13
|
-
import "../assert_is_error-
|
14
|
-
import "../assert_not_equals-
|
15
|
-
import "../assert_throws-
|
10
|
+
import { test } from "../testing-jcGLO9Lp.js";
|
11
|
+
import "../std__assert-CHXwj7zk.js";
|
12
|
+
import "../assert_rejects-BZjUwo62.js";
|
13
|
+
import "../assert_is_error-jyzqjHud.js";
|
14
|
+
import "../assert_not_equals-wx-SRs4i.js";
|
15
|
+
import "../assert_throws-gBPv3v2V.js";
|
16
16
|
|
17
17
|
//#region federation/kv.test.ts
|
18
18
|
test("MemoryKvStore", async (t) => {
|
@@ -3,45 +3,45 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
8
|
-
import { assertInstanceOf } from "../assert_instance_of-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import { assert } from "../assert-YJk-1DlZ.js";
|
8
|
+
import { assertInstanceOf } from "../assert_instance_of-DBIoG5k7.js";
|
9
9
|
import { MemoryKvStore } from "../kv-DohFOP2C.js";
|
10
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, createFederation } from "../middleware-
|
11
|
-
import { FetchError, fetchDocumentLoader } from "../docloader-
|
10
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, createFederation } from "../middleware-BP-bBD2r.js";
|
11
|
+
import { FetchError, fetchDocumentLoader } from "../docloader-CD0wlEX1.js";
|
12
12
|
import "../url-kTAI6_KP.js";
|
13
|
-
import "../semver-
|
14
|
-
import "../client-
|
13
|
+
import "../semver-CbbIgUsa.js";
|
14
|
+
import "../client-DUX3b6Xa.js";
|
15
15
|
import { RouterError } from "../router-D_aVZZUc.js";
|
16
|
-
import "../types-
|
16
|
+
import "../types-CqoqWDkp.js";
|
17
17
|
import "../multibase-DeCHcK8L.js";
|
18
|
-
import { Activity, Announce, Create, Invite, Multikey, Note, Object as Object$1, Offer, Person } from "../vocab-
|
18
|
+
import { Activity, Announce, Create, Invite, Multikey, Note, Object as Object$1, Offer, Person } from "../vocab-BeUz_sCd.js";
|
19
19
|
import "../langstr-DbWheeIS.js";
|
20
|
-
import "../lookup-
|
20
|
+
import "../lookup-DF-Kf8aT.js";
|
21
21
|
import { getTypeId } from "../type-D2s5lmbZ.js";
|
22
|
-
import "../actor-
|
23
|
-
import "../key-
|
24
|
-
import { signRequest, verifyRequest } from "../http-
|
25
|
-
import { getAuthenticatedDocumentLoader } from "../authdocloader-
|
26
|
-
import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-
|
27
|
-
import { doesActorOwnKey } from "../owner-
|
28
|
-
import { signObject, verifyObject } from "../proof-
|
29
|
-
import { lookupObject } from "../lookup-
|
30
|
-
import "../inbox-
|
31
|
-
import "../builder-
|
22
|
+
import "../actor-DtsixKAW.js";
|
23
|
+
import "../key-Bd9x5bZc.js";
|
24
|
+
import { signRequest, verifyRequest } from "../http-CQmvdqnv.js";
|
25
|
+
import { getAuthenticatedDocumentLoader } from "../authdocloader-D3lP3oQJ.js";
|
26
|
+
import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-EwYuTK6H.js";
|
27
|
+
import { doesActorOwnKey } from "../owner-Cc4nwvMO.js";
|
28
|
+
import { signObject, verifyObject } from "../proof-dej36xUb.js";
|
29
|
+
import { lookupObject } from "../lookup-DJEy1utC.js";
|
30
|
+
import "../inbox-Dxm3dzXC.js";
|
31
|
+
import "../builder-q1rdJ7Qu.js";
|
32
32
|
import "../collection-Dfb0TPno.js";
|
33
|
-
import "../keycache-
|
33
|
+
import "../keycache-DpxW9Koh.js";
|
34
34
|
import "../retry-BiIhZWgD.js";
|
35
|
-
import "../send-
|
36
|
-
import { test } from "../testing-
|
37
|
-
import { assertStrictEquals } from "../std__assert-
|
38
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
39
|
-
import "../assert_is_error-
|
40
|
-
import { assertNotEquals } from "../assert_not_equals-
|
41
|
-
import { assertThrows } from "../assert_throws-
|
35
|
+
import "../send-Cs6hGpVz.js";
|
36
|
+
import { test } from "../testing-jcGLO9Lp.js";
|
37
|
+
import { assertStrictEquals } from "../std__assert-CHXwj7zk.js";
|
38
|
+
import { assertFalse, assertRejects } from "../assert_rejects-BZjUwo62.js";
|
39
|
+
import "../assert_is_error-jyzqjHud.js";
|
40
|
+
import { assertNotEquals } from "../assert_not_equals-wx-SRs4i.js";
|
41
|
+
import { assertThrows } from "../assert_throws-gBPv3v2V.js";
|
42
42
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
43
|
-
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-
|
44
|
-
import { esm_default } from "../esm-
|
43
|
+
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-B0uS_qcm.js";
|
44
|
+
import { esm_default } from "../esm-Btx3E8og.js";
|
45
45
|
|
46
46
|
//#region testing/fixtures/example.com/person.json
|
47
47
|
var __context$1 = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"];
|
@@ -933,7 +933,7 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
933
933
|
privateKey: rsaPrivateKey2,
|
934
934
|
publicKey: rsaPublicKey2.publicKey
|
935
935
|
}]);
|
936
|
-
const error =
|
936
|
+
const error = new Error("test");
|
937
937
|
const errors = [];
|
938
938
|
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
|
939
939
|
throw error;
|
@@ -1068,6 +1068,142 @@ test("FederationImpl.sendActivity()", async (t) => {
|
|
1068
1068
|
});
|
1069
1069
|
esm_default.hardReset();
|
1070
1070
|
});
|
1071
|
+
test("FederationImpl.processQueuedTask()", async (t) => {
|
1072
|
+
await t.step("with MessageQueue having nativeRetrial", async () => {
|
1073
|
+
const kv = new MemoryKvStore();
|
1074
|
+
const queuedMessages = [];
|
1075
|
+
const queue = {
|
1076
|
+
nativeRetrial: true,
|
1077
|
+
enqueue(message, _options) {
|
1078
|
+
queuedMessages.push(message);
|
1079
|
+
return Promise.resolve();
|
1080
|
+
},
|
1081
|
+
listen(_handler, _options) {
|
1082
|
+
return Promise.resolve();
|
1083
|
+
}
|
1084
|
+
};
|
1085
|
+
const federation = new FederationImpl({
|
1086
|
+
kv,
|
1087
|
+
queue
|
1088
|
+
});
|
1089
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
|
1090
|
+
throw new Error("Intended error for testing");
|
1091
|
+
});
|
1092
|
+
await assertRejects(() => federation.processQueuedTask(void 0, {
|
1093
|
+
type: "outbox",
|
1094
|
+
id: crypto.randomUUID(),
|
1095
|
+
baseUrl: "https://example.com",
|
1096
|
+
keys: [],
|
1097
|
+
activity: {
|
1098
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
1099
|
+
type: "Create",
|
1100
|
+
actor: "https://example.com/users/alice",
|
1101
|
+
object: {
|
1102
|
+
type: "Note",
|
1103
|
+
content: "test"
|
1104
|
+
}
|
1105
|
+
},
|
1106
|
+
activityType: "https://www.w3.org/ns/activitystreams#Create",
|
1107
|
+
inbox: "https://invalid-domain-that-does-not-exist.example/inbox",
|
1108
|
+
sharedInbox: false,
|
1109
|
+
started: (/* @__PURE__ */ new Date()).toISOString(),
|
1110
|
+
attempt: 0,
|
1111
|
+
headers: {},
|
1112
|
+
traceContext: {}
|
1113
|
+
}), Error);
|
1114
|
+
assertEquals(queuedMessages, []);
|
1115
|
+
await assertRejects(() => federation.processQueuedTask(void 0, {
|
1116
|
+
type: "inbox",
|
1117
|
+
id: crypto.randomUUID(),
|
1118
|
+
baseUrl: "https://example.com",
|
1119
|
+
activity: {
|
1120
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
1121
|
+
type: "Create",
|
1122
|
+
actor: "https://remote.example/users/alice",
|
1123
|
+
object: {
|
1124
|
+
type: "Note",
|
1125
|
+
content: "Hello world"
|
1126
|
+
}
|
1127
|
+
},
|
1128
|
+
started: (/* @__PURE__ */ new Date()).toISOString(),
|
1129
|
+
attempt: 0,
|
1130
|
+
identifier: null,
|
1131
|
+
traceContext: {}
|
1132
|
+
}), Error);
|
1133
|
+
assertEquals(queuedMessages, []);
|
1134
|
+
});
|
1135
|
+
await t.step("with MessageQueue having no nativeRetrial", async () => {
|
1136
|
+
const kv = new MemoryKvStore();
|
1137
|
+
let queuedMessages = [];
|
1138
|
+
const queue = {
|
1139
|
+
enqueue(message, _options) {
|
1140
|
+
queuedMessages.push(message);
|
1141
|
+
return Promise.resolve();
|
1142
|
+
},
|
1143
|
+
listen(_handler, _options) {
|
1144
|
+
return Promise.resolve();
|
1145
|
+
}
|
1146
|
+
};
|
1147
|
+
const federation = new FederationImpl({
|
1148
|
+
kv,
|
1149
|
+
queue
|
1150
|
+
});
|
1151
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
|
1152
|
+
throw new Error("Intended error for testing");
|
1153
|
+
});
|
1154
|
+
const outboxMessage = {
|
1155
|
+
type: "outbox",
|
1156
|
+
id: crypto.randomUUID(),
|
1157
|
+
baseUrl: "https://example.com",
|
1158
|
+
keys: [],
|
1159
|
+
activity: {
|
1160
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
1161
|
+
type: "Create",
|
1162
|
+
actor: "https://example.com/users/alice",
|
1163
|
+
object: {
|
1164
|
+
type: "Note",
|
1165
|
+
content: "test"
|
1166
|
+
}
|
1167
|
+
},
|
1168
|
+
activityType: "https://www.w3.org/ns/activitystreams#Create",
|
1169
|
+
inbox: "https://invalid-domain-that-does-not-exist.example/inbox",
|
1170
|
+
sharedInbox: false,
|
1171
|
+
started: (/* @__PURE__ */ new Date()).toISOString(),
|
1172
|
+
attempt: 0,
|
1173
|
+
headers: {},
|
1174
|
+
traceContext: {}
|
1175
|
+
};
|
1176
|
+
await federation.processQueuedTask(void 0, outboxMessage);
|
1177
|
+
assertEquals(queuedMessages, [{
|
1178
|
+
...outboxMessage,
|
1179
|
+
attempt: 1
|
1180
|
+
}]);
|
1181
|
+
queuedMessages = [];
|
1182
|
+
const inboxMessage = {
|
1183
|
+
type: "inbox",
|
1184
|
+
id: crypto.randomUUID(),
|
1185
|
+
baseUrl: "https://example.com",
|
1186
|
+
activity: {
|
1187
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
1188
|
+
type: "Create",
|
1189
|
+
actor: "https://remote.example/users/alice",
|
1190
|
+
object: {
|
1191
|
+
type: "Note",
|
1192
|
+
content: "Hello world"
|
1193
|
+
}
|
1194
|
+
},
|
1195
|
+
started: (/* @__PURE__ */ new Date()).toISOString(),
|
1196
|
+
attempt: 0,
|
1197
|
+
identifier: null,
|
1198
|
+
traceContext: {}
|
1199
|
+
};
|
1200
|
+
await federation.processQueuedTask(void 0, inboxMessage);
|
1201
|
+
assertEquals(queuedMessages, [{
|
1202
|
+
...inboxMessage,
|
1203
|
+
attempt: 1
|
1204
|
+
}]);
|
1205
|
+
});
|
1206
|
+
});
|
1071
1207
|
test("ContextImpl.lookupObject()", async (t) => {
|
1072
1208
|
esm_default.spyGlobal();
|
1073
1209
|
esm_default.get("begin:https://localhost/.well-known/webfinger", {
|
package/dist/federation/mod.d.ts
CHANGED
@@ -9,7 +9,7 @@ import "../http-BkUCISGt.js";
|
|
9
9
|
import "../owner-CbRc94FP.js";
|
10
10
|
import "../mod-DSPyncxx.js";
|
11
11
|
import "../lookup-vJccIKCS.js";
|
12
|
-
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-
|
13
|
-
import { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue } from "../mq-
|
12
|
+
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-DdICJaUT.js";
|
13
|
+
import { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue } from "../mq-DYKDDJmp.js";
|
14
14
|
import "../mod-g0xFzAP9.js";
|
15
15
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, 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, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import "../transformers-ghwJuzGY.js";
|
6
|
-
import "../docloader-
|
7
|
-
import "../actor-
|
8
|
-
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-
|
9
|
-
import "../lookup-
|
10
|
-
import "../key-
|
11
|
-
import "../http-
|
12
|
-
import "../proof-
|
13
|
-
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-
|
14
|
-
import "../types-
|
15
|
-
import "../authdocloader-
|
16
|
-
import "../vocab-
|
6
|
+
import "../docloader-D933g4kZ.js";
|
7
|
+
import "../actor-D_TAErPk.js";
|
8
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-CQ7qEYyO.js";
|
9
|
+
import "../lookup-DEkWpnDW.js";
|
10
|
+
import "../key-8FgmjBQw.js";
|
11
|
+
import "../http-fivRSxPO.js";
|
12
|
+
import "../proof-CQOQgQLC.js";
|
13
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-lZOZyLAo.js";
|
14
|
+
import "../types-Bn2FleIz.js";
|
15
|
+
import "../authdocloader-Cj8NhE13.js";
|
16
|
+
import "../vocab-BKrOvMEW.js";
|
17
17
|
|
18
18
|
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
@@ -3,15 +3,15 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import "../assert-
|
8
|
-
import "../assert_instance_of-
|
9
|
-
import { test } from "../testing-
|
10
|
-
import { assertGreater, assertGreaterOrEqual } from "../std__assert-
|
11
|
-
import "../assert_rejects-
|
12
|
-
import "../assert_is_error-
|
13
|
-
import "../assert_not_equals-
|
14
|
-
import "../assert_throws-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import { assert } from "../assert-YJk-1DlZ.js";
|
8
|
+
import "../assert_instance_of-DBIoG5k7.js";
|
9
|
+
import { test } from "../testing-jcGLO9Lp.js";
|
10
|
+
import { assertGreater, assertGreaterOrEqual } from "../std__assert-CHXwj7zk.js";
|
11
|
+
import { assertFalse } from "../assert_rejects-BZjUwo62.js";
|
12
|
+
import "../assert_is_error-jyzqjHud.js";
|
13
|
+
import "../assert_not_equals-wx-SRs4i.js";
|
14
|
+
import "../assert_throws-gBPv3v2V.js";
|
15
15
|
import { delay } from "@es-toolkit/es-toolkit";
|
16
16
|
|
17
17
|
//#region federation/mq.ts
|
@@ -27,6 +27,11 @@ var InProcessMessageQueue = class {
|
|
27
27
|
#monitors;
|
28
28
|
#pollIntervalMs;
|
29
29
|
/**
|
30
|
+
* In-process message queue does not provide native retry mechanisms.
|
31
|
+
* @since 1.7.0
|
32
|
+
*/
|
33
|
+
nativeRetrial = false;
|
34
|
+
/**
|
30
35
|
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
31
36
|
* @param options Additional options for the in-process message queue.
|
32
37
|
*/
|
@@ -107,6 +112,11 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
107
112
|
queue;
|
108
113
|
workers;
|
109
114
|
/**
|
115
|
+
* Inherits the native retry capability from the wrapped queue.
|
116
|
+
* @since 1.7.0
|
117
|
+
*/
|
118
|
+
nativeRetrial;
|
119
|
+
/**
|
110
120
|
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
111
121
|
* number of workers.
|
112
122
|
* @param queue The message queue to use under the hood. Note that
|
@@ -119,6 +129,7 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
119
129
|
if (queue instanceof ParallelMessageQueue) throw new TypeError("Cannot nest ParallelMessageQueue.");
|
120
130
|
this.queue = queue;
|
121
131
|
this.workers = workers;
|
132
|
+
this.nativeRetrial = queue.nativeRetrial;
|
122
133
|
}
|
123
134
|
enqueue(message, options) {
|
124
135
|
return this.queue.enqueue(message, options);
|
@@ -159,6 +170,9 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
159
170
|
//#region federation/mq.test.ts
|
160
171
|
test("InProcessMessageQueue", async (t) => {
|
161
172
|
const mq = new InProcessMessageQueue();
|
173
|
+
await t.step("nativeRetrial property", () => {
|
174
|
+
assertFalse(mq.nativeRetrial);
|
175
|
+
});
|
162
176
|
const messages = [];
|
163
177
|
const controller = new AbortController();
|
164
178
|
const listening = mq.listen((message) => {
|
@@ -209,9 +223,48 @@ test("InProcessMessageQueue", async (t) => {
|
|
209
223
|
controller.abort();
|
210
224
|
await listening;
|
211
225
|
});
|
226
|
+
test("MessageQueue.nativeRetrial", async (t) => {
|
227
|
+
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") await t.step("DenoKvMessageQueue", async () => {
|
228
|
+
const { DenoKvMessageQueue } = await import("../denokv-CvROlGYX.js");
|
229
|
+
const mq = new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
230
|
+
assert(mq.nativeRetrial);
|
231
|
+
if (Symbol.dispose in mq) {
|
232
|
+
const dispose = mq[Symbol.dispose];
|
233
|
+
if (typeof dispose === "function") dispose.call(mq);
|
234
|
+
}
|
235
|
+
});
|
236
|
+
await t.step("WorkersMessageQueue mock", () => {
|
237
|
+
class MockQueue {
|
238
|
+
send(_message, _options) {
|
239
|
+
return Promise.resolve();
|
240
|
+
}
|
241
|
+
sendBatch(_messages, _options) {
|
242
|
+
return Promise.resolve();
|
243
|
+
}
|
244
|
+
}
|
245
|
+
class TestWorkersMessageQueue {
|
246
|
+
nativeRetrial = true;
|
247
|
+
#queue;
|
248
|
+
constructor(queue) {
|
249
|
+
this.#queue = queue;
|
250
|
+
}
|
251
|
+
enqueue(message) {
|
252
|
+
return this.#queue.send(message);
|
253
|
+
}
|
254
|
+
enqueueMany(messages) {
|
255
|
+
return this.#queue.sendBatch(messages);
|
256
|
+
}
|
257
|
+
listen() {
|
258
|
+
throw new TypeError("WorkersMessageQueue does not support listen()");
|
259
|
+
}
|
260
|
+
}
|
261
|
+
const mq = new TestWorkersMessageQueue(new MockQueue());
|
262
|
+
assert(mq.nativeRetrial);
|
263
|
+
});
|
264
|
+
});
|
212
265
|
const queues = { InProcessMessageQueue: () => Promise.resolve(new InProcessMessageQueue()) };
|
213
266
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") {
|
214
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
267
|
+
const { DenoKvMessageQueue } = await import("../denokv-CvROlGYX.js");
|
215
268
|
queues.DenoKvMessageQueue = async () => new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
216
269
|
}
|
217
270
|
for (const mqName in queues) test({
|
@@ -220,6 +273,9 @@ for (const mqName in queues) test({
|
|
220
273
|
async fn(t) {
|
221
274
|
const mq = await queues[mqName]();
|
222
275
|
const workers = new ParallelMessageQueue(mq, 5);
|
276
|
+
await t.step("nativeRetrial property inheritance", () => {
|
277
|
+
assertEquals(workers.nativeRetrial, mq.nativeRetrial);
|
278
|
+
});
|
223
279
|
const messages = [];
|
224
280
|
const controller = new AbortController();
|
225
281
|
const listening = workers.listen(async (message) => {
|
@@ -3,10 +3,10 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { AssertionError, assertEquals } from "../assert_equals-
|
6
|
+
import { AssertionError, assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
7
|
import { createExponentialBackoffPolicy } from "../retry-BiIhZWgD.js";
|
8
|
-
import { test } from "../testing-
|
9
|
-
import { assertNotEquals } from "../assert_not_equals-
|
8
|
+
import { test } from "../testing-jcGLO9Lp.js";
|
9
|
+
import { assertNotEquals } from "../assert_not_equals-wx-SRs4i.js";
|
10
10
|
|
11
11
|
//#region federation/retry.test.ts
|
12
12
|
test("createExponentialBackoffPolicy()", () => {
|
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
8
|
-
import "../assert_instance_of-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import { assert } from "../assert-YJk-1DlZ.js";
|
8
|
+
import "../assert_instance_of-DBIoG5k7.js";
|
9
9
|
import { Router, RouterError } from "../router-D_aVZZUc.js";
|
10
|
-
import { test } from "../testing-
|
11
|
-
import "../std__assert-
|
12
|
-
import { assertFalse } from "../assert_rejects-
|
13
|
-
import "../assert_is_error-
|
14
|
-
import "../assert_not_equals-
|
15
|
-
import { assertThrows } from "../assert_throws-
|
10
|
+
import { test } from "../testing-jcGLO9Lp.js";
|
11
|
+
import "../std__assert-CHXwj7zk.js";
|
12
|
+
import { assertFalse } from "../assert_rejects-BZjUwo62.js";
|
13
|
+
import "../assert_is_error-jyzqjHud.js";
|
14
|
+
import "../assert_not_equals-wx-SRs4i.js";
|
15
|
+
import { assertThrows } from "../assert_throws-gBPv3v2V.js";
|
16
16
|
|
17
17
|
//#region federation/router.test.ts
|
18
18
|
function setUp(options = {}) {
|
@@ -3,30 +3,30 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
8
|
-
import "../assert_instance_of-
|
9
|
-
import "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-Dnj7ejjL.js";
|
7
|
+
import { assert } from "../assert-YJk-1DlZ.js";
|
8
|
+
import "../assert_instance_of-DBIoG5k7.js";
|
9
|
+
import "../docloader-CD0wlEX1.js";
|
10
10
|
import "../url-kTAI6_KP.js";
|
11
11
|
import "../multibase-DeCHcK8L.js";
|
12
|
-
import { Activity, Application, Endpoints, Group, Person, Service } from "../vocab-
|
12
|
+
import { Activity, Application, Endpoints, Group, Person, Service } from "../vocab-BeUz_sCd.js";
|
13
13
|
import "../langstr-DbWheeIS.js";
|
14
|
-
import "../lookup-
|
14
|
+
import "../lookup-DF-Kf8aT.js";
|
15
15
|
import "../type-D2s5lmbZ.js";
|
16
|
-
import "../actor-
|
17
|
-
import "../key-
|
18
|
-
import { verifyRequest } from "../http-
|
19
|
-
import { doesActorOwnKey } from "../owner-
|
20
|
-
import { extractInboxes, sendActivity } from "../send-
|
21
|
-
import { test } from "../testing-
|
22
|
-
import "../std__assert-
|
23
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
24
|
-
import "../assert_is_error-
|
25
|
-
import { assertNotEquals } from "../assert_not_equals-
|
26
|
-
import "../assert_throws-
|
16
|
+
import "../actor-DtsixKAW.js";
|
17
|
+
import "../key-Bd9x5bZc.js";
|
18
|
+
import { verifyRequest } from "../http-CQmvdqnv.js";
|
19
|
+
import { doesActorOwnKey } from "../owner-Cc4nwvMO.js";
|
20
|
+
import { extractInboxes, sendActivity } from "../send-Cs6hGpVz.js";
|
21
|
+
import { test } from "../testing-jcGLO9Lp.js";
|
22
|
+
import "../std__assert-CHXwj7zk.js";
|
23
|
+
import { assertFalse, assertRejects } from "../assert_rejects-BZjUwo62.js";
|
24
|
+
import "../assert_is_error-jyzqjHud.js";
|
25
|
+
import { assertNotEquals } from "../assert_not_equals-wx-SRs4i.js";
|
26
|
+
import "../assert_throws-gBPv3v2V.js";
|
27
27
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
28
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-
|
29
|
-
import { esm_default } from "../esm-
|
28
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-B0uS_qcm.js";
|
29
|
+
import { esm_default } from "../esm-Btx3E8og.js";
|
30
30
|
|
31
31
|
//#region federation/send.test.ts
|
32
32
|
test("extractInboxes()", () => {
|
@@ -61,6 +61,11 @@ var InProcessMessageQueue = class {
|
|
61
61
|
#monitors;
|
62
62
|
#pollIntervalMs;
|
63
63
|
/**
|
64
|
+
* In-process message queue does not provide native retry mechanisms.
|
65
|
+
* @since 1.7.0
|
66
|
+
*/
|
67
|
+
nativeRetrial = false;
|
68
|
+
/**
|
64
69
|
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
65
70
|
* @param options Additional options for the in-process message queue.
|
66
71
|
*/
|
@@ -141,6 +146,11 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
141
146
|
queue;
|
142
147
|
workers;
|
143
148
|
/**
|
149
|
+
* Inherits the native retry capability from the wrapped queue.
|
150
|
+
* @since 1.7.0
|
151
|
+
*/
|
152
|
+
nativeRetrial;
|
153
|
+
/**
|
144
154
|
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
145
155
|
* number of workers.
|
146
156
|
* @param queue The message queue to use under the hood. Note that
|
@@ -153,6 +163,7 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
153
163
|
if (queue instanceof ParallelMessageQueue) throw new TypeError("Cannot nest ParallelMessageQueue.");
|
154
164
|
this.queue = queue;
|
155
165
|
this.workers = workers;
|
166
|
+
this.nativeRetrial = queue.nativeRetrial;
|
156
167
|
}
|
157
168
|
enqueue(message, options) {
|
158
169
|
return this.queue.enqueue(message, options);
|