@fedify/fedify 2.0.0-pr.412.1559 → 2.0.0-pr.412.1794
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-Cc6B76eG.js → actor-BXHc5r-q.js} +1 -1
- package/dist/actor-Ba9Z1eNJ.cjs +42079 -0
- package/dist/{actor-C22bXuuC.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-CTAuCsWy.js → actor-DzhunPC_.js} +7058 -2722
- package/dist/actor-f2NtjyCg.d.cts +128 -0
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
- package/dist/{builder-BOEBObR8.js → builder-u7usRsT3.js} +13 -8
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/client-94iWEfQa.d.cts +222 -0
- package/dist/{client-DF8anIB5.d.ts → client-BsGzbnV-.d.ts} +3 -75
- package/dist/{client-De-z2UnN.js → client-pY7-3icS.js} +3 -22
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +12 -0
- package/dist/compat/mod.d.ts +11 -12
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +20 -20
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/{context-9gCpIkiz.d.ts → context-DG0huGW-.d.ts} +184 -127
- package/dist/context-DJ8aSy2Q.d.cts +2312 -0
- package/dist/{authdocloader-CLgDGafZ.js → docloader-CrbAy9Oc.js} +17 -8
- package/dist/{esm-CHdxdkuH.js → esm-C-Qa1zEM.js} +11 -11
- package/dist/federation/builder.test.js +9 -12
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +27 -148
- package/dist/federation/idempotency.test.js +201 -0
- package/dist/federation/inbox.test.js +4 -6
- package/dist/federation/keycache.test.js +3 -4
- package/dist/federation/kv.test.js +7 -8
- package/dist/federation/middleware.test.js +242 -64
- package/dist/federation/mod.cjs +27 -0
- package/dist/federation/mod.d.cts +12 -0
- package/dist/federation/mod.d.ts +12 -13
- package/dist/federation/mod.js +13 -15
- package/dist/federation/mq.test.js +8 -10
- package/dist/federation/negotiation.test.js +26 -0
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +13 -15
- package/dist/federation-CRpdnOMS.cjs +244 -0
- package/dist/{federation-CMX7WzeL.js → federation-jcR8-ZxP.js} +3 -3
- package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
- package/dist/{http-DqSNLFNY.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/{http-l0TEupZK.js → http-CUVx-vzb.js} +260 -10
- package/dist/{http-CcdM1brU.js → http-D2kIm9la.js} +3 -3
- package/dist/http-Dofes42e.cjs +1106 -0
- package/dist/http-M8k5mKc0.d.cts +253 -0
- package/dist/{inbox-B6DZbGNf.js → inbox-HjG5peXY.js} +24 -7
- package/dist/{key-CzLv1phF.js → key-CxdLUFS6.js} +3 -2
- package/dist/{keycache-B8HdZJSt.js → keycache-bU7COwsh.js} +1 -1
- package/dist/{keys-zZwiKkfx.js → keys-DMHs8XNn.js} +2 -1
- package/dist/kv-Bxr0Q87_.d.cts +81 -0
- package/dist/kv-cache-CGXcDejL.js +122 -0
- package/dist/kv-cache-DN9pfMBe.js +94 -0
- package/dist/kv-cache-Dkvbn6rg.cjs +134 -0
- package/dist/{ld-CBcQdZ6N.js → ld-CIhvSCCr.js} +5 -4
- package/dist/lookup-CHkCVZTU.js +260 -0
- package/dist/lookup-CfFkONZD.cjs +272 -0
- package/dist/{type-SK-d7Tbw.js → lookup-DQRtjvb1.js} +7266 -7087
- package/dist/middleware-Bot7EEwV.js +26 -0
- package/dist/middleware-CFJgmUMW.cjs +15 -0
- package/dist/{middleware-BRgu1IH8.js → middleware-CJlj5Olw.js} +86 -181
- package/dist/middleware-CjHl2NHA.js +15 -0
- package/dist/middleware-D74TgW2E.cjs +4225 -0
- package/dist/{middleware-CxEkcFW0.js → middleware-DMk2Mdn9.js} +117 -127
- package/dist/mod-0noXw66R.d.cts +107 -0
- package/dist/mod-B-hUPT2N.d.cts +1 -0
- package/dist/{mod-Drmz72EK.d.ts → mod-B2iOw50L.d.ts} +3 -3
- package/dist/mod-B9M-8jm2.d.ts +109 -0
- package/dist/{mod-Cxt4Kpf6.d.ts → mod-BlVovdcy.d.ts} +20 -2
- package/dist/{mod-Bqxcp7eN.d.ts → mod-BoHnwOCs.d.ts} +2 -2
- package/dist/mod-BxRCHTz-.d.cts +307 -0
- package/dist/mod-C2tOeRkN.d.cts +1 -0
- package/dist/mod-C58MZ7Wx.d.cts +113 -0
- package/dist/mod-DJcZDvjA.d.cts +80 -0
- package/dist/mod-DgdBYYa0.d.cts +266 -0
- package/dist/{mod-DBzN0aCM.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
- package/dist/mod.cjs +137 -0
- package/dist/mod.d.cts +16 -0
- package/dist/mod.d.ts +16 -17
- package/dist/mod.js +19 -21
- package/dist/mq-DcJPkXD5.d.cts +140 -0
- package/dist/negotiation-C4nFufNk.js +71 -0
- package/dist/nodeinfo/client.test.js +30 -111
- package/dist/nodeinfo/handler.test.js +25 -26
- package/dist/nodeinfo/mod.cjs +10 -0
- package/dist/nodeinfo/mod.d.cts +3 -0
- package/dist/nodeinfo/mod.d.ts +3 -5
- package/dist/nodeinfo/mod.js +6 -7
- package/dist/nodeinfo/types.test.js +8 -15
- package/dist/nodeinfo-BnthBobC.js +4 -0
- package/dist/nodeinfo-CdN0rEnZ.cjs +4 -0
- package/dist/owner-B4HbyP8s.d.cts +67 -0
- package/dist/{owner-VEIjmR8r.js → owner-Dvh7mBvr.js} +3 -2
- package/dist/{owner-CQPnQVtf.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/proof-D0uThUvD.cjs +674 -0
- package/dist/{proof-DoSQAGkE.js → proof-Dgy35fzc.js} +3 -3
- package/dist/{proof-tgUlT8hw.js → proof-fqzaMJ4g.js} +11 -10
- package/dist/{send-BzS7w-QF.js → send-Drp20VO9.js} +2 -2
- package/dist/sig/http.test.js +13 -14
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +28 -0
- package/dist/sig/mod.d.cts +6 -0
- package/dist/sig/mod.d.ts +5 -7
- package/dist/sig/mod.js +8 -10
- package/dist/sig/owner.test.js +10 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/sig-C34-oHBl.js +4 -0
- package/dist/sig-YYj5tCnr.cjs +4 -0
- package/dist/testing/docloader.test.js +6 -8
- package/dist/testing/mod.d.ts +387 -224
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-Z2omCvKy.js → testing-g4UC4liW.js} +1 -2
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/{types-DgPvoUWN.js → types-BtUjyi5y.js} +8 -169
- package/dist/{types-BIgY6c-l.js → types-C2XVl6gj.js} +1 -3
- package/dist/types-CWgzGaqk.cjs +315 -0
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +14 -15
- package/dist/utils/kv-cache.test.js +209 -0
- package/dist/utils/mod.cjs +12 -0
- package/dist/utils/mod.d.cts +5 -0
- package/dist/utils/mod.d.ts +7 -0
- package/dist/utils/mod.js +11 -0
- package/dist/utils-D-Va7aXC.js +4 -0
- package/dist/utils-DyRU1gdZ.cjs +4 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +257 -9
- package/dist/vocab/mod.cjs +86 -0
- package/dist/vocab/mod.d.cts +4 -0
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +6 -7
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +438 -15
- package/dist/{vocab-SOE1ifCr.d.ts → vocab-BCWe1Ih5.d.ts} +292 -21
- package/dist/{vocab-CvD6Vbml.js → vocab-BnR3nIU9.js} +26 -17
- package/dist/vocab-CeDBzu-f.d.cts +14903 -0
- package/dist/{lookup-Bn_HEC_d.js → vocab-DFaWWYDn.cjs} +108 -139
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +8 -0
- package/dist/webfinger/mod.d.cts +2 -0
- package/dist/webfinger/mod.d.ts +1 -3
- package/dist/webfinger/mod.js +5 -6
- package/dist/webfinger-C72Y8lrh.js +4 -0
- package/dist/webfinger-vAtLmxOF.cjs +4 -0
- package/dist/x/cfworkers.cjs +100 -0
- package/dist/x/cfworkers.d.cts +59 -0
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.js +3 -3
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +53 -0
- package/dist/x/hono.d.ts +10 -11
- package/dist/x/hono.js +3 -3
- package/dist/x/sveltekit.cjs +69 -0
- package/dist/x/sveltekit.d.cts +45 -0
- package/dist/x/sveltekit.d.ts +10 -11
- package/dist/x/sveltekit.js +3 -3
- package/package.json +79 -23
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-BFVqUbyo.js +0 -52
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-DEhniCVa.js +0 -4615
- package/dist/key-CUZQgVlf.js +0 -10
- package/dist/key-Deb0_wWL.js +0 -10
- package/dist/key-DxA6xRtZ.js +0 -260
- package/dist/lookup-dtdr2ftf.js +0 -131
- package/dist/middleware-BE_geSiJ.js +0 -17
- package/dist/middleware-BnU6hzVp.js +0 -26
- package/dist/mod-TFoH2Ql8.d.ts +0 -104
- package/dist/nodeinfo/semver.test.js +0 -143
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.d.ts +0 -3
- package/dist/runtime/url.test.js +0 -45
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/semver-dArNLkR9.js +0 -149
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{collection-CSzG2j1P.js → collection-BzWsN9pB.js} +0 -0
- /package/dist/{denokv-Bv33Xxea.js → denokv-CCssOzMJ.js} +0 -0
- /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → federation/negotiation.test.d.ts} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-BKNZ-Tb-.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-xIj-IT58.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CUKlBw08.d.ts} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-M8k5mKc0.cjs";
|
2
|
+
import { KvKey, KvStore } from "./kv-Bxr0Q87_.cjs";
|
3
|
+
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
4
|
+
import { TracerProvider } from "@opentelemetry/api";
|
5
|
+
|
6
|
+
//#region src/utils/docloader.d.ts
|
7
|
+
/**
|
8
|
+
* Options for {@link getAuthenticatedDocumentLoader}.
|
9
|
+
* @see {@link getAuthenticatedDocumentLoader}
|
10
|
+
* @since 1.3.0
|
11
|
+
*/
|
12
|
+
interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
13
|
+
/**
|
14
|
+
* An optional spec determiner for HTTP Message Signatures.
|
15
|
+
* It determines the spec to use for signing requests.
|
16
|
+
* It is used for double-knocking
|
17
|
+
* (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
|
18
|
+
* @since 1.6.0
|
19
|
+
*/
|
20
|
+
specDeterminer?: HttpMessageSignaturesSpecDeterminer;
|
21
|
+
/**
|
22
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
23
|
+
* is used.
|
24
|
+
* @since 1.6.0
|
25
|
+
*/
|
26
|
+
tracerProvider?: TracerProvider;
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
30
|
+
* Note that an authenticated document loader intentionally does not cache
|
31
|
+
* the fetched documents.
|
32
|
+
* @param identity The identity to get the document loader for.
|
33
|
+
* The actor's key pair.
|
34
|
+
* @param options The options for the document loader.
|
35
|
+
* @returns The authenticated document loader.
|
36
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
37
|
+
* @since 0.4.0
|
38
|
+
*/
|
39
|
+
declare function getAuthenticatedDocumentLoader(identity: {
|
40
|
+
keyId: URL;
|
41
|
+
privateKey: CryptoKey;
|
42
|
+
}, {
|
43
|
+
allowPrivateAddress,
|
44
|
+
userAgent,
|
45
|
+
specDeterminer,
|
46
|
+
tracerProvider
|
47
|
+
}?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
|
48
|
+
/**
|
49
|
+
* A JSON-LD document loader that utilizes the browser's `fetch` API.
|
50
|
+
*
|
51
|
+
* This loader preloads the below frequently used contexts:
|
52
|
+
*
|
53
|
+
* - <https://www.w3.org/ns/activitystreams>
|
54
|
+
* - <https://w3id.org/security/v1>
|
55
|
+
* - <https://w3id.org/security/data-integrity/v1>
|
56
|
+
* - <https://www.w3.org/ns/did/v1>
|
57
|
+
* - <https://w3id.org/security/multikey/v1>
|
58
|
+
* - <https://purl.archive.org/socialweb/webfinger>
|
59
|
+
* - <http://schema.org/>
|
60
|
+
* @param url The URL of the document to load.
|
61
|
+
* @param allowPrivateAddress Whether to allow fetching private network
|
62
|
+
* addresses. Turned off by default.
|
63
|
+
* @returns The remote document.
|
64
|
+
* @deprecated Use {@link getDocumentLoader} instead.
|
65
|
+
*/
|
66
|
+
//#endregion
|
67
|
+
//#region src/utils/kv-cache.d.ts
|
68
|
+
/**
|
69
|
+
* The parameters for {@link kvCache} function.
|
70
|
+
*/
|
71
|
+
interface KvCacheParameters {
|
72
|
+
/**
|
73
|
+
* The document loader to decorate with a cache.
|
74
|
+
*/
|
75
|
+
loader: DocumentLoader;
|
76
|
+
/**
|
77
|
+
* The key–value store to use for backing the cache.
|
78
|
+
*/
|
79
|
+
kv: KvStore;
|
80
|
+
/**
|
81
|
+
* The key prefix to use for namespacing the cache.
|
82
|
+
* `["_fedify", "remoteDocument"]` by default.
|
83
|
+
*/
|
84
|
+
prefix?: KvKey;
|
85
|
+
/**
|
86
|
+
* The per-URL cache rules in the array of `[urlPattern, duration]` pairs
|
87
|
+
* where `urlPattern` is either a string, a {@link URL}, or
|
88
|
+
* a {@link URLPattern} and `duration` is a {@link Temporal.DurationLike}.
|
89
|
+
* The `duration` is allowed to be at most 30 days.
|
90
|
+
*
|
91
|
+
* By default, 5 minutes for all URLs.
|
92
|
+
*/
|
93
|
+
rules?: [string | URL | URLPattern, Temporal.Duration | Temporal.DurationLike][];
|
94
|
+
}
|
95
|
+
/**
|
96
|
+
* Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
|
97
|
+
* @param parameters The parameters for the cache.
|
98
|
+
* @returns The decorated document loader which is cache-enabled.
|
99
|
+
*/
|
100
|
+
declare function kvCache({
|
101
|
+
loader,
|
102
|
+
kv,
|
103
|
+
prefix,
|
104
|
+
rules
|
105
|
+
}: KvCacheParameters): DocumentLoader;
|
106
|
+
//#endregion
|
107
|
+
export { getAuthenticatedDocumentLoader, kvCache };
|
@@ -0,0 +1 @@
|
|
1
|
+
export { };
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import { KeyCache } from "./http-DqSNLFNY.js";
|
3
|
+
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "./vocab-BCWe1Ih5.js";
|
4
|
+
import { KeyCache } from "./http-BbO0ejuk.js";
|
6
5
|
import { TracerProvider } from "@opentelemetry/api";
|
6
|
+
import { DocumentLoader } from "@fedify/vocab-runtime";
|
7
7
|
|
8
8
|
//#region src/sig/ld.d.ts
|
9
9
|
/**
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
3
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-BbO0ejuk.js";
|
4
|
+
import { KvKey, KvStore } from "./kv-BKNZ-Tb-.js";
|
5
|
+
import { TracerProvider } from "@opentelemetry/api";
|
6
|
+
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
7
|
+
|
8
|
+
//#region src/utils/docloader.d.ts
|
9
|
+
/**
|
10
|
+
* Options for {@link getAuthenticatedDocumentLoader}.
|
11
|
+
* @see {@link getAuthenticatedDocumentLoader}
|
12
|
+
* @since 1.3.0
|
13
|
+
*/
|
14
|
+
interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
15
|
+
/**
|
16
|
+
* An optional spec determiner for HTTP Message Signatures.
|
17
|
+
* It determines the spec to use for signing requests.
|
18
|
+
* It is used for double-knocking
|
19
|
+
* (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
|
20
|
+
* @since 1.6.0
|
21
|
+
*/
|
22
|
+
specDeterminer?: HttpMessageSignaturesSpecDeterminer;
|
23
|
+
/**
|
24
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
25
|
+
* is used.
|
26
|
+
* @since 1.6.0
|
27
|
+
*/
|
28
|
+
tracerProvider?: TracerProvider;
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
32
|
+
* Note that an authenticated document loader intentionally does not cache
|
33
|
+
* the fetched documents.
|
34
|
+
* @param identity The identity to get the document loader for.
|
35
|
+
* The actor's key pair.
|
36
|
+
* @param options The options for the document loader.
|
37
|
+
* @returns The authenticated document loader.
|
38
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
39
|
+
* @since 0.4.0
|
40
|
+
*/
|
41
|
+
declare function getAuthenticatedDocumentLoader(identity: {
|
42
|
+
keyId: URL;
|
43
|
+
privateKey: CryptoKey;
|
44
|
+
}, {
|
45
|
+
allowPrivateAddress,
|
46
|
+
userAgent,
|
47
|
+
specDeterminer,
|
48
|
+
tracerProvider
|
49
|
+
}?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
|
50
|
+
/**
|
51
|
+
* A JSON-LD document loader that utilizes the browser's `fetch` API.
|
52
|
+
*
|
53
|
+
* This loader preloads the below frequently used contexts:
|
54
|
+
*
|
55
|
+
* - <https://www.w3.org/ns/activitystreams>
|
56
|
+
* - <https://w3id.org/security/v1>
|
57
|
+
* - <https://w3id.org/security/data-integrity/v1>
|
58
|
+
* - <https://www.w3.org/ns/did/v1>
|
59
|
+
* - <https://w3id.org/security/multikey/v1>
|
60
|
+
* - <https://purl.archive.org/socialweb/webfinger>
|
61
|
+
* - <http://schema.org/>
|
62
|
+
* @param url The URL of the document to load.
|
63
|
+
* @param allowPrivateAddress Whether to allow fetching private network
|
64
|
+
* addresses. Turned off by default.
|
65
|
+
* @returns The remote document.
|
66
|
+
* @deprecated Use {@link getDocumentLoader} instead.
|
67
|
+
*/
|
68
|
+
//#endregion
|
69
|
+
//#region src/utils/kv-cache.d.ts
|
70
|
+
/**
|
71
|
+
* The parameters for {@link kvCache} function.
|
72
|
+
*/
|
73
|
+
interface KvCacheParameters {
|
74
|
+
/**
|
75
|
+
* The document loader to decorate with a cache.
|
76
|
+
*/
|
77
|
+
loader: DocumentLoader;
|
78
|
+
/**
|
79
|
+
* The key–value store to use for backing the cache.
|
80
|
+
*/
|
81
|
+
kv: KvStore;
|
82
|
+
/**
|
83
|
+
* The key prefix to use for namespacing the cache.
|
84
|
+
* `["_fedify", "remoteDocument"]` by default.
|
85
|
+
*/
|
86
|
+
prefix?: KvKey;
|
87
|
+
/**
|
88
|
+
* The per-URL cache rules in the array of `[urlPattern, duration]` pairs
|
89
|
+
* where `urlPattern` is either a string, a {@link URL}, or
|
90
|
+
* a {@link URLPattern} and `duration` is a {@link Temporal.DurationLike}.
|
91
|
+
* The `duration` is allowed to be at most 30 days.
|
92
|
+
*
|
93
|
+
* By default, 5 minutes for all URLs.
|
94
|
+
*/
|
95
|
+
rules?: [string | URL | URLPattern, Temporal.Duration | Temporal.DurationLike][];
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
|
99
|
+
* @param parameters The parameters for the cache.
|
100
|
+
* @returns The decorated document loader which is cache-enabled.
|
101
|
+
*/
|
102
|
+
declare function kvCache({
|
103
|
+
loader,
|
104
|
+
kv,
|
105
|
+
prefix,
|
106
|
+
rules
|
107
|
+
}: KvCacheParameters): DocumentLoader;
|
108
|
+
//#endregion
|
109
|
+
export { getAuthenticatedDocumentLoader, kvCache };
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import {
|
4
|
-
import { Collection, Link, Object as Object$1 } from "./vocab-SOE1ifCr.js";
|
3
|
+
import { Collection, Link, Object as Object$1 } from "./vocab-BCWe1Ih5.js";
|
5
4
|
import { TracerProvider } from "@opentelemetry/api";
|
5
|
+
import { DocumentLoader, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
6
6
|
|
7
7
|
//#region src/vocab/lookup.d.ts
|
8
8
|
/**
|
@@ -20,6 +20,24 @@ interface LookupObjectOptions {
|
|
20
20
|
* @since 0.8.0
|
21
21
|
*/
|
22
22
|
contextLoader?: DocumentLoader;
|
23
|
+
/**
|
24
|
+
* Whether to allow fetching an object with an `@id` having a different
|
25
|
+
* origin than the object's URL. This is not recommended, as it may
|
26
|
+
* lead to security issues. Only use this option if you know what you
|
27
|
+
* are doing.
|
28
|
+
*
|
29
|
+
* How to handle the case when an object's `@id` has a different origin
|
30
|
+
* than the object's URL:
|
31
|
+
*
|
32
|
+
* - `"ignore"` (default): Do not return the object, and log a warning.
|
33
|
+
* - `"throw"`: Throw an error.
|
34
|
+
* - `"trust"`: Bypass the check and return the object anyway. This
|
35
|
+
* is not recommended, as it may lead to security issues. Only use
|
36
|
+
* this option if you know what you are doing.
|
37
|
+
*
|
38
|
+
* @since 1.9.0
|
39
|
+
*/
|
40
|
+
crossOrigin?: "ignore" | "throw" | "trust";
|
23
41
|
/**
|
24
42
|
* The options for making `User-Agent` header.
|
25
43
|
* If a string is given, it is used as the `User-Agent` header value.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { Activity } from "./vocab-
|
4
|
-
import { ActivityTransformer, Context } from "./context-
|
3
|
+
import { Activity } from "./vocab-BCWe1Ih5.js";
|
4
|
+
import { ActivityTransformer, Context } from "./context-DG0huGW-.js";
|
5
5
|
|
6
6
|
//#region src/compat/transformers.d.ts
|
7
7
|
|
@@ -0,0 +1,307 @@
|
|
1
|
+
import { Collection, Link, Object as Object$1 } from "./vocab-CeDBzu-f.cjs";
|
2
|
+
import { DocumentLoader, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
3
|
+
import { TracerProvider } from "@opentelemetry/api";
|
4
|
+
|
5
|
+
//#region src/vocab/lookup.d.ts
|
6
|
+
/**
|
7
|
+
* Options for the {@link lookupObject} function.
|
8
|
+
*
|
9
|
+
* @since 0.2.0
|
10
|
+
*/
|
11
|
+
interface LookupObjectOptions {
|
12
|
+
/**
|
13
|
+
* The document loader for loading remote JSON-LD documents.
|
14
|
+
*/
|
15
|
+
documentLoader?: DocumentLoader;
|
16
|
+
/**
|
17
|
+
* The context loader for loading remote JSON-LD contexts.
|
18
|
+
* @since 0.8.0
|
19
|
+
*/
|
20
|
+
contextLoader?: DocumentLoader;
|
21
|
+
/**
|
22
|
+
* Whether to allow fetching an object with an `@id` having a different
|
23
|
+
* origin than the object's URL. This is not recommended, as it may
|
24
|
+
* lead to security issues. Only use this option if you know what you
|
25
|
+
* are doing.
|
26
|
+
*
|
27
|
+
* How to handle the case when an object's `@id` has a different origin
|
28
|
+
* than the object's URL:
|
29
|
+
*
|
30
|
+
* - `"ignore"` (default): Do not return the object, and log a warning.
|
31
|
+
* - `"throw"`: Throw an error.
|
32
|
+
* - `"trust"`: Bypass the check and return the object anyway. This
|
33
|
+
* is not recommended, as it may lead to security issues. Only use
|
34
|
+
* this option if you know what you are doing.
|
35
|
+
*
|
36
|
+
* @since 1.9.0
|
37
|
+
*/
|
38
|
+
crossOrigin?: "ignore" | "throw" | "trust";
|
39
|
+
/**
|
40
|
+
* The options for making `User-Agent` header.
|
41
|
+
* If a string is given, it is used as the `User-Agent` header value.
|
42
|
+
* If an object is given, it is passed to {@link getUserAgent} to generate
|
43
|
+
* the `User-Agent` header value.
|
44
|
+
* @since 1.3.0
|
45
|
+
*/
|
46
|
+
userAgent?: GetUserAgentOptions | string;
|
47
|
+
/**
|
48
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
49
|
+
* is used.
|
50
|
+
* @since 1.3.0
|
51
|
+
*/
|
52
|
+
tracerProvider?: TracerProvider;
|
53
|
+
/**
|
54
|
+
* AbortSignal for cancelling the request.
|
55
|
+
* @since 1.8.0
|
56
|
+
*/
|
57
|
+
signal?: AbortSignal;
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* Looks up an ActivityStreams object by its URI (including `acct:` URIs)
|
61
|
+
* or a fediverse handle (e.g., `@user@server` or `user@server`).
|
62
|
+
*
|
63
|
+
* @example
|
64
|
+
* ``` typescript
|
65
|
+
* // Look up an actor by its fediverse handle:
|
66
|
+
* await lookupObject("@hongminhee@fosstodon.org");
|
67
|
+
* // returning a `Person` object.
|
68
|
+
*
|
69
|
+
* // A fediverse handle can omit the leading '@':
|
70
|
+
* await lookupObject("hongminhee@fosstodon.org");
|
71
|
+
* // returning a `Person` object.
|
72
|
+
*
|
73
|
+
* // A `acct:` URI can be used as well:
|
74
|
+
* await lookupObject("acct:hongminhee@fosstodon.org");
|
75
|
+
* // returning a `Person` object.
|
76
|
+
*
|
77
|
+
* // Look up an object by its URI:
|
78
|
+
* await lookupObject("https://todon.eu/@hongminhee/112060633798771581");
|
79
|
+
* // returning a `Note` object.
|
80
|
+
*
|
81
|
+
* // It can be a `URL` object as well:
|
82
|
+
* await lookupObject(new URL("https://todon.eu/@hongminhee/112060633798771581"));
|
83
|
+
* // returning a `Note` object.
|
84
|
+
* ```
|
85
|
+
*
|
86
|
+
* @param identifier The URI or fediverse handle to look up.
|
87
|
+
* @param options Lookup options.
|
88
|
+
* @returns The object, or `null` if not found.
|
89
|
+
* @since 0.2.0
|
90
|
+
*/
|
91
|
+
declare function lookupObject(identifier: string | URL, options?: LookupObjectOptions): Promise<Object$1 | null>;
|
92
|
+
/**
|
93
|
+
* Options for the {@link traverseCollection} function.
|
94
|
+
* @since 1.1.0
|
95
|
+
*/
|
96
|
+
interface TraverseCollectionOptions {
|
97
|
+
/**
|
98
|
+
* The document loader for loading remote JSON-LD documents.
|
99
|
+
*/
|
100
|
+
documentLoader?: DocumentLoader;
|
101
|
+
/**
|
102
|
+
* The context loader for loading remote JSON-LD contexts.
|
103
|
+
*/
|
104
|
+
contextLoader?: DocumentLoader;
|
105
|
+
/**
|
106
|
+
* Whether to suppress errors when fetching pages. If `true`,
|
107
|
+
* errors will be logged but not thrown. Defaults to `false`.
|
108
|
+
*/
|
109
|
+
suppressError?: boolean;
|
110
|
+
/**
|
111
|
+
* The interval to wait between fetching pages. Zero or negative
|
112
|
+
* values will disable the interval. Disabled by default.
|
113
|
+
*
|
114
|
+
* @default `{ seconds: 0 }`
|
115
|
+
*/
|
116
|
+
interval?: Temporal.Duration | Temporal.DurationLike;
|
117
|
+
}
|
118
|
+
/**
|
119
|
+
* Traverses a collection, yielding each item in the collection.
|
120
|
+
* If the collection is paginated, it will fetch the next page
|
121
|
+
* automatically.
|
122
|
+
*
|
123
|
+
* @example
|
124
|
+
* ``` typescript
|
125
|
+
* const collection = await lookupObject(collectionUrl);
|
126
|
+
* if (collection instanceof Collection) {
|
127
|
+
* for await (const item of traverseCollection(collection)) {
|
128
|
+
* console.log(item.id?.href);
|
129
|
+
* }
|
130
|
+
* }
|
131
|
+
* ```
|
132
|
+
*
|
133
|
+
* @param collection The collection to traverse.
|
134
|
+
* @param options Options for traversing the collection.
|
135
|
+
* @returns An async iterable of each item in the collection.
|
136
|
+
* @since 1.1.0
|
137
|
+
*/
|
138
|
+
declare function traverseCollection(collection: Collection, options?: TraverseCollectionOptions): AsyncIterable<Object$1 | Link>;
|
139
|
+
//#endregion
|
140
|
+
//#region src/vocab/constants.d.ts
|
141
|
+
/**
|
142
|
+
* The special public collection for [public addressing]. *Do not mutate this
|
143
|
+
* object.*
|
144
|
+
*
|
145
|
+
* [public addressing]: https://www.w3.org/TR/activitypub/#public-addressing
|
146
|
+
*
|
147
|
+
* @since 0.7.0
|
148
|
+
*/
|
149
|
+
declare const PUBLIC_COLLECTION: URL;
|
150
|
+
//#endregion
|
151
|
+
//#region src/vocab/handle.d.ts
|
152
|
+
/**
|
153
|
+
* Represents a fediverse handle, which consists of a username and a host.
|
154
|
+
* The username can be alphanumeric and may include special characters,
|
155
|
+
* while the host is typically a domain name.
|
156
|
+
* @since 1.8.0
|
157
|
+
*/
|
158
|
+
interface FediverseHandle {
|
159
|
+
/**
|
160
|
+
* The username part of the fediverse handle.
|
161
|
+
* It can include alphanumeric characters and some special characters.
|
162
|
+
*/
|
163
|
+
readonly username: string;
|
164
|
+
/**
|
165
|
+
* The host part of the fediverse handle, typically a domain name.
|
166
|
+
* It is the part after the `@` symbol in the handle.
|
167
|
+
*/
|
168
|
+
readonly host: string;
|
169
|
+
}
|
170
|
+
/**
|
171
|
+
* Parses a fediverse handle in the format `@user@server` or `user@server`.
|
172
|
+
* The `user` part can contain alphanumeric characters and some special
|
173
|
+
* characters except `@`. The `server` part is all characters after the `@`
|
174
|
+
* symbol in the middle.
|
175
|
+
*
|
176
|
+
* @example
|
177
|
+
* ```typescript
|
178
|
+
* const handle = parseFediverseHandle("@username@example.com");
|
179
|
+
* console.log(handle?.username); // "username"
|
180
|
+
* console.log(handle?.host); // "example.com"
|
181
|
+
* ```
|
182
|
+
*
|
183
|
+
* @param handle - The fediverse handle string to parse.
|
184
|
+
* @returns A {@link FediverseHandle} object with `username` and `host`
|
185
|
+
* if the input is valid; otherwise `null`.
|
186
|
+
* @since 1.8.0
|
187
|
+
*/
|
188
|
+
declare function parseFediverseHandle(handle: string): FediverseHandle | null;
|
189
|
+
/**
|
190
|
+
* Checks if a string is a valid fediverse handle in the format `@user@server`
|
191
|
+
* or `user@server`. The `user` part can contain alphanumeric characters and
|
192
|
+
* some special characters except `@`. The `server` part is all characters
|
193
|
+
* after the `@` symbol in the middle.
|
194
|
+
*
|
195
|
+
* @example
|
196
|
+
* ```typescript
|
197
|
+
* console.log(isFediverseHandle("@username@example.com")); // true
|
198
|
+
* console.log(isFediverseHandle("username@example.com")); // true
|
199
|
+
* console.log(isFediverseHandle("@username@")); // false
|
200
|
+
* ```
|
201
|
+
*
|
202
|
+
* @param handle - The string to test as a fediverse handle.
|
203
|
+
* @returns `true` if the string matches the fediverse handle pattern;
|
204
|
+
* otherwise `false`.
|
205
|
+
* @since 1.8.0
|
206
|
+
*/
|
207
|
+
declare function isFediverseHandle(handle: string): handle is `${string}@${string}`;
|
208
|
+
/**
|
209
|
+
* Converts a fediverse handle in the format `@user@server` or `user@server`
|
210
|
+
* to an `acct:` URI, which is a URL-like identifier for ActivityPub actors.
|
211
|
+
*
|
212
|
+
* @example
|
213
|
+
* ```typescript
|
214
|
+
* const identifier = toAcctUrl("@username@example.com");
|
215
|
+
* console.log(identifier?.href); // "acct:username@example.com"
|
216
|
+
* ```
|
217
|
+
*
|
218
|
+
* @param handle - The fediverse handle string to convert.
|
219
|
+
* @returns A `URL` object representing the `acct:` URI if conversion succeeds;
|
220
|
+
* otherwise `null`.
|
221
|
+
* @since 1.8.0
|
222
|
+
*/
|
223
|
+
declare function toAcctUrl(handle: string): URL | null;
|
224
|
+
//#endregion
|
225
|
+
//#region src/vocab/type.d.ts
|
226
|
+
/**
|
227
|
+
* Returns the type URI of the given object.
|
228
|
+
*
|
229
|
+
* @example
|
230
|
+
* ``` typescript
|
231
|
+
* import { getTypeId, Person } from "@fedify/fedify";
|
232
|
+
*
|
233
|
+
* const obj = new Person({});
|
234
|
+
* console.log(getTypeId(obj));
|
235
|
+
* // => new URL("https://www.w3.org/ns/activitystreams#Person")
|
236
|
+
* ```
|
237
|
+
*
|
238
|
+
* @param object The Activity Vocabulary object.
|
239
|
+
* @returns The type URI of the object, e.g.,
|
240
|
+
* `new URL("https://www.w3.org/ns/activitystreams#Person")`.
|
241
|
+
* If the given `object` is `null` or `undefined`, returns `null` or
|
242
|
+
* `undefined`, respectively.
|
243
|
+
* @since 1.3.0
|
244
|
+
*/
|
245
|
+
declare function getTypeId(object: Object$1 | Link): URL;
|
246
|
+
/**
|
247
|
+
* Returns the type URI of the given object.
|
248
|
+
*
|
249
|
+
* @example
|
250
|
+
* ``` typescript
|
251
|
+
* import { getTypeId, Person } from "@fedify/fedify";
|
252
|
+
*
|
253
|
+
* const obj = new Person({});
|
254
|
+
* console.log(getTypeId(obj));
|
255
|
+
* // => new URL("https://www.w3.org/ns/activitystreams#Person")
|
256
|
+
* ```
|
257
|
+
*
|
258
|
+
* @param object The Activity Vocabulary object.
|
259
|
+
* @returns The type URI of the object, e.g.,
|
260
|
+
* `new URL("https://www.w3.org/ns/activitystreams#Person")`.
|
261
|
+
* If the given `object` is `null` or `undefined`, returns `null` or
|
262
|
+
* `undefined`, respectively.
|
263
|
+
* @since 1.3.0
|
264
|
+
*/
|
265
|
+
declare function getTypeId(object: Object$1 | Link | undefined): URL | undefined;
|
266
|
+
/**
|
267
|
+
* Returns the type URI of the given object.
|
268
|
+
*
|
269
|
+
* @example
|
270
|
+
* ``` typescript
|
271
|
+
* import { getTypeId, Person } from "@fedify/fedify";
|
272
|
+
*
|
273
|
+
* const obj = new Person({});
|
274
|
+
* console.log(getTypeId(obj));
|
275
|
+
* // => new URL("https://www.w3.org/ns/activitystreams#Person")
|
276
|
+
* ```
|
277
|
+
*
|
278
|
+
* @param object The Activity Vocabulary object.
|
279
|
+
* @returns The type URI of the object, e.g.,
|
280
|
+
* `new URL("https://www.w3.org/ns/activitystreams#Person")`.
|
281
|
+
* If the given `object` is `null` or `undefined`, returns `null` or
|
282
|
+
* `undefined`, respectively.
|
283
|
+
* @since 1.3.0
|
284
|
+
*/
|
285
|
+
declare function getTypeId(object: Object$1 | Link | null): URL | null;
|
286
|
+
/**
|
287
|
+
* Returns the type URI of the given object.
|
288
|
+
*
|
289
|
+
* @example
|
290
|
+
* ``` typescript
|
291
|
+
* import { getTypeId, Person } from "@fedify/fedify";
|
292
|
+
*
|
293
|
+
* const obj = new Person({});
|
294
|
+
* console.log(getTypeId(obj));
|
295
|
+
* // => new URL("https://www.w3.org/ns/activitystreams#Person")
|
296
|
+
* ```
|
297
|
+
*
|
298
|
+
* @param object The Activity Vocabulary object.
|
299
|
+
* @returns The type URI of the object, e.g.,
|
300
|
+
* `new URL("https://www.w3.org/ns/activitystreams#Person")`.
|
301
|
+
* If the given `object` is `null` or `undefined`, returns `null` or
|
302
|
+
* `undefined`, respectively.
|
303
|
+
* @since 1.3.0
|
304
|
+
*/
|
305
|
+
declare function getTypeId(object: Object$1 | Link | null | undefined): URL | null | undefined;
|
306
|
+
//#endregion
|
307
|
+
export { FediverseHandle, LookupObjectOptions, PUBLIC_COLLECTION, TraverseCollectionOptions, getTypeId, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection };
|
@@ -0,0 +1 @@
|
|
1
|
+
export { };
|