@fedify/fedify 2.0.0-pr.410.1558 → 2.0.0-pr.412.1692
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actor-CrTGiTZd.cjs +42609 -0
- package/dist/{actor-CkjTCNqi.js → actor-D5S46edz.js} +1 -1
- package/dist/actor-D6K058Tb.d.cts +128 -0
- package/dist/{actor-DmsbGzXS.js → actor-G2S5sPEA.js} +6951 -2127
- package/dist/{actor-C22bXuuC.d.ts → actor-T6RyhRgk.d.ts} +1 -1
- package/dist/{authdocloader-BwV2NPfz.js → authdocloader-C5AvdCCi.js} +6 -6
- package/dist/authdocloader-CQMPmpaO.cjs +58 -0
- package/dist/{authdocloader-BJxkviIL.js → authdocloader-SjwloJUA.js} +3 -3
- package/dist/{builder-DbOVAz8i.js → builder-OA47XRft.js} +10 -4
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/{client-DrNZd6r_.js → client-Bmd-i8x8.js} +3 -22
- package/dist/client-CegPX0Rn.d.cts +222 -0
- package/dist/{client-DF8anIB5.d.ts → client-bgSdkFa2.d.ts} +2 -74
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +13 -0
- package/dist/compat/mod.d.ts +8 -8
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +19 -19
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/{context-9gCpIkiz.d.ts → context-ByZprN0S.d.ts} +67 -7
- package/dist/context-C5BsZkDr.d.cts +2315 -0
- package/dist/docloader-7Ey7wNHx.cjs +4861 -0
- package/dist/{docloader-DnepZfu_.js → docloader-CkweNhUH.js} +189 -9
- package/dist/docloader-D-MrRyHl.d.cts +219 -0
- package/dist/{esm-D1HqBE3n.js → esm-CwHz8Y8t.js} +1 -1
- package/dist/federation/builder.test.js +6 -7
- package/dist/federation/collection.test.js +4 -4
- package/dist/federation/handler.test.js +23 -143
- package/dist/federation/idempotency.test.js +202 -0
- package/dist/federation/inbox.test.js +4 -4
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +4 -3
- package/dist/federation/middleware.test.js +231 -52
- package/dist/federation/mod.cjs +29 -0
- package/dist/federation/mod.d.cts +13 -0
- package/dist/federation/mod.d.ts +8 -8
- package/dist/federation/mod.js +15 -15
- package/dist/federation/mq.test.js +3 -3
- package/dist/federation/negotiation.test.d.ts +3 -0
- package/dist/federation/negotiation.test.js +28 -0
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +3 -3
- package/dist/federation/send.test.js +10 -10
- package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
- package/dist/federation-H2_En3j5.cjs +244 -0
- package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +6 -0
- package/dist/http-BiBofurJ.cjs +826 -0
- package/dist/{http-BEJUSX6j.js → http-C5tC93Hn.js} +7 -7
- package/dist/http-D-e6AFwR.d.cts +253 -0
- package/dist/{http-DqSNLFNY.d.ts → http-D6Uj2x2y.d.ts} +1 -1
- package/dist/{http-BgCF3jDs.js → http-DGjdMiLc.js} +3 -3
- package/dist/{inbox-Bq4EChoK.js → inbox-BoDY3z8G.js} +24 -7
- package/dist/key-CZR7QraT.cjs +290 -0
- package/dist/key-Cf8MffVe.cjs +10 -0
- package/dist/{key-D-0OLe9C.js → key-CkxrAIyp.js} +5 -5
- package/dist/key-Dk0j88Jo.js +10 -0
- package/dist/{key-BD3lpBWw.js → key-Epcl5jpz.js} +3 -3
- package/dist/{key-BYNqWXyu.js → key-IxRhZpOF.js} +2 -2
- package/dist/{keycache-yZDAc3-e.js → keycache-TEniXNel.js} +1 -1
- package/dist/{keys-Dtc-g6xq.js → keys-bZxcrZ9Z.js} +1 -1
- package/dist/kv-63Cil1MD.d.cts +81 -0
- package/dist/{ld-BJ484qSg.js → ld-DW7A0uIc.js} +4 -4
- package/dist/{lookup-Cj0sX50U.js → lookup-DhQCVVja.js} +21 -12
- package/dist/lookup-DiV4LFBg.cjs +137 -0
- package/dist/{lookup-BzogF2gp.js → lookup-cVRa2QM-.js} +4 -4
- package/dist/middleware-Be1JStOx.js +17 -0
- package/dist/middleware-CDOK7WOb.js +26 -0
- package/dist/{middleware-CiH0ptqy.js → middleware-Cgr3PtaJ.js} +58 -149
- package/dist/{middleware-DIZ1dnwT.js → middleware-DvvYAIsd.js} +87 -91
- package/dist/middleware-EjIW2mZB.cjs +17 -0
- package/dist/middleware-TfuVoceY.cjs +4231 -0
- package/dist/mod-8DMWKtQE.d.cts +80 -0
- package/dist/{mod-Drmz72EK.d.ts → mod-BhUKmBJD.d.ts} +2 -2
- package/dist/mod-C2tOeRkN.d.cts +1 -0
- package/dist/{mod-TFoH2Ql8.d.ts → mod-CerN_Sza.d.ts} +1 -1
- package/dist/mod-Cj1tHXBR.d.cts +102 -0
- package/dist/mod-CxkWO3Mg.d.cts +307 -0
- package/dist/{mod-Bqxcp7eN.d.ts → mod-D6hQoxC5.d.ts} +2 -2
- package/dist/mod-Djzcw2ry.d.cts +266 -0
- package/dist/{mod-Cxt4Kpf6.d.ts → mod-DlU8ISoa.d.ts} +19 -1
- package/dist/mod-FZd39qVq.d.cts +1 -0
- package/dist/mod-jQ4OODsl.d.cts +113 -0
- package/dist/mod.cjs +150 -0
- package/dist/mod.d.cts +17 -0
- package/dist/mod.d.ts +11 -11
- package/dist/mod.js +21 -21
- package/dist/mq-B7R1Q-M5.d.cts +140 -0
- package/dist/negotiation-5NPJL6zp.js +71 -0
- package/dist/nodeinfo/client.test.js +27 -106
- package/dist/nodeinfo/handler.test.js +20 -20
- package/dist/nodeinfo/mod.cjs +11 -0
- package/dist/nodeinfo/mod.d.cts +5 -0
- package/dist/nodeinfo/mod.d.ts +2 -2
- package/dist/nodeinfo/mod.js +7 -7
- package/dist/nodeinfo/types.test.js +5 -10
- package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
- package/dist/nodeinfo-DfycQ8Wf.js +4 -0
- package/dist/{owner-9FMX4wQT.js → owner-6Vc3UXXE.js} +2 -2
- package/dist/owner-BN_tO3cY.d.cts +67 -0
- package/dist/{owner-CQPnQVtf.d.ts → owner-hd9lvQcP.d.ts} +2 -2
- package/dist/{proof-Arx4Q9Q6.js → proof-C1jhbeNv.js} +3 -3
- package/dist/proof-CRJWXFfT.cjs +673 -0
- package/dist/{proof-DnTD0avk.js → proof-Chi90OXv.js} +9 -9
- package/dist/runtime/authdocloader.test.js +9 -9
- package/dist/runtime/docloader.test.js +4 -4
- package/dist/runtime/key.test.js +5 -5
- package/dist/runtime/langstr.test.js +3 -3
- package/dist/runtime/link.test.d.ts +3 -0
- package/dist/runtime/link.test.js +61 -0
- package/dist/runtime/mod.cjs +25 -0
- package/dist/runtime/mod.d.cts +6 -0
- package/dist/runtime/mod.d.ts +3 -3
- package/dist/runtime/mod.js +10 -10
- package/dist/runtime/multibase/multibase.test.js +3 -3
- package/dist/runtime/url.test.js +3 -3
- package/dist/runtime-C58AJWSv.cjs +4 -0
- package/dist/runtime-DPYEDf-o.js +4 -0
- package/dist/{send-CcxHe0p3.js → send-DjATl6i3.js} +2 -2
- package/dist/sig/http.test.js +9 -9
- package/dist/sig/key.test.js +6 -6
- package/dist/sig/ld.test.js +7 -7
- package/dist/sig/mod.cjs +30 -0
- package/dist/sig/mod.d.cts +8 -0
- package/dist/sig/mod.d.ts +5 -5
- package/dist/sig/mod.js +10 -10
- package/dist/sig/owner.test.js +7 -7
- package/dist/sig/proof.test.js +7 -7
- package/dist/sig-ByHXzqUi.cjs +4 -0
- package/dist/sig-Cj3tk-ig.js +4 -0
- package/dist/testing/docloader.test.js +3 -3
- package/dist/testing/mod.d.ts +273 -28
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-DFgpNAI6.js → testing-BnfPB5T-.js} +2 -2
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/{type-B2h-NRAo.js → type-NEA09tSC.js} +7262 -2258
- package/dist/{types-BIgY6c-l.js → types-BSuWJsOm.js} +1 -3
- package/dist/types-CmmUQisS.cjs +315 -0
- package/dist/{types-B1QuBj5L.js → types-dLXLjVLf.js} +8 -169
- package/dist/vocab/actor.test.js +5 -5
- package/dist/vocab/lookup.test.js +255 -5
- package/dist/vocab/mod.cjs +87 -0
- package/dist/vocab/mod.d.cts +6 -0
- package/dist/vocab/mod.d.ts +3 -3
- package/dist/vocab/mod.js +7 -7
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +433 -9
- package/dist/{vocab-SOE1ifCr.d.ts → vocab-BI0Ak5lL.d.ts} +290 -0
- package/dist/vocab-C5Y-0fGj.cjs +291 -0
- package/dist/vocab-Dw1-yVGg.d.cts +14922 -0
- package/dist/{vocab-BREfYr1a.js → vocab-rWbHpc2J.js} +26 -17
- package/dist/webfinger/handler.test.js +19 -19
- package/dist/webfinger/lookup.test.js +4 -4
- package/dist/webfinger/mod.cjs +9 -0
- package/dist/webfinger/mod.d.cts +4 -0
- package/dist/webfinger/mod.js +6 -6
- package/dist/webfinger-BjOEdFPs.cjs +4 -0
- package/dist/webfinger-De_bU0iE.js +4 -0
- package/dist/x/cfworkers.cjs +100 -0
- package/dist/x/cfworkers.d.cts +59 -0
- package/dist/x/cfworkers.js +3 -3
- package/dist/x/cfworkers.test.js +3 -3
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +54 -0
- package/dist/x/hono.d.ts +7 -7
- package/dist/x/hono.js +3 -3
- package/dist/x/sveltekit.cjs +69 -0
- package/dist/x/sveltekit.d.cts +46 -0
- package/dist/x/sveltekit.d.ts +7 -7
- package/dist/x/sveltekit.js +3 -3
- package/package.json +68 -13
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/key-BmFoI4_J.js +0 -10
- package/dist/middleware-D2W4gwdv.js +0 -17
- package/dist/middleware-LmK3pQ2z.js +0 -26
- package/dist/nodeinfo/semver.test.js +0 -143
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- 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/{collection-CSzG2j1P.js → collection-CcnIw1qY.js} +0 -0
- /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
import { Activity } from "./vocab-Dw1-yVGg.cjs";
|
2
|
+
import { ActivityTransformer, Context } from "./context-C5BsZkDr.cjs";
|
3
|
+
|
4
|
+
//#region src/compat/transformers.d.ts
|
5
|
+
|
6
|
+
/**
|
7
|
+
* An activity transformer that assigns a new random ID to an activity if it
|
8
|
+
* does not already have one. This is useful for ensuring that activities
|
9
|
+
* have an ID before they are sent to other servers.
|
10
|
+
*
|
11
|
+
* The generated ID is an origin URI with a fragment which contains an activity
|
12
|
+
* type name with a random UUID:
|
13
|
+
*
|
14
|
+
* ```
|
15
|
+
* https://example.com/#Follow/12345678-1234-5678-1234-567812345678
|
16
|
+
* ```
|
17
|
+
*
|
18
|
+
* @template TContextData The type of the context data.
|
19
|
+
* @param activity The activity to assign an ID to.
|
20
|
+
* @param context The context of the activity.
|
21
|
+
* @return The activity with an ID assigned.
|
22
|
+
* @since 1.4.0
|
23
|
+
*/
|
24
|
+
declare function autoIdAssigner<TContextData>(activity: Activity, context: Context<TContextData>): Activity;
|
25
|
+
/**
|
26
|
+
* An activity transformer that dehydrates the actor property of an activity
|
27
|
+
* so that it only contains the actor's URI. For example, suppose we have an
|
28
|
+
* activity like this:
|
29
|
+
*
|
30
|
+
* ```typescript
|
31
|
+
* import { Follow, Person } from "@fedify/fedify/vocab";
|
32
|
+
* const input = new Follow({
|
33
|
+
* id: new URL("http://example.com/activities/1"),
|
34
|
+
* actor: new Person({
|
35
|
+
* id: new URL("http://example.com/actors/1"),
|
36
|
+
* name: "Alice",
|
37
|
+
* preferredUsername: "alice",
|
38
|
+
* }),
|
39
|
+
* object: new Person({
|
40
|
+
* id: new URL("http://example.com/actors/2"),
|
41
|
+
* name: "Bob",
|
42
|
+
* preferredUsername: "bob",
|
43
|
+
* }),
|
44
|
+
* });
|
45
|
+
* ```
|
46
|
+
*
|
47
|
+
* The result of applying this transformer would be:
|
48
|
+
*
|
49
|
+
* ```typescript
|
50
|
+
* import { Follow, Person } from "@fedify/fedify/vocab";
|
51
|
+
* const output = new Follow({
|
52
|
+
* id: new URL("http://example.com/activities/1"),
|
53
|
+
* actor: new URL("http://example.com/actors/1"),
|
54
|
+
* object: new Person({
|
55
|
+
* id: new URL("http://example.com/actors/2"),
|
56
|
+
* name: "Bob",
|
57
|
+
* preferredUsername: "bob",
|
58
|
+
* }),
|
59
|
+
* });
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* As some ActivityPub implementations like Threads fail to deal with inlined
|
63
|
+
* actor objects, this transformer can be used to work around this issue.
|
64
|
+
* @template TContextData The type of the context data.
|
65
|
+
* @param activity The activity to dehydrate the actor property of.
|
66
|
+
* @param context The context of the activity.
|
67
|
+
* @returns The dehydrated activity.
|
68
|
+
* @since 1.4.0
|
69
|
+
*/
|
70
|
+
declare function actorDehydrator<TContextData>(activity: Activity, _context: Context<TContextData>): Activity;
|
71
|
+
/**
|
72
|
+
* Gets the default activity transformers that are applied to all outgoing
|
73
|
+
* activities.
|
74
|
+
* @template TContextData The type of the context data.
|
75
|
+
* @returns The default activity transformers.
|
76
|
+
* @since 1.4.0
|
77
|
+
*/
|
78
|
+
declare function getDefaultActivityTransformers<TContextData>(): readonly ActivityTransformer<TContextData>[];
|
79
|
+
//#endregion
|
80
|
+
export { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
3
|
import { DocumentLoader } from "./docloader-CxWcuWqQ.js";
|
4
|
-
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "./vocab-
|
5
|
-
import { KeyCache } from "./http-
|
4
|
+
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "./vocab-BI0Ak5lL.js";
|
5
|
+
import { KeyCache } from "./http-D6Uj2x2y.js";
|
6
6
|
import { TracerProvider } from "@opentelemetry/api";
|
7
7
|
|
8
8
|
//#region src/sig/ld.d.ts
|
@@ -0,0 +1 @@
|
|
1
|
+
export { };
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
3
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "./docloader-CxWcuWqQ.js";
|
4
|
-
import { HttpMessageSignaturesSpecDeterminer } from "./http-
|
4
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-D6Uj2x2y.js";
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
6
6
|
|
7
7
|
//#region src/runtime/authdocloader.d.ts
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import { DocumentLoader, DocumentLoaderFactoryOptions } from "./docloader-D-MrRyHl.cjs";
|
2
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-D-e6AFwR.cjs";
|
3
|
+
import { TracerProvider } from "@opentelemetry/api";
|
4
|
+
|
5
|
+
//#region src/runtime/authdocloader.d.ts
|
6
|
+
/**
|
7
|
+
* Options for {@link getAuthenticatedDocumentLoader}.
|
8
|
+
* @see {@link getAuthenticatedDocumentLoader}
|
9
|
+
* @since 1.3.0
|
10
|
+
*/
|
11
|
+
interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
12
|
+
/**
|
13
|
+
* An optional spec determiner for HTTP Message Signatures.
|
14
|
+
* It determines the spec to use for signing requests.
|
15
|
+
* It is used for double-knocking
|
16
|
+
* (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
|
17
|
+
* @since 1.6.0
|
18
|
+
*/
|
19
|
+
specDeterminer?: HttpMessageSignaturesSpecDeterminer;
|
20
|
+
/**
|
21
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
22
|
+
* is used.
|
23
|
+
* @since 1.6.0
|
24
|
+
*/
|
25
|
+
tracerProvider?: TracerProvider;
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
29
|
+
* Note that an authenticated document loader intentionally does not cache
|
30
|
+
* the fetched documents.
|
31
|
+
* @param identity The identity to get the document loader for.
|
32
|
+
* The actor's key pair.
|
33
|
+
* @param options The options for the document loader.
|
34
|
+
* @returns The authenticated document loader.
|
35
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
36
|
+
* @since 0.4.0
|
37
|
+
*/
|
38
|
+
declare function getAuthenticatedDocumentLoader(identity: {
|
39
|
+
keyId: URL;
|
40
|
+
privateKey: CryptoKey;
|
41
|
+
}, {
|
42
|
+
allowPrivateAddress,
|
43
|
+
userAgent,
|
44
|
+
specDeterminer,
|
45
|
+
tracerProvider
|
46
|
+
}?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
|
47
|
+
//#endregion
|
48
|
+
//#region src/runtime/key.d.ts
|
49
|
+
/**
|
50
|
+
* Imports a PEM-SPKI formatted public key.
|
51
|
+
* @param pem The PEM-SPKI formatted public key.
|
52
|
+
* @returns The imported public key.
|
53
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
54
|
+
* @since 0.5.0
|
55
|
+
*/
|
56
|
+
declare function importSpki(pem: string): Promise<CryptoKey>;
|
57
|
+
/**
|
58
|
+
* Exports a public key in PEM-SPKI format.
|
59
|
+
* @param key The public key to export.
|
60
|
+
* @returns The exported public key in PEM-SPKI format.
|
61
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
62
|
+
* @since 0.5.0
|
63
|
+
*/
|
64
|
+
declare function exportSpki(key: CryptoKey): Promise<string>;
|
65
|
+
/**
|
66
|
+
* Imports a PEM-PKCS#1 formatted public key.
|
67
|
+
* @param pem The PEM-PKCS#1 formatted public key.
|
68
|
+
* @returns The imported public key.
|
69
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
70
|
+
* @since 1.5.0
|
71
|
+
*/
|
72
|
+
declare function importPkcs1(pem: string): Promise<CryptoKey>;
|
73
|
+
/**
|
74
|
+
* Imports a PEM formatted public key (SPKI or PKCS#1).
|
75
|
+
* @param pem The PEM formatted public key to import (SPKI or PKCS#1).
|
76
|
+
* @returns The imported public key.
|
77
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
78
|
+
* @since 1.5.0
|
79
|
+
*/
|
80
|
+
declare function importPem(pem: string): Promise<CryptoKey>;
|
81
|
+
/**
|
82
|
+
* Imports a [Multibase]-encoded public key.
|
83
|
+
*
|
84
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
85
|
+
* @param key The Multibase-encoded public key.
|
86
|
+
* @returns The imported public key.
|
87
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
88
|
+
* @since 0.10.0
|
89
|
+
*/
|
90
|
+
declare function importMultibaseKey(key: string): Promise<CryptoKey>;
|
91
|
+
/**
|
92
|
+
* Exports a public key in [Multibase] format.
|
93
|
+
*
|
94
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
95
|
+
* @param key The public key to export.
|
96
|
+
* @returns The exported public key in Multibase format.
|
97
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
98
|
+
* @since 0.10.0
|
99
|
+
*/
|
100
|
+
declare function exportMultibaseKey(key: CryptoKey): Promise<string>;
|
101
|
+
//#endregion
|
102
|
+
export { GetAuthenticatedDocumentLoaderOptions, exportMultibaseKey, exportSpki, getAuthenticatedDocumentLoader, importMultibaseKey, importPem, importPkcs1, importSpki };
|
@@ -0,0 +1,307 @@
|
|
1
|
+
import { DocumentLoader, GetUserAgentOptions } from "./docloader-D-MrRyHl.cjs";
|
2
|
+
import { Collection, Link, Object as Object$1 } from "./vocab-Dw1-yVGg.cjs";
|
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 };
|
@@ -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-BI0Ak5lL.js";
|
4
|
+
import { ActivityTransformer, Context } from "./context-ByZprN0S.js";
|
5
5
|
|
6
6
|
//#region src/compat/transformers.d.ts
|
7
7
|
|