@fedify/fedify 2.0.0-dev.1961 → 2.0.0-dev.85
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/README.md +3 -0
- package/dist/{actor-DhgrrgXz.cjs → actor-Bpgsv6Ii.cjs} +185 -185
- package/dist/{actor-DiKHxw_H.js → actor-D3v8T9kQ.js} +185 -185
- package/dist/{actor-Kqyoic-M.js → actor-DrvDW-tK.js} +1 -1
- package/dist/{builder-BrqBKkVi.js → builder-D2trc6p7.js} +3 -3
- package/dist/compat/mod.d.cts +3 -3
- package/dist/compat/mod.d.ts +3 -3
- package/dist/compat/transformers.test.js +16 -16
- package/dist/{context-PxGADCsD.d.cts → context-DBQ7nMCw.d.cts} +1 -1
- package/dist/{context-V-XS2_6O.d.ts → context-mM0Nu5yo.d.ts} +1 -1
- package/dist/{docloader-HB61Uc88.js → docloader-DlSrn4Io.js} +2 -2
- package/dist/{esm-DaZiDvFW.js → esm-DQKBkSAc.js} +1 -1
- package/dist/federation/builder.test.js +5 -5
- package/dist/federation/collection.test.js +2 -2
- package/dist/federation/handler.test.js +104 -17
- package/dist/federation/idempotency.test.js +17 -17
- package/dist/federation/inbox.test.js +3 -3
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +57 -3
- package/dist/federation/middleware.test.js +18 -18
- package/dist/federation/mod.cjs +8 -8
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +8 -8
- package/dist/federation/mq.test.js +2 -2
- package/dist/federation/negotiation.test.js +2 -2
- package/dist/federation/retry.test.js +2 -2
- package/dist/federation/router.test.js +2 -2
- package/dist/federation/send.test.js +52 -9
- package/dist/{federation-CRpdnOMS.cjs → federation-CoW-KDKv.cjs} +22 -0
- package/dist/{federation-jcR8-ZxP.js → federation-D0hkM4T7.js} +22 -0
- package/dist/{http-B2bao4EB.js → http-BNxhNjYm.js} +2 -2
- package/dist/{http-CUsGQiwU.js → http-Bz4YpW-D.js} +2 -2
- package/dist/{http-BxgYWxTY.cjs → http-Dr7V4DY7.cjs} +2 -2
- package/dist/{inbox-CAojlSWc.js → inbox-CXOoDyEH.js} +1 -1
- package/dist/{key-Dz-KWCap.js → key-C_b1t1Na.js} +2 -2
- package/dist/{keycache-Czcf33al.js → keycache-zfG6F1PW.js} +1 -1
- package/dist/{keys-BN4nelft.js → keys-C01rMN22.js} +1 -1
- package/dist/{kv-BKNZ-Tb-.d.ts → kv-BpJND1Hr.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-QzKcOQgP.js} +22 -0
- package/dist/{kv-Bxr0Q87_.d.cts → kv-cD_d4hg-.d.cts} +30 -1
- package/dist/{kv-cache-Bq6kUUoG.js → kv-cache-4I_O-pli.js} +1 -1
- package/dist/{kv-cache-5j5Pb-V6.cjs → kv-cache-CpjdzlKh.cjs} +1 -1
- package/dist/{kv-cache-DN9pfMBe.js → kv-cache-D7LFlByV.js} +13 -0
- package/dist/{ld-CEJHYq8u.js → ld-Ba0jIf7k.js} +2 -2
- package/dist/{lookup-gMu_9ZKY.js → lookup-BUqdDUac.js} +6 -5
- package/dist/{lookup-_Hap2IXS.cjs → lookup-UA4SKewV.cjs} +6 -5
- package/dist/{lookup-D8hvtZHY.js → lookup-kl47RWf3.js} +195 -189
- package/dist/middleware-B64_UxVQ.js +26 -0
- package/dist/middleware-BK7fptEJ.cjs +15 -0
- package/dist/{middleware-DW3rJHWy.cjs → middleware-BYqpBCFp.cjs} +21 -9
- package/dist/{middleware-DgrceAHB.js → middleware-CwpDL0KB.js} +19 -12
- package/dist/{middleware-Df9OWALM.js → middleware-Cx0KwuzQ.js} +21 -9
- package/dist/middleware-_DVIaAFk.js +15 -0
- package/dist/{mod-aAE2wOWV.d.ts → mod-CAdoBu0x.d.ts} +1 -1
- package/dist/{mod-BoRKfJPE.d.cts → mod-Dy2fJtmN.d.cts} +1 -1
- package/dist/{mod-Cdo6SYlJ.d.ts → mod-GetHzY6F.d.ts} +1 -1
- package/dist/{mod-DMpuiKXi.d.cts → mod-fxr25Gv7.d.cts} +1 -1
- package/dist/mod.cjs +8 -8
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +8 -8
- package/dist/nodeinfo/client.test.js +3 -3
- package/dist/nodeinfo/handler.test.js +16 -16
- package/dist/nodeinfo/types.test.js +2 -2
- package/dist/otel/exporter.test.d.ts +3 -0
- package/dist/otel/exporter.test.js +900 -0
- package/dist/otel/mod.cjs +262 -0
- package/dist/otel/mod.d.cts +230 -0
- package/dist/otel/mod.d.ts +232 -0
- package/dist/otel/mod.js +261 -0
- package/dist/otel-Bfe_BgOV.js +63 -0
- package/dist/{owner-JwI-WzF-.js → owner-CgznkTZ6.js} +44 -8
- package/dist/{proof-CObJuclI.cjs → proof-AEFUz3SS.cjs} +44 -8
- package/dist/{proof-xH0V1mdD.js → proof-BrsOl9bB.js} +45 -9
- package/dist/{proof-Dhqndmfg.js → proof-rFeNfcVE.js} +2 -2
- package/dist/{send-1o7D-GGL.js → send-w_IyjZ0S.js} +9 -4
- package/dist/sig/http.test.js +7 -7
- package/dist/sig/key.test.js +5 -5
- package/dist/sig/ld.test.js +6 -6
- package/dist/sig/mod.cjs +4 -4
- package/dist/sig/mod.js +4 -4
- package/dist/sig/owner.test.js +30 -6
- package/dist/sig/proof.test.js +6 -6
- package/dist/testing/docloader.test.js +2 -2
- package/dist/testing/mod.js +2 -2
- package/dist/{testing-DpRy1YTU.js → testing-fIO3Z258.js} +1 -1
- package/dist/utils/docloader.test.js +8 -8
- package/dist/utils/kv-cache.test.js +6 -3
- package/dist/utils/mod.cjs +4 -4
- package/dist/utils/mod.d.cts +2 -2
- package/dist/utils/mod.d.ts +2 -2
- package/dist/utils/mod.js +4 -4
- package/dist/vocab/actor.test.js +4 -4
- package/dist/vocab/lookup.test.js +26 -4
- package/dist/vocab/mod.cjs +3 -3
- package/dist/vocab/mod.js +3 -3
- package/dist/vocab/type.test.js +2 -2
- package/dist/vocab/vocab.test.js +3 -3
- package/dist/{vocab-CAwj263k.js → vocab-BtqMcZvq.js} +7 -2
- package/dist/{vocab-DgHGCFcw.cjs → vocab-COVHviQ5.cjs} +7 -2
- package/dist/webfinger/handler.test.js +16 -16
- package/dist/webfinger/lookup.test.js +3 -3
- package/dist/webfinger/mod.cjs +1 -1
- package/dist/webfinger/mod.js +1 -1
- package/package.json +19 -9
- package/dist/middleware-19QFZj7b.js +0 -26
- package/dist/middleware-BbbcXY4w.cjs +0 -15
- package/dist/middleware-CSTK543z.js +0 -15
package/dist/federation/mod.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
5
|
import "../transformers-BFT6d7J5.js";
|
|
6
|
-
import "../lookup-
|
|
7
|
-
import "../actor-
|
|
8
|
-
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-
|
|
9
|
-
import "../http-
|
|
10
|
-
import "../proof-
|
|
11
|
-
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-
|
|
6
|
+
import "../lookup-BUqdDUac.js";
|
|
7
|
+
import "../actor-D3v8T9kQ.js";
|
|
8
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-Cx0KwuzQ.js";
|
|
9
|
+
import "../http-Bz4YpW-D.js";
|
|
10
|
+
import "../proof-BrsOl9bB.js";
|
|
11
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-D0hkM4T7.js";
|
|
12
12
|
import "../types-BtUjyi5y.js";
|
|
13
|
-
import "../kv-cache-
|
|
14
|
-
import "../vocab-
|
|
13
|
+
import "../kv-cache-4I_O-pli.js";
|
|
14
|
+
import "../vocab-BtqMcZvq.js";
|
|
15
15
|
|
|
16
16
|
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../lookup-
|
|
6
|
+
import "../lookup-kl47RWf3.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-
|
|
10
|
+
import { test } from "../testing-fIO3Z258.js";
|
|
11
11
|
import { assertGreater, assertGreaterOrEqual } from "../std__assert-DWivtrGR.js";
|
|
12
12
|
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
|
13
13
|
import "../assert_throws-BNXdRGWP.js";
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../lookup-
|
|
6
|
+
import "../lookup-kl47RWf3.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
10
|
import { acceptsJsonLd } from "../negotiation-C4nFufNk.js";
|
|
11
|
-
import { test } from "../testing-
|
|
11
|
+
import { test } from "../testing-fIO3Z258.js";
|
|
12
12
|
import "../std__assert-DWivtrGR.js";
|
|
13
13
|
import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
|
|
14
14
|
import "../assert_throws-BNXdRGWP.js";
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../lookup-
|
|
6
|
+
import "../lookup-kl47RWf3.js";
|
|
7
7
|
import { AssertionError, assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { createExponentialBackoffPolicy } from "../retry-CfF8Gn4d.js";
|
|
9
|
-
import { test } from "../testing-
|
|
9
|
+
import { test } from "../testing-fIO3Z258.js";
|
|
10
10
|
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
|
11
11
|
|
|
12
12
|
//#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 { Router, RouterError } from "../lookup-
|
|
6
|
+
import { Router, RouterError } from "../lookup-kl47RWf3.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-
|
|
10
|
+
import { test } from "../testing-fIO3Z258.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,22 +3,23 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Activity, Application, Endpoints, Group, Person, Service } from "../lookup-
|
|
6
|
+
import { Activity, Application, Endpoints, Group, Person, Service } from "../lookup-kl47RWf3.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 "../actor-
|
|
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-
|
|
10
|
+
import "../actor-DrvDW-tK.js";
|
|
11
|
+
import "../key-C_b1t1Na.js";
|
|
12
|
+
import { verifyRequest } from "../http-BNxhNjYm.js";
|
|
13
|
+
import { doesActorOwnKey } from "../owner-CgznkTZ6.js";
|
|
14
|
+
import { extractInboxes, sendActivity } from "../send-w_IyjZ0S.js";
|
|
15
|
+
import { mockDocumentLoader, test } from "../testing-fIO3Z258.js";
|
|
16
16
|
import "../std__assert-DWivtrGR.js";
|
|
17
17
|
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
|
18
18
|
import "../assert_throws-BNXdRGWP.js";
|
|
19
19
|
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
|
20
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-
|
|
21
|
-
import {
|
|
20
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-C01rMN22.js";
|
|
21
|
+
import { createTestTracerProvider } from "../otel-Bfe_BgOV.js";
|
|
22
|
+
import { esm_default } from "../esm-DQKBkSAc.js";
|
|
22
23
|
|
|
23
24
|
//#region src/federation/send.test.ts
|
|
24
25
|
test("extractInboxes()", () => {
|
|
@@ -212,5 +213,47 @@ test("sendActivity()", async (t) => {
|
|
|
212
213
|
});
|
|
213
214
|
esm_default.hardReset();
|
|
214
215
|
});
|
|
216
|
+
test("sendActivity() records OpenTelemetry span events", async (t) => {
|
|
217
|
+
const [tracerProvider, exporter] = createTestTracerProvider();
|
|
218
|
+
esm_default.spyGlobal();
|
|
219
|
+
await t.step("successful send", async () => {
|
|
220
|
+
esm_default.get("https://example.com/", { status: 404 });
|
|
221
|
+
esm_default.post("https://example.com/inbox", { status: 202 });
|
|
222
|
+
const activity = {
|
|
223
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
224
|
+
type: "Create",
|
|
225
|
+
id: "https://example.com/activity",
|
|
226
|
+
actor: "https://example.com/person"
|
|
227
|
+
};
|
|
228
|
+
await sendActivity({
|
|
229
|
+
activity,
|
|
230
|
+
activityId: "https://example.com/activity",
|
|
231
|
+
activityType: "https://www.w3.org/ns/activitystreams#Create",
|
|
232
|
+
keys: [{
|
|
233
|
+
keyId: new URL("https://example.com/person#key"),
|
|
234
|
+
privateKey: rsaPrivateKey2
|
|
235
|
+
}],
|
|
236
|
+
inbox: new URL("https://example.com/inbox"),
|
|
237
|
+
tracerProvider
|
|
238
|
+
});
|
|
239
|
+
const spans = exporter.getSpans("activitypub.send_activity");
|
|
240
|
+
assertEquals(spans.length, 1);
|
|
241
|
+
const span = spans[0];
|
|
242
|
+
assertEquals(span.attributes["activitypub.activity.id"], "https://example.com/activity");
|
|
243
|
+
assertEquals(span.attributes["activitypub.activity.type"], "https://www.w3.org/ns/activitystreams#Create");
|
|
244
|
+
const events = exporter.getEvents("activitypub.send_activity", "activitypub.activity.sent");
|
|
245
|
+
assertEquals(events.length, 1);
|
|
246
|
+
const event = events[0];
|
|
247
|
+
assert(event.attributes != null);
|
|
248
|
+
assertEquals(event.attributes["activitypub.inbox.url"], "https://example.com/inbox");
|
|
249
|
+
assertEquals(event.attributes["activitypub.activity.id"], "https://example.com/activity");
|
|
250
|
+
assert(typeof event.attributes["activitypub.activity.json"] === "string");
|
|
251
|
+
const recordedActivity = JSON.parse(event.attributes["activitypub.activity.json"]);
|
|
252
|
+
assertEquals(recordedActivity.id, "https://example.com/activity");
|
|
253
|
+
assertEquals(recordedActivity.type, "Create");
|
|
254
|
+
exporter.clear();
|
|
255
|
+
esm_default.hardReset();
|
|
256
|
+
});
|
|
257
|
+
});
|
|
215
258
|
|
|
216
259
|
//#endregion
|
|
@@ -68,6 +68,28 @@ var MemoryKvStore = class {
|
|
|
68
68
|
this.#values[encodedKey] = [newValue, expiration];
|
|
69
69
|
return Promise.resolve(true);
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* {@inheritDoc KvStore.list}
|
|
73
|
+
*/
|
|
74
|
+
async *list(prefix) {
|
|
75
|
+
const now = Temporal.Now.instant();
|
|
76
|
+
for (const [encodedKey, entry] of Object.entries(this.#values)) {
|
|
77
|
+
const key = JSON.parse(encodedKey);
|
|
78
|
+
if (prefix != null) {
|
|
79
|
+
if (key.length < prefix.length) continue;
|
|
80
|
+
if (!prefix.every((p, i) => key[i] === p)) continue;
|
|
81
|
+
}
|
|
82
|
+
const [value, expiration] = entry;
|
|
83
|
+
if (expiration != null && now.until(expiration).sign < 0) {
|
|
84
|
+
delete this.#values[encodedKey];
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
yield {
|
|
88
|
+
key,
|
|
89
|
+
value
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
71
93
|
};
|
|
72
94
|
|
|
73
95
|
//#endregion
|
|
@@ -67,6 +67,28 @@ var MemoryKvStore = class {
|
|
|
67
67
|
this.#values[encodedKey] = [newValue, expiration];
|
|
68
68
|
return Promise.resolve(true);
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* {@inheritDoc KvStore.list}
|
|
72
|
+
*/
|
|
73
|
+
async *list(prefix) {
|
|
74
|
+
const now = Temporal.Now.instant();
|
|
75
|
+
for (const [encodedKey, entry] of Object.entries(this.#values)) {
|
|
76
|
+
const key = JSON.parse(encodedKey);
|
|
77
|
+
if (prefix != null) {
|
|
78
|
+
if (key.length < prefix.length) continue;
|
|
79
|
+
if (!prefix.every((p, i) => key[i] === p)) continue;
|
|
80
|
+
}
|
|
81
|
+
const [value, expiration] = entry;
|
|
82
|
+
if (expiration != null && now.until(expiration).sign < 0) {
|
|
83
|
+
delete this.#values[encodedKey];
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
yield {
|
|
87
|
+
key,
|
|
88
|
+
value
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
70
92
|
};
|
|
71
93
|
|
|
72
94
|
//#endregion
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { CryptographicKey, deno_default } from "./lookup-
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
|
6
|
+
import { CryptographicKey, deno_default } from "./lookup-kl47RWf3.js";
|
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-C_b1t1Na.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { deno_default } from "./lookup-
|
|
6
|
-
import { CryptographicKey, Object as Object$1, isActor } from "./actor-
|
|
5
|
+
import { deno_default } from "./lookup-BUqdDUac.js";
|
|
6
|
+
import { CryptographicKey, Object as Object$1, isActor } from "./actor-D3v8T9kQ.js";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
|
6
|
-
const require_lookup = require('./lookup-
|
|
7
|
-
const require_actor = require('./actor-
|
|
6
|
+
const require_lookup = require('./lookup-UA4SKewV.cjs');
|
|
7
|
+
const require_actor = require('./actor-Bpgsv6Ii.cjs');
|
|
8
8
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
9
9
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
10
10
|
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Activity, deno_default, getTypeId } from "./lookup-
|
|
6
|
+
import { Activity, deno_default, getTypeId } from "./lookup-kl47RWf3.js";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
9
9
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { CryptographicKey, Object as Object$1, deno_default } from "./lookup-
|
|
7
|
-
import { isActor } from "./actor-
|
|
6
|
+
import { CryptographicKey, Object as Object$1, deno_default } from "./lookup-kl47RWf3.js";
|
|
7
|
+
import { isActor } from "./actor-DrvDW-tK.js";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { CryptographicKey, Multikey } from "./lookup-
|
|
6
|
+
import { CryptographicKey, Multikey } from "./lookup-kl47RWf3.js";
|
|
7
7
|
|
|
8
8
|
//#region src/federation/keycache.ts
|
|
9
9
|
var KvKeyCache = class {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { CryptographicKey, Multikey } from "./lookup-
|
|
6
|
+
import { CryptographicKey, Multikey } from "./lookup-kl47RWf3.js";
|
|
7
7
|
import { importSpki } from "@fedify/vocab-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/testing/keys.ts
|
|
@@ -19,6 +19,21 @@ interface KvStoreSetOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
ttl?: Temporal.Duration;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* An entry returned by the {@link KvStore.list} method.
|
|
24
|
+
*
|
|
25
|
+
* @since 1.10.0
|
|
26
|
+
*/
|
|
27
|
+
interface KvStoreListEntry {
|
|
28
|
+
/**
|
|
29
|
+
* The key of the entry.
|
|
30
|
+
*/
|
|
31
|
+
key: KvKey;
|
|
32
|
+
/**
|
|
33
|
+
* The value of the entry.
|
|
34
|
+
*/
|
|
35
|
+
value: unknown;
|
|
36
|
+
}
|
|
22
37
|
/**
|
|
23
38
|
* An abstract interface for a key–value store.
|
|
24
39
|
*
|
|
@@ -54,6 +69,16 @@ interface KvStore {
|
|
|
54
69
|
* @since 1.8.0
|
|
55
70
|
*/
|
|
56
71
|
cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Lists all entries in the store that match the given prefix.
|
|
74
|
+
* If no prefix is given, all entries are returned.
|
|
75
|
+
* @param prefix The prefix to filter keys by. If not specified, all entries
|
|
76
|
+
* are returned.
|
|
77
|
+
* @returns An async iterable of entries matching the prefix.
|
|
78
|
+
* @since 1.10.0
|
|
79
|
+
* @since 2.0.0 This method is now required instead of optional.
|
|
80
|
+
*/
|
|
81
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
57
82
|
}
|
|
58
83
|
/**
|
|
59
84
|
* A key–value store that stores values in memory.
|
|
@@ -79,6 +104,10 @@ declare class MemoryKvStore implements KvStore {
|
|
|
79
104
|
* {@inheritDoc KvStore.cas}
|
|
80
105
|
*/
|
|
81
106
|
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* {@inheritDoc KvStore.list}
|
|
109
|
+
*/
|
|
110
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
82
111
|
}
|
|
83
112
|
//#endregion
|
|
84
|
-
export { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore };
|
|
113
|
+
export { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore };
|
|
@@ -68,6 +68,28 @@ var MemoryKvStore = class {
|
|
|
68
68
|
this.#values[encodedKey] = [newValue, expiration];
|
|
69
69
|
return Promise.resolve(true);
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* {@inheritDoc KvStore.list}
|
|
73
|
+
*/
|
|
74
|
+
async *list(prefix) {
|
|
75
|
+
const now = Temporal.Now.instant();
|
|
76
|
+
for (const [encodedKey, entry] of Object.entries(this.#values)) {
|
|
77
|
+
const key = JSON.parse(encodedKey);
|
|
78
|
+
if (prefix != null) {
|
|
79
|
+
if (key.length < prefix.length) continue;
|
|
80
|
+
if (!prefix.every((p, i) => key[i] === p)) continue;
|
|
81
|
+
}
|
|
82
|
+
const [value, expiration] = entry;
|
|
83
|
+
if (expiration != null && now.until(expiration).sign < 0) {
|
|
84
|
+
delete this.#values[encodedKey];
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
yield {
|
|
88
|
+
key,
|
|
89
|
+
value
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
71
93
|
};
|
|
72
94
|
|
|
73
95
|
//#endregion
|
|
@@ -16,6 +16,21 @@ interface KvStoreSetOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
ttl?: Temporal.Duration;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* An entry returned by the {@link KvStore.list} method.
|
|
21
|
+
*
|
|
22
|
+
* @since 1.10.0
|
|
23
|
+
*/
|
|
24
|
+
interface KvStoreListEntry {
|
|
25
|
+
/**
|
|
26
|
+
* The key of the entry.
|
|
27
|
+
*/
|
|
28
|
+
key: KvKey;
|
|
29
|
+
/**
|
|
30
|
+
* The value of the entry.
|
|
31
|
+
*/
|
|
32
|
+
value: unknown;
|
|
33
|
+
}
|
|
19
34
|
/**
|
|
20
35
|
* An abstract interface for a key–value store.
|
|
21
36
|
*
|
|
@@ -51,6 +66,16 @@ interface KvStore {
|
|
|
51
66
|
* @since 1.8.0
|
|
52
67
|
*/
|
|
53
68
|
cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Lists all entries in the store that match the given prefix.
|
|
71
|
+
* If no prefix is given, all entries are returned.
|
|
72
|
+
* @param prefix The prefix to filter keys by. If not specified, all entries
|
|
73
|
+
* are returned.
|
|
74
|
+
* @returns An async iterable of entries matching the prefix.
|
|
75
|
+
* @since 1.10.0
|
|
76
|
+
* @since 2.0.0 This method is now required instead of optional.
|
|
77
|
+
*/
|
|
78
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
54
79
|
}
|
|
55
80
|
/**
|
|
56
81
|
* A key–value store that stores values in memory.
|
|
@@ -76,6 +101,10 @@ declare class MemoryKvStore implements KvStore {
|
|
|
76
101
|
* {@inheritDoc KvStore.cas}
|
|
77
102
|
*/
|
|
78
103
|
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* {@inheritDoc KvStore.list}
|
|
106
|
+
*/
|
|
107
|
+
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
79
108
|
}
|
|
80
109
|
//#endregion
|
|
81
|
-
export { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore };
|
|
110
|
+
export { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { doubleKnock, validateCryptoKey } from "./http-
|
|
5
|
+
import { doubleKnock, validateCryptoKey } from "./http-Bz4YpW-D.js";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { UrlError, createActivityPubRequest, getDocumentLoader, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
8
8
|
import { curry } from "es-toolkit";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
|
6
|
-
const require_http = require('./http-
|
|
6
|
+
const require_http = require('./http-Dr7V4DY7.cjs');
|
|
7
7
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
8
8
|
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
|
9
9
|
const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
|
|
@@ -28,6 +28,19 @@ var MockKvStore = class {
|
|
|
28
28
|
cas(..._) {
|
|
29
29
|
return Promise.resolve(false);
|
|
30
30
|
}
|
|
31
|
+
async *list(prefix) {
|
|
32
|
+
for (const [encodedKey, value] of Object.entries(this.#values)) {
|
|
33
|
+
const key = JSON.parse(encodedKey);
|
|
34
|
+
if (prefix != null) {
|
|
35
|
+
if (key.length < prefix.length) continue;
|
|
36
|
+
if (!prefix.every((p, i) => key[i] === p)) continue;
|
|
37
|
+
}
|
|
38
|
+
yield {
|
|
39
|
+
key,
|
|
40
|
+
value
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
31
44
|
};
|
|
32
45
|
/**
|
|
33
46
|
* Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Activity, CryptographicKey, Object as Object$1, deno_default, getTypeId } from "./lookup-
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
|
6
|
+
import { Activity, CryptographicKey, Object as Object$1, deno_default, getTypeId } from "./lookup-kl47RWf3.js";
|
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-C_b1t1Na.js";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -8,13 +8,14 @@ import { UrlError, getUserAgent, validatePublicUrl } from "@fedify/vocab-runtime
|
|
|
8
8
|
|
|
9
9
|
//#region deno.json
|
|
10
10
|
var name = "@fedify/fedify";
|
|
11
|
-
var version = "2.0.0-dev.
|
|
11
|
+
var version = "2.0.0-dev.85+a55c8362";
|
|
12
12
|
var license = "MIT";
|
|
13
13
|
var exports = {
|
|
14
14
|
".": "./src/mod.ts",
|
|
15
15
|
"./compat": "./src/compat/mod.ts",
|
|
16
16
|
"./federation": "./src/federation/mod.ts",
|
|
17
17
|
"./nodeinfo": "./src/nodeinfo/mod.ts",
|
|
18
|
+
"./otel": "./src/otel/mod.ts",
|
|
18
19
|
"./sig": "./src/sig/mod.ts",
|
|
19
20
|
"./testing": "./src/testing/mod.ts",
|
|
20
21
|
"./vocab": "./src/vocab/mod.ts",
|
|
@@ -23,18 +24,18 @@ var exports = {
|
|
|
23
24
|
};
|
|
24
25
|
var imports = {
|
|
25
26
|
"@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
|
|
26
|
-
"@opentelemetry/
|
|
27
|
+
"@opentelemetry/core": "npm:@opentelemetry/core@^2.0.0",
|
|
28
|
+
"@opentelemetry/sdk-trace-base": "npm:@opentelemetry/sdk-trace-base@^2.0.0",
|
|
27
29
|
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
|
|
28
30
|
"@std/assert": "jsr:@std/assert@^0.226.0",
|
|
29
31
|
"@std/url": "jsr:@std/url@^0.225.1",
|
|
30
|
-
"asn1js": "npm:asn1js@^3.0.
|
|
31
|
-
"es-toolkit": "jsr:@es-toolkit/es-toolkit@^1.39.5",
|
|
32
|
+
"asn1js": "npm:asn1js@^3.0.7",
|
|
32
33
|
"fast-check": "npm:fast-check@^3.22.0",
|
|
33
34
|
"fetch-mock": "npm:fetch-mock@^12.5.2",
|
|
34
35
|
"json-canon": "npm:json-canon@^1.0.1",
|
|
35
36
|
"jsonld": "npm:jsonld@^9.0.0",
|
|
36
37
|
"multicodec": "npm:multicodec@^3.2.1",
|
|
37
|
-
"pkijs": "npm:pkijs@^3.
|
|
38
|
+
"pkijs": "npm:pkijs@^3.3.3",
|
|
38
39
|
"structured-field-values": "npm:structured-field-values@^2.0.4",
|
|
39
40
|
"uri-template-router": "npm:uri-template-router@^1.0.0",
|
|
40
41
|
"url-template": "npm:url-template@^3.1.1"
|
|
@@ -9,13 +9,14 @@ const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runt
|
|
|
9
9
|
|
|
10
10
|
//#region deno.json
|
|
11
11
|
var name = "@fedify/fedify";
|
|
12
|
-
var version = "2.0.0-dev.
|
|
12
|
+
var version = "2.0.0-dev.85+a55c8362";
|
|
13
13
|
var license = "MIT";
|
|
14
14
|
var exports$1 = {
|
|
15
15
|
".": "./src/mod.ts",
|
|
16
16
|
"./compat": "./src/compat/mod.ts",
|
|
17
17
|
"./federation": "./src/federation/mod.ts",
|
|
18
18
|
"./nodeinfo": "./src/nodeinfo/mod.ts",
|
|
19
|
+
"./otel": "./src/otel/mod.ts",
|
|
19
20
|
"./sig": "./src/sig/mod.ts",
|
|
20
21
|
"./testing": "./src/testing/mod.ts",
|
|
21
22
|
"./vocab": "./src/vocab/mod.ts",
|
|
@@ -24,18 +25,18 @@ var exports$1 = {
|
|
|
24
25
|
};
|
|
25
26
|
var imports = {
|
|
26
27
|
"@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
|
|
27
|
-
"@opentelemetry/
|
|
28
|
+
"@opentelemetry/core": "npm:@opentelemetry/core@^2.0.0",
|
|
29
|
+
"@opentelemetry/sdk-trace-base": "npm:@opentelemetry/sdk-trace-base@^2.0.0",
|
|
28
30
|
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
|
|
29
31
|
"@std/assert": "jsr:@std/assert@^0.226.0",
|
|
30
32
|
"@std/url": "jsr:@std/url@^0.225.1",
|
|
31
|
-
"asn1js": "npm:asn1js@^3.0.
|
|
32
|
-
"es-toolkit": "jsr:@es-toolkit/es-toolkit@^1.39.5",
|
|
33
|
+
"asn1js": "npm:asn1js@^3.0.7",
|
|
33
34
|
"fast-check": "npm:fast-check@^3.22.0",
|
|
34
35
|
"fetch-mock": "npm:fetch-mock@^12.5.2",
|
|
35
36
|
"json-canon": "npm:json-canon@^1.0.1",
|
|
36
37
|
"jsonld": "npm:jsonld@^9.0.0",
|
|
37
38
|
"multicodec": "npm:multicodec@^3.2.1",
|
|
38
|
-
"pkijs": "npm:pkijs@^3.
|
|
39
|
+
"pkijs": "npm:pkijs@^3.3.3",
|
|
39
40
|
"structured-field-values": "npm:structured-field-values@^2.0.4",
|
|
40
41
|
"uri-template-router": "npm:uri-template-router@^1.0.0",
|
|
41
42
|
"url-template": "npm:url-template@^3.1.1"
|