@fedify/fedify 2.0.0-dev.12 → 2.0.0-dev.138
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 +32 -21
- package/dist/{actor-C-FuEZU4.js → actor-DDU1l9V1.js} +185 -185
- package/dist/{actor-rOm0sXHU.js → actor-cC-nQq0c.js} +4 -1
- package/dist/{actor-_9UN5RVT.cjs → actor-hJ02QOQP.cjs} +185 -185
- package/dist/{assert-MZs1qjMx.js → assert-Dp5_aoAs.js} +1 -1
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-D1m8F7x0.js} +1 -1
- package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals-B2R_8p36.js} +1 -1
- package/dist/{assert_rejects-Ce45JcFg.js → assert_rejects-BoKYY0g1.js} +2 -2
- package/dist/{assert_throws-BNXdRGWP.js → assert_throws-DjkXin1a.js} +1 -1
- package/dist/{builder-hArjoWjW.js → builder-BIqsybhC.js} +5 -3
- package/dist/chunk-HsBuZ-b2.js +41 -0
- package/dist/{client-pY7-3icS.js → client-CD87uCL_.js} +1 -1
- package/dist/compat/mod.d.cts +3 -3
- package/dist/compat/mod.d.ts +3 -3
- package/dist/compat/transformers.test.js +29 -24
- package/dist/{context-PxGADCsD.d.cts → context-DBQ7nMCw.d.cts} +1 -1
- package/dist/context-DcqqDGjU.js +109 -0
- package/dist/{context-V-XS2_6O.d.ts → context-mM0Nu5yo.d.ts} +1 -1
- package/dist/deno-WFvU-GBZ.js +131 -0
- package/dist/{testing-D-nLIHkh.js → dist-lStjlyET.js} +73 -113
- package/dist/{docloader-CE1lRhEV.js → docloader-c34HWM33.js} +3 -3
- package/dist/{esm-BEFbR5eN.js → esm-B52TuumP.js} +1 -1
- package/dist/federation/builder.test.js +15 -12
- package/dist/federation/collection.test.js +9 -10
- package/dist/federation/handler.test.js +35 -30
- package/dist/federation/idempotency.test.js +34 -29
- package/dist/federation/inbox.test.js +7 -5
- package/dist/federation/keycache.test.js +7 -7
- package/dist/federation/kv.test.js +63 -10
- package/dist/federation/middleware.test.js +38 -33
- 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 +12 -13
- package/dist/federation/negotiation.test.js +9 -10
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +19 -17
- 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-Q_l4fCEE.js → http-D3YqyH4e.js} +2 -2
- package/dist/{http-So5V_Tgv.cjs → http-DW0Oa2Sc.cjs} +2 -2
- package/dist/{http-Bmx7ea3F.js → http-nYhdVvvV.js} +3 -2
- package/dist/{inbox-B9PjFn2S.js → inbox-Bj-D27uQ.js} +3 -1
- package/dist/{key-khQpfFdw.js → key-D_MTpyuI.js} +4 -3
- package/dist/{keycache-BU3fsZFa.js → keycache-IAA7OipY.js} +1 -1
- package/dist/{keys-BaMFfIdL.js → keys-B9yvxo8e.js} +1 -1
- package/dist/{kv-BKNZ-Tb-.d.ts → kv-BpJND1Hr.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-DaWUKuhD.js} +22 -0
- package/dist/{kv-Bxr0Q87_.d.cts → kv-cD_d4hg-.d.cts} +30 -1
- package/dist/{kv-cache-DN9pfMBe.js → kv-cache-C6NrTtII.js} +14 -1
- package/dist/{kv-cache-R1oW382l.js → kv-cache-D__gMqI_.js} +1 -1
- package/dist/{kv-cache-X2ggcnHI.cjs → kv-cache-DlK7_SIS.cjs} +1 -1
- package/dist/{ld-BLMebnep.js → ld-Cz6UUM8J.js} +5 -3
- package/dist/lookup-B1Cz7ZHm.js +133 -0
- package/dist/{lookup-CLaDFNx1.cjs → lookup-BKhUoMgK.cjs} +12 -10
- package/dist/lookup-CX1C-E00.js +230 -0
- package/dist/{lookup-CtC3x1M6.js → lookup-iOzlite7.js} +12 -10
- package/dist/{middleware-C3ml59Hp.js → middleware-B1u0Giyh.js} +23 -18
- package/dist/{middleware-DFLterpx.cjs → middleware-B48zVD4g.cjs} +7 -7
- package/dist/middleware-BNtVjgXE.cjs +15 -0
- package/dist/middleware-ChPWHJ4f.js +31 -0
- package/dist/middleware-EsCHZ3I-.js +15 -0
- package/dist/{middleware-Bda2JO66.js → middleware-fkTXzOSq.js} +7 -7
- 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 +10 -11
- package/dist/nodeinfo/handler.test.js +34 -28
- package/dist/nodeinfo/types.test.js +9 -10
- package/dist/otel/exporter.test.js +899 -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/{owner-XzzTSr4S.js → owner-DPvwf79I.js} +3 -2
- package/dist/{proof-C9sfVit1.js → proof-Br_G2CdI.js} +4 -2
- package/dist/{proof-B-qOSAuQ.js → proof-Dd2e9KvN.js} +3 -3
- package/dist/{proof-BzJkFBBF.cjs → proof-af3imB6y.cjs} +3 -3
- package/dist/router-CVRQXlZi.js +118 -0
- package/dist/{send-yEkZlxzW.js → send-DUIFWg1r.js} +2 -2
- package/dist/sig/http.test.js +17 -14
- package/dist/sig/key.test.js +15 -12
- package/dist/sig/ld.test.js +13 -10
- package/dist/sig/mod.cjs +4 -4
- package/dist/sig/mod.js +4 -4
- package/dist/sig/owner.test.js +17 -14
- package/dist/sig/proof.test.js +16 -13
- package/dist/{std__assert-DWivtrGR.js → std__assert-Cm-MfI66.js} +1 -1
- package/dist/testing/mod.d.ts +2 -7
- package/dist/testing/mod.js +9 -3
- package/dist/type-BSNcIxTd.js +14 -0
- package/dist/utils/docloader.test.js +18 -15
- package/dist/utils/kv-cache.test.js +5 -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 +15 -11
- package/dist/vocab/lookup.test.js +14 -11
- package/dist/vocab/mod.cjs +3 -3
- package/dist/vocab/mod.js +3 -3
- package/dist/vocab/type.test.js +4 -3
- package/dist/vocab/vocab.test.js +166 -165
- package/dist/{lookup-C7SSHgK7.js → vocab-BWcYGmN3.js} +188 -800
- package/dist/{vocab-axlR_8k0.js → vocab-BhJUQe8S.js} +2 -2
- package/dist/{vocab-C96aggZM.cjs → vocab-Brsvh5Yv.cjs} +2 -2
- package/dist/webfinger/handler.test.js +34 -28
- package/dist/webfinger/lookup.test.js +11 -10
- package/dist/webfinger/mod.cjs +1 -1
- package/dist/webfinger/mod.js +1 -1
- package/package.json +22 -13
- 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/middleware-BYBwqvTv.cjs +0 -15
- package/dist/middleware-DC7h2qq-.js +0 -26
- package/dist/middleware-mQR2SM7T.js +0 -15
- 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/{assert_equals-DSbWqCm3.js → assert_equals-Gbplq4lg.js} +0 -0
- /package/dist/{collection-BzWsN9pB.js → collection-CrkRM5Ep.js} +0 -0
- /package/dist/{negotiation-C4nFufNk.js → negotiation-B4NJHk1f.js} +0 -0
- /package/dist/{testing/docloader.test.d.ts → otel/exporter.test.d.ts} +0 -0
- /package/dist/{retry-CfF8Gn4d.js → retry-Bz5pP75o.js} +0 -0
- /package/dist/{types-C2XVl6gj.js → types-D2jhK2VG.js} +0 -0
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
7
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
|
+
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/utils/kv-cache.ts
|
|
10
10
|
const logger = getLogger([
|
|
@@ -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}.
|
|
@@ -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-D3YqyH4e.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-DW0Oa2Sc.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"));
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { deno_default } from "./deno-WFvU-GBZ.js";
|
|
7
|
+
import { Activity, CryptographicKey, Object as Object$1 } from "./vocab-BWcYGmN3.js";
|
|
8
|
+
import { getTypeId } from "./type-BSNcIxTd.js";
|
|
9
|
+
import { fetchKey, validateCryptoKey } from "./key-D_MTpyuI.js";
|
|
9
10
|
import { getLogger } from "@logtape/logtape";
|
|
11
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
10
12
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
13
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
12
14
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import { deno_default } from "./deno-WFvU-GBZ.js";
|
|
7
|
+
import { getLogger } from "@logtape/logtape";
|
|
8
|
+
import { UrlError, getUserAgent, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
9
|
+
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
|
+
|
|
11
|
+
//#region src/webfinger/lookup.ts
|
|
12
|
+
const logger = getLogger([
|
|
13
|
+
"fedify",
|
|
14
|
+
"webfinger",
|
|
15
|
+
"lookup"
|
|
16
|
+
]);
|
|
17
|
+
const DEFAULT_MAX_REDIRECTION = 5;
|
|
18
|
+
/**
|
|
19
|
+
* Looks up a WebFinger resource.
|
|
20
|
+
* @param resource The resource URL to look up.
|
|
21
|
+
* @param options Extra options for looking up the resource.
|
|
22
|
+
* @returns The resource descriptor, or `null` if not found.
|
|
23
|
+
* @since 0.2.0
|
|
24
|
+
*/
|
|
25
|
+
async function lookupWebFinger(resource, options = {}) {
|
|
26
|
+
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
|
27
|
+
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
28
|
+
return await tracer.startActiveSpan("webfinger.lookup", {
|
|
29
|
+
kind: SpanKind.CLIENT,
|
|
30
|
+
attributes: {
|
|
31
|
+
"webfinger.resource": resource.toString(),
|
|
32
|
+
"webfinger.resource.scheme": typeof resource === "string" ? resource.replace(/:.*$/, "") : resource.protocol.replace(/:$/, "")
|
|
33
|
+
}
|
|
34
|
+
}, async (span) => {
|
|
35
|
+
try {
|
|
36
|
+
const result = await lookupWebFingerInternal(resource, options);
|
|
37
|
+
span.setStatus({ code: result === null ? SpanStatusCode.ERROR : SpanStatusCode.OK });
|
|
38
|
+
return result;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
span.setStatus({
|
|
41
|
+
code: SpanStatusCode.ERROR,
|
|
42
|
+
message: String(error)
|
|
43
|
+
});
|
|
44
|
+
throw error;
|
|
45
|
+
} finally {
|
|
46
|
+
span.end();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async function lookupWebFingerInternal(resource, options = {}) {
|
|
51
|
+
if (typeof resource === "string") resource = new URL(resource);
|
|
52
|
+
let protocol = "https:";
|
|
53
|
+
let server;
|
|
54
|
+
if (resource.protocol === "acct:") {
|
|
55
|
+
const atPos = resource.pathname.lastIndexOf("@");
|
|
56
|
+
if (atPos < 0) return null;
|
|
57
|
+
server = resource.pathname.substring(atPos + 1);
|
|
58
|
+
if (server === "") return null;
|
|
59
|
+
} else {
|
|
60
|
+
protocol = resource.protocol;
|
|
61
|
+
server = resource.host;
|
|
62
|
+
}
|
|
63
|
+
let url = new URL(`${protocol}//${server}/.well-known/webfinger`);
|
|
64
|
+
url.searchParams.set("resource", resource.href);
|
|
65
|
+
let redirected = 0;
|
|
66
|
+
while (true) {
|
|
67
|
+
logger.debug("Fetching WebFinger resource descriptor from {url}...", { url: url.href });
|
|
68
|
+
let response;
|
|
69
|
+
if (options.allowPrivateAddress !== true) try {
|
|
70
|
+
await validatePublicUrl(url.href);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
if (e instanceof UrlError) {
|
|
73
|
+
logger.error("Invalid URL for WebFinger resource descriptor: {error}", { error: e });
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
throw e;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
response = await fetch(url, {
|
|
80
|
+
headers: {
|
|
81
|
+
Accept: "application/jrd+json",
|
|
82
|
+
"User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
|
|
83
|
+
},
|
|
84
|
+
redirect: "manual",
|
|
85
|
+
signal: options.signal
|
|
86
|
+
});
|
|
87
|
+
} catch (error) {
|
|
88
|
+
logger.debug("Failed to fetch WebFinger resource descriptor: {error}", {
|
|
89
|
+
url: url.href,
|
|
90
|
+
error
|
|
91
|
+
});
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
95
|
+
redirected++;
|
|
96
|
+
const maxRedirection = options.maxRedirection ?? DEFAULT_MAX_REDIRECTION;
|
|
97
|
+
if (redirected >= maxRedirection) {
|
|
98
|
+
logger.error("Too many redirections ({redirections}) while fetching WebFinger resource descriptor.", { redirections: redirected });
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const redirectedUrl = new URL(response.headers.get("Location"), response.url == null || response.url === "" ? url : response.url);
|
|
102
|
+
if (redirectedUrl.protocol !== url.protocol) {
|
|
103
|
+
logger.error("Redirected to a different protocol ({protocol} to {redirectedProtocol}) while fetching WebFinger resource descriptor.", {
|
|
104
|
+
protocol: url.protocol,
|
|
105
|
+
redirectedProtocol: redirectedUrl.protocol
|
|
106
|
+
});
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
url = redirectedUrl;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
logger.debug("Failed to fetch WebFinger resource descriptor: {status} {statusText}.", {
|
|
114
|
+
url: url.href,
|
|
115
|
+
status: response.status,
|
|
116
|
+
statusText: response.statusText
|
|
117
|
+
});
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
return await response.json();
|
|
122
|
+
} catch (e) {
|
|
123
|
+
if (e instanceof SyntaxError) {
|
|
124
|
+
logger.debug("Failed to parse WebFinger resource descriptor as JSON: {error}", { error: e });
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
throw e;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
export { lookupWebFinger };
|
|
@@ -9,34 +9,33 @@ 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.138+b557f137";
|
|
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
|
-
"./testing": "./src/testing/mod.ts",
|
|
21
21
|
"./vocab": "./src/vocab/mod.ts",
|
|
22
22
|
"./utils": "./src/utils/mod.ts",
|
|
23
23
|
"./webfinger": "./src/webfinger/mod.ts"
|
|
24
24
|
};
|
|
25
25
|
var imports = {
|
|
26
26
|
"@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
|
|
27
|
-
"@opentelemetry/core": "npm:@opentelemetry/core@^
|
|
28
|
-
"@opentelemetry/sdk-trace-base": "npm:@opentelemetry/sdk-trace-base@^
|
|
27
|
+
"@opentelemetry/core": "npm:@opentelemetry/core@^2.0.0",
|
|
28
|
+
"@opentelemetry/sdk-trace-base": "npm:@opentelemetry/sdk-trace-base@^2.0.0",
|
|
29
29
|
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
|
|
30
30
|
"@std/assert": "jsr:@std/assert@^0.226.0",
|
|
31
31
|
"@std/url": "jsr:@std/url@^0.225.1",
|
|
32
|
-
"asn1js": "npm:asn1js@^3.0.
|
|
33
|
-
"es-toolkit": "jsr:@es-toolkit/es-toolkit@^1.39.5",
|
|
32
|
+
"asn1js": "npm:asn1js@^3.0.7",
|
|
34
33
|
"fast-check": "npm:fast-check@^3.22.0",
|
|
35
34
|
"fetch-mock": "npm:fetch-mock@^12.5.2",
|
|
36
35
|
"json-canon": "npm:json-canon@^1.0.1",
|
|
37
36
|
"jsonld": "npm:jsonld@^9.0.0",
|
|
38
37
|
"multicodec": "npm:multicodec@^3.2.1",
|
|
39
|
-
"pkijs": "npm:pkijs@^3.
|
|
38
|
+
"pkijs": "npm:pkijs@^3.3.3",
|
|
40
39
|
"structured-field-values": "npm:structured-field-values@^2.0.4",
|
|
41
40
|
"uri-template-router": "npm:uri-template-router@^1.0.0",
|
|
42
41
|
"url-template": "npm:url-template@^3.1.1"
|
|
@@ -59,6 +58,7 @@ var exclude = [
|
|
|
59
58
|
"src/vocab/*.yaml",
|
|
60
59
|
"!src/vocab/vocab.ts"
|
|
61
60
|
];
|
|
61
|
+
var publish = { "exclude": ["**/*.test.ts", "src/testing/"] };
|
|
62
62
|
var tasks = {
|
|
63
63
|
"codegen": "deno run --allow-read --allow-write --allow-env --check scripts/codegen.ts && deno fmt src/vocab/vocab.ts && deno cache src/vocab/vocab.ts && deno check src/vocab/vocab.ts",
|
|
64
64
|
"cache": {
|
|
@@ -92,7 +92,8 @@ var tasks = {
|
|
|
92
92
|
"dependencies": [
|
|
93
93
|
"codegen",
|
|
94
94
|
"pnpm:install",
|
|
95
|
-
"pnpm:build-vocab"
|
|
95
|
+
"pnpm:build-vocab",
|
|
96
|
+
"pnpm:build-fixture"
|
|
96
97
|
]
|
|
97
98
|
},
|
|
98
99
|
"pnpm:build-vocab-runtime": { "command": "cd ../vocab-runtime && pnpm build" },
|
|
@@ -104,11 +105,11 @@ var tasks = {
|
|
|
104
105
|
},
|
|
105
106
|
"test:bun": {
|
|
106
107
|
"command": "cd dist/ && bun test --timeout 60000",
|
|
107
|
-
"dependencies": ["pnpm:build
|
|
108
|
+
"dependencies": ["pnpm:build"]
|
|
108
109
|
},
|
|
109
110
|
"test:cfworkers": {
|
|
110
111
|
"command": "pnpm exec wrangler deploy --dry-run --outdir src/cfworkers && node --import=tsx src/cfworkers/client.ts",
|
|
111
|
-
"dependencies": ["pnpm:build
|
|
112
|
+
"dependencies": ["pnpm:build"]
|
|
112
113
|
},
|
|
113
114
|
"test-all": { "dependencies": [
|
|
114
115
|
"check",
|
|
@@ -126,6 +127,7 @@ var deno_default = {
|
|
|
126
127
|
imports,
|
|
127
128
|
include,
|
|
128
129
|
exclude,
|
|
130
|
+
publish,
|
|
129
131
|
tasks
|
|
130
132
|
};
|
|
131
133
|
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import { deno_default } from "./deno-WFvU-GBZ.js";
|
|
7
|
+
import { Object as Object$1 } from "./vocab-BWcYGmN3.js";
|
|
8
|
+
import { lookupWebFinger } from "./lookup-B1Cz7ZHm.js";
|
|
9
|
+
import { getTypeId } from "./type-BSNcIxTd.js";
|
|
10
|
+
import { getLogger } from "@logtape/logtape";
|
|
11
|
+
import { delay } from "es-toolkit";
|
|
12
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
13
|
+
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
14
|
+
|
|
15
|
+
//#region src/vocab/handle.ts
|
|
16
|
+
/**
|
|
17
|
+
* Regular expression to match a fediverse handle in the format `@user@server`
|
|
18
|
+
* or `user@server`. The `user` part can contain alphanumeric characters and
|
|
19
|
+
* some special characters except `@`. The `server` part is all characters
|
|
20
|
+
* after the `@` symbol in the middle.
|
|
21
|
+
*/
|
|
22
|
+
const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]+)$/;
|
|
23
|
+
/**
|
|
24
|
+
* Parses a fediverse handle in the format `@user@server` or `user@server`.
|
|
25
|
+
* The `user` part can contain alphanumeric characters and some special
|
|
26
|
+
* characters except `@`. The `server` part is all characters after the `@`
|
|
27
|
+
* symbol in the middle.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const handle = parseFediverseHandle("@username@example.com");
|
|
32
|
+
* console.log(handle?.username); // "username"
|
|
33
|
+
* console.log(handle?.host); // "example.com"
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param handle - The fediverse handle string to parse.
|
|
37
|
+
* @returns A {@link FediverseHandle} object with `username` and `host`
|
|
38
|
+
* if the input is valid; otherwise `null`.
|
|
39
|
+
* @since 1.8.0
|
|
40
|
+
*/
|
|
41
|
+
function parseFediverseHandle(handle) {
|
|
42
|
+
const match = handleRegexp.exec(handle);
|
|
43
|
+
if (match) return {
|
|
44
|
+
username: match[1],
|
|
45
|
+
host: match[2]
|
|
46
|
+
};
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Converts a fediverse handle in the format `@user@server` or `user@server`
|
|
51
|
+
* to an `acct:` URI, which is a URL-like identifier for ActivityPub actors.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const identifier = toAcctUrl("@username@example.com");
|
|
56
|
+
* console.log(identifier?.href); // "acct:username@example.com"
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param handle - The fediverse handle string to convert.
|
|
60
|
+
* @returns A `URL` object representing the `acct:` URI if conversion succeeds;
|
|
61
|
+
* otherwise `null`.
|
|
62
|
+
* @since 1.8.0
|
|
63
|
+
*/
|
|
64
|
+
function toAcctUrl(handle) {
|
|
65
|
+
const parsed = parseFediverseHandle(handle);
|
|
66
|
+
if (!parsed) return null;
|
|
67
|
+
const identifier = new URL(`acct:${parsed.username}@${parsed.host}`);
|
|
68
|
+
return identifier;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/vocab/lookup.ts
|
|
73
|
+
const logger = getLogger([
|
|
74
|
+
"fedify",
|
|
75
|
+
"vocab",
|
|
76
|
+
"lookup"
|
|
77
|
+
]);
|
|
78
|
+
/**
|
|
79
|
+
* Looks up an ActivityStreams object by its URI (including `acct:` URIs)
|
|
80
|
+
* or a fediverse handle (e.g., `@user@server` or `user@server`).
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ``` typescript
|
|
84
|
+
* // Look up an actor by its fediverse handle:
|
|
85
|
+
* await lookupObject("@hongminhee@fosstodon.org");
|
|
86
|
+
* // returning a `Person` object.
|
|
87
|
+
*
|
|
88
|
+
* // A fediverse handle can omit the leading '@':
|
|
89
|
+
* await lookupObject("hongminhee@fosstodon.org");
|
|
90
|
+
* // returning a `Person` object.
|
|
91
|
+
*
|
|
92
|
+
* // A `acct:` URI can be used as well:
|
|
93
|
+
* await lookupObject("acct:hongminhee@fosstodon.org");
|
|
94
|
+
* // returning a `Person` object.
|
|
95
|
+
*
|
|
96
|
+
* // Look up an object by its URI:
|
|
97
|
+
* await lookupObject("https://todon.eu/@hongminhee/112060633798771581");
|
|
98
|
+
* // returning a `Note` object.
|
|
99
|
+
*
|
|
100
|
+
* // It can be a `URL` object as well:
|
|
101
|
+
* await lookupObject(new URL("https://todon.eu/@hongminhee/112060633798771581"));
|
|
102
|
+
* // returning a `Note` object.
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param identifier The URI or fediverse handle to look up.
|
|
106
|
+
* @param options Lookup options.
|
|
107
|
+
* @returns The object, or `null` if not found.
|
|
108
|
+
* @since 0.2.0
|
|
109
|
+
*/
|
|
110
|
+
async function lookupObject(identifier, options = {}) {
|
|
111
|
+
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
|
112
|
+
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
113
|
+
return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
114
|
+
try {
|
|
115
|
+
const result = await lookupObjectInternal(identifier, options);
|
|
116
|
+
if (result == null) span.setStatus({ code: SpanStatusCode.ERROR });
|
|
117
|
+
else {
|
|
118
|
+
if (result.id != null) span.setAttribute("activitypub.object.id", result.id.href);
|
|
119
|
+
span.setAttribute("activitypub.object.type", getTypeId(result).href);
|
|
120
|
+
if (result.replyTargetIds.length > 0) span.setAttribute("activitypub.object.in_reply_to", result.replyTargetIds.map((id) => id.href));
|
|
121
|
+
span.addEvent("activitypub.object.fetched", {
|
|
122
|
+
"activitypub.object.type": getTypeId(result).href,
|
|
123
|
+
"activitypub.object.json": JSON.stringify(await result.toJsonLd(options))
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
} catch (error) {
|
|
128
|
+
span.recordException(error);
|
|
129
|
+
span.setStatus({
|
|
130
|
+
code: SpanStatusCode.ERROR,
|
|
131
|
+
message: String(error)
|
|
132
|
+
});
|
|
133
|
+
throw error;
|
|
134
|
+
} finally {
|
|
135
|
+
span.end();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async function lookupObjectInternal(identifier, options = {}) {
|
|
140
|
+
const documentLoader = options.documentLoader ?? getDocumentLoader({ userAgent: options.userAgent });
|
|
141
|
+
if (typeof identifier === "string") identifier = toAcctUrl(identifier) ?? new URL(identifier);
|
|
142
|
+
let remoteDoc = null;
|
|
143
|
+
if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
|
|
144
|
+
remoteDoc = await documentLoader(identifier.href, { signal: options.signal });
|
|
145
|
+
} catch (error) {
|
|
146
|
+
logger.debug("Failed to fetch remote document:\n{error}", { error });
|
|
147
|
+
}
|
|
148
|
+
if (remoteDoc == null) {
|
|
149
|
+
const jrd = await lookupWebFinger(identifier, {
|
|
150
|
+
userAgent: options.userAgent,
|
|
151
|
+
tracerProvider: options.tracerProvider,
|
|
152
|
+
allowPrivateAddress: "allowPrivateAddress" in options && options.allowPrivateAddress === true,
|
|
153
|
+
signal: options.signal
|
|
154
|
+
});
|
|
155
|
+
if (jrd?.links == null) return null;
|
|
156
|
+
for (const l of jrd.links) {
|
|
157
|
+
if (l.type !== "application/activity+json" && !l.type?.match(/application\/ld\+json;\s*profile="https:\/\/www.w3.org\/ns\/activitystreams"/) || l.rel !== "self" || l.href == null) continue;
|
|
158
|
+
try {
|
|
159
|
+
remoteDoc = await documentLoader(l.href, { signal: options.signal });
|
|
160
|
+
break;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
logger.debug("Failed to fetch remote document:\n{error}", { error });
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (remoteDoc == null) return null;
|
|
168
|
+
let object;
|
|
169
|
+
try {
|
|
170
|
+
object = await Object$1.fromJsonLd(remoteDoc.document, {
|
|
171
|
+
documentLoader,
|
|
172
|
+
contextLoader: options.contextLoader,
|
|
173
|
+
tracerProvider: options.tracerProvider,
|
|
174
|
+
baseUrl: new URL(remoteDoc.documentUrl)
|
|
175
|
+
});
|
|
176
|
+
} catch (error) {
|
|
177
|
+
if (error instanceof TypeError) {
|
|
178
|
+
logger.debug("Failed to parse JSON-LD document: {error}\n{document}", {
|
|
179
|
+
...remoteDoc,
|
|
180
|
+
error
|
|
181
|
+
});
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
186
|
+
if (options.crossOrigin !== "trust" && object.id != null && object.id.origin !== new URL(remoteDoc.documentUrl).origin) {
|
|
187
|
+
if (options.crossOrigin === "throw") throw new Error(`The object's @id (${object.id.href}) has a different origin than the document URL (${remoteDoc.documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to "trust".`);
|
|
188
|
+
logger.warn("The object's @id ({objectId}) has a different origin than the document URL ({documentUrl}); refusing to return the object. If you want to bypass this check and are aware of the security implications, set the crossOrigin option to \"trust\".", {
|
|
189
|
+
...remoteDoc,
|
|
190
|
+
objectId: object.id.href
|
|
191
|
+
});
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
return object;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Traverses a collection, yielding each item in the collection.
|
|
198
|
+
* If the collection is paginated, it will fetch the next page
|
|
199
|
+
* automatically.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ``` typescript
|
|
203
|
+
* const collection = await lookupObject(collectionUrl);
|
|
204
|
+
* if (collection instanceof Collection) {
|
|
205
|
+
* for await (const item of traverseCollection(collection)) {
|
|
206
|
+
* console.log(item.id?.href);
|
|
207
|
+
* }
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @param collection The collection to traverse.
|
|
212
|
+
* @param options Options for traversing the collection.
|
|
213
|
+
* @returns An async iterable of each item in the collection.
|
|
214
|
+
* @since 1.1.0
|
|
215
|
+
*/
|
|
216
|
+
async function* traverseCollection(collection, options = {}) {
|
|
217
|
+
if (collection.firstId == null) for await (const item of collection.getItems(options)) yield item;
|
|
218
|
+
else {
|
|
219
|
+
const interval = Temporal.Duration.from(options.interval ?? { seconds: 0 }).total("millisecond");
|
|
220
|
+
let page = await collection.getFirst(options);
|
|
221
|
+
while (page != null) {
|
|
222
|
+
for await (const item of page.getItems(options)) yield item;
|
|
223
|
+
if (interval > 0) await delay(interval);
|
|
224
|
+
page = await page.getNext(options);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
//#endregion
|
|
230
|
+
export { lookupObject, traverseCollection };
|
|
@@ -8,34 +8,33 @@ 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.138+b557f137";
|
|
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
|
-
"./testing": "./src/testing/mod.ts",
|
|
20
20
|
"./vocab": "./src/vocab/mod.ts",
|
|
21
21
|
"./utils": "./src/utils/mod.ts",
|
|
22
22
|
"./webfinger": "./src/webfinger/mod.ts"
|
|
23
23
|
};
|
|
24
24
|
var imports = {
|
|
25
25
|
"@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
|
|
26
|
-
"@opentelemetry/core": "npm:@opentelemetry/core@^
|
|
27
|
-
"@opentelemetry/sdk-trace-base": "npm:@opentelemetry/sdk-trace-base@^
|
|
26
|
+
"@opentelemetry/core": "npm:@opentelemetry/core@^2.0.0",
|
|
27
|
+
"@opentelemetry/sdk-trace-base": "npm:@opentelemetry/sdk-trace-base@^2.0.0",
|
|
28
28
|
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
|
|
29
29
|
"@std/assert": "jsr:@std/assert@^0.226.0",
|
|
30
30
|
"@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",
|
|
31
|
+
"asn1js": "npm:asn1js@^3.0.7",
|
|
33
32
|
"fast-check": "npm:fast-check@^3.22.0",
|
|
34
33
|
"fetch-mock": "npm:fetch-mock@^12.5.2",
|
|
35
34
|
"json-canon": "npm:json-canon@^1.0.1",
|
|
36
35
|
"jsonld": "npm:jsonld@^9.0.0",
|
|
37
36
|
"multicodec": "npm:multicodec@^3.2.1",
|
|
38
|
-
"pkijs": "npm:pkijs@^3.
|
|
37
|
+
"pkijs": "npm:pkijs@^3.3.3",
|
|
39
38
|
"structured-field-values": "npm:structured-field-values@^2.0.4",
|
|
40
39
|
"uri-template-router": "npm:uri-template-router@^1.0.0",
|
|
41
40
|
"url-template": "npm:url-template@^3.1.1"
|
|
@@ -58,6 +57,7 @@ var exclude = [
|
|
|
58
57
|
"src/vocab/*.yaml",
|
|
59
58
|
"!src/vocab/vocab.ts"
|
|
60
59
|
];
|
|
60
|
+
var publish = { "exclude": ["**/*.test.ts", "src/testing/"] };
|
|
61
61
|
var tasks = {
|
|
62
62
|
"codegen": "deno run --allow-read --allow-write --allow-env --check scripts/codegen.ts && deno fmt src/vocab/vocab.ts && deno cache src/vocab/vocab.ts && deno check src/vocab/vocab.ts",
|
|
63
63
|
"cache": {
|
|
@@ -91,7 +91,8 @@ var tasks = {
|
|
|
91
91
|
"dependencies": [
|
|
92
92
|
"codegen",
|
|
93
93
|
"pnpm:install",
|
|
94
|
-
"pnpm:build-vocab"
|
|
94
|
+
"pnpm:build-vocab",
|
|
95
|
+
"pnpm:build-fixture"
|
|
95
96
|
]
|
|
96
97
|
},
|
|
97
98
|
"pnpm:build-vocab-runtime": { "command": "cd ../vocab-runtime && pnpm build" },
|
|
@@ -103,11 +104,11 @@ var tasks = {
|
|
|
103
104
|
},
|
|
104
105
|
"test:bun": {
|
|
105
106
|
"command": "cd dist/ && bun test --timeout 60000",
|
|
106
|
-
"dependencies": ["pnpm:build
|
|
107
|
+
"dependencies": ["pnpm:build"]
|
|
107
108
|
},
|
|
108
109
|
"test:cfworkers": {
|
|
109
110
|
"command": "pnpm exec wrangler deploy --dry-run --outdir src/cfworkers && node --import=tsx src/cfworkers/client.ts",
|
|
110
|
-
"dependencies": ["pnpm:build
|
|
111
|
+
"dependencies": ["pnpm:build"]
|
|
111
112
|
},
|
|
112
113
|
"test-all": { "dependencies": [
|
|
113
114
|
"check",
|
|
@@ -125,6 +126,7 @@ var deno_default = {
|
|
|
125
126
|
imports,
|
|
126
127
|
include,
|
|
127
128
|
exclude,
|
|
129
|
+
publish,
|
|
128
130
|
tasks
|
|
129
131
|
};
|
|
130
132
|
|
|
@@ -3,25 +3,30 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { getNodeInfo } from "./client-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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 {
|
|
6
|
+
import { deno_default } from "./deno-WFvU-GBZ.js";
|
|
7
|
+
import { getNodeInfo } from "./client-CD87uCL_.js";
|
|
8
|
+
import { RouterError } from "./router-CVRQXlZi.js";
|
|
9
|
+
import { nodeInfoToJson } from "./types-D2jhK2VG.js";
|
|
10
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage } from "./vocab-BWcYGmN3.js";
|
|
11
|
+
import { lookupWebFinger } from "./lookup-B1Cz7ZHm.js";
|
|
12
|
+
import { getTypeId } from "./type-BSNcIxTd.js";
|
|
13
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-D_MTpyuI.js";
|
|
14
|
+
import { verifyRequest } from "./http-nYhdVvvV.js";
|
|
15
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-Cz6UUM8J.js";
|
|
16
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-DPvwf79I.js";
|
|
17
|
+
import { signObject, verifyObject } from "./proof-Br_G2CdI.js";
|
|
18
|
+
import { getAuthenticatedDocumentLoader } from "./docloader-c34HWM33.js";
|
|
19
|
+
import { kvCache } from "./kv-cache-C6NrTtII.js";
|
|
20
|
+
import { lookupObject, traverseCollection } from "./lookup-CX1C-E00.js";
|
|
21
|
+
import { routeActivity } from "./inbox-Bj-D27uQ.js";
|
|
22
|
+
import { FederationBuilderImpl } from "./builder-BIqsybhC.js";
|
|
23
|
+
import { buildCollectionSynchronizationHeader } from "./collection-CrkRM5Ep.js";
|
|
24
|
+
import { KvKeyCache } from "./keycache-IAA7OipY.js";
|
|
25
|
+
import { acceptsJsonLd } from "./negotiation-B4NJHk1f.js";
|
|
26
|
+
import { createExponentialBackoffPolicy } from "./retry-Bz5pP75o.js";
|
|
27
|
+
import { extractInboxes, sendActivity } from "./send-DUIFWg1r.js";
|
|
24
28
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
29
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
25
30
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
26
31
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
27
32
|
import { domainToASCII } from "node:url";
|