@fedify/fedify 1.8.0-pr.278.944 → 1.8.0-pr.278.948
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-DfOruFo2.js → actor--sCIf3jA.js} +3 -3
- package/dist/{actor-CWUk7Rx3.js → actor-BzhtrugN.js} +179 -179
- package/dist/{authdocloader-Tgywh0l9.js → authdocloader-BbC6gc3r.js} +3 -3
- package/dist/{authdocloader-CCOEYRRB.js → authdocloader-BzCueVQv.js} +3 -3
- package/dist/{builder-BO9cwrZF.js → builder-kV8ozffu.js} +3 -3
- package/dist/{client-KG_gq9AG.js → client-BV0fJXJ7.js} +1 -1
- package/dist/compat/mod.d.ts +3 -3
- package/dist/compat/transformers.test.js +17 -17
- package/dist/{context-y90aX3KP.d.ts → context-CutbDY_L.d.ts} +1 -1
- package/dist/{context-Duy2pXkl.js → context-Uij-MjMF.js} +2 -2
- package/dist/{docloader-CBdigsN-.js → docloader-Bi_V6FC-.js} +1 -1
- package/dist/{docloader-Dtg3MfAD.js → docloader-CSNJ-JAo.js} +1 -1
- package/dist/federation/builder.test.js +4 -4
- package/dist/federation/handler.test.js +19 -19
- package/dist/federation/inbox.test.js +3 -3
- package/dist/federation/keycache.test.js +3 -3
- package/dist/federation/middleware.test.js +18 -18
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +10 -10
- package/dist/federation/send.test.js +9 -9
- package/dist/{http-1Y9JjKI_.js → http-DNpdqn4y.js} +3 -3
- package/dist/{http-mGIT7DMH.js → http-jd14OJZP.js} +3 -3
- package/dist/{inbox-BbPGdiUv.js → inbox-C8kkp-lX.js} +2 -2
- package/dist/{key-IHUIlLUI.js → key-CLimdMhd.js} +3 -3
- package/dist/{key-D35sS1bj.js → key-D2l08Z-N.js} +2 -2
- package/dist/{key-4fOtENE0.js → key-D8G3-XEK.js} +5 -5
- package/dist/{key-CMLOD7hp.js → key-Dfqy3GoG.js} +4 -4
- package/dist/{keycache-Dd821AkF.js → keycache-CkQMYyUw.js} +1 -1
- package/dist/{keys-DoIH5o45.js → keys-CK71hg8N.js} +1 -1
- package/dist/{ld-C99pPj8Q.js → ld-DrrdKgn8.js} +3 -3
- package/dist/{lookup-BvnYwlBP.js → lookup-CEmgLHBN.js} +1 -1
- package/dist/{lookup-BuClDTj_.js → lookup-DPDZ8owV.js} +55 -9
- package/dist/{lookup-CqvNcEt7.js → lookup-DUCImox4.js} +1 -1
- package/dist/middleware-B5CFtEgn.js +33 -0
- package/dist/middleware-BW9BLnNF.js +17 -0
- package/dist/{middleware-BnixuKUX.js → middleware-CCbvt6PC.js} +10 -10
- package/dist/{middleware-DMt6riUW.js → middleware-DH9rY9E_.js} +15 -15
- package/dist/{mod-CaGwZaei.d.ts → mod-DUH25XRb.d.ts} +1 -1
- package/dist/{mod-BzLUzgBJ.d.ts → mod-yjbK0F05.d.ts} +66 -1
- package/dist/mod.d.ts +4 -4
- package/dist/mod.js +11 -11
- package/dist/nodeinfo/client.test.js +2 -2
- package/dist/nodeinfo/handler.test.js +18 -18
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/{owner-DMng4Qkq.js → owner-DyS24Ob_.js} +3 -3
- package/dist/{proof-BeMLogYC.js → proof-D3ymVTZM.js} +3 -3
- package/dist/{proof-B3eLbwox.js → proof-LpYTDZkp.js} +3 -3
- package/dist/runtime/authdocloader.test.js +8 -8
- package/dist/runtime/docloader.test.js +1 -1
- package/dist/runtime/key.test.js +5 -5
- package/dist/runtime/mod.js +6 -6
- package/dist/{send-CaYuB8ZE.js → send-MI4kpRWT.js} +2 -2
- package/dist/sig/http.test.js +7 -7
- package/dist/sig/key.test.js +6 -6
- package/dist/sig/ld.test.js +7 -7
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +8 -8
- package/dist/sig/proof.test.js +7 -7
- package/dist/{types-BGnhROgZ.js → types-A7zhi9NR.js} +1 -1
- package/dist/vocab/actor.test.js +4 -4
- package/dist/vocab/lookup.test.js +4 -4
- package/dist/vocab/mod.d.ts +2 -2
- package/dist/vocab/mod.js +5 -5
- package/dist/vocab/type.test.js +2 -2
- package/dist/vocab/vocab.test.js +3 -3
- package/dist/{vocab-BtM93CMX.js → vocab-BV7kb0pN.js} +178 -178
- package/dist/{vocab-EMhU6jSv.js → vocab-PLuG5HcC.js} +74 -10
- package/dist/webfinger/handler.test.js +18 -18
- package/dist/webfinger/lookup.test.js +2 -2
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/hono.d.ts +2 -2
- package/dist/x/sveltekit.d.ts +2 -2
- package/package.json +1 -1
- package/dist/middleware-D0AjBv4Z.js +0 -33
- package/dist/middleware-DbKIbD6u.js +0 -17
@@ -2,20 +2,88 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
6
|
-
import { Object as Object$1, getTypeId } from "./actor-
|
7
|
-
import { lookupWebFinger } from "./lookup-
|
5
|
+
import { deno_default, getDocumentLoader } from "./docloader-CSNJ-JAo.js";
|
6
|
+
import { Object as Object$1, getTypeId } from "./actor-BzhtrugN.js";
|
7
|
+
import { lookupWebFinger } from "./lookup-CEmgLHBN.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
10
10
|
import { delay } from "es-toolkit";
|
11
11
|
|
12
|
+
//#region vocab/handle.ts
|
13
|
+
/**
|
14
|
+
* Regular expression to match a fediverse handle in the format `@user@server` or `user@server`.
|
15
|
+
* The `user` part can contain alphanumeric characters and some special characters except `@`.
|
16
|
+
* The `server` part is all characters after the `@` symbol in the middle.
|
17
|
+
*/
|
18
|
+
const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]+)$/;
|
19
|
+
/**
|
20
|
+
* Parses a fediverse handle in the format `@user@server` or `user@server`.
|
21
|
+
* The `user` part can contain alphanumeric characters and some special characters except `@`.
|
22
|
+
* The `server` part is all characters after the `@` symbol in the middle.
|
23
|
+
*
|
24
|
+
* @param handle - The fediverse handle string to parse.
|
25
|
+
* @returns A {@link FediverseHandle} object with `username` and `host` if the input is valid; otherwise `null`.
|
26
|
+
* @since 1.8.0
|
27
|
+
* @example
|
28
|
+
* ```typescript
|
29
|
+
* const handle = parseFediverseHandle("@username@example.com");
|
30
|
+
* console.log(handle?.username); // "username"
|
31
|
+
* console.log(handle?.host); // "example.com"
|
32
|
+
* ```
|
33
|
+
*/
|
34
|
+
function parseFediverseHandle(handle) {
|
35
|
+
const match = handleRegexp.exec(handle);
|
36
|
+
if (match) return {
|
37
|
+
username: match[1],
|
38
|
+
host: match[2]
|
39
|
+
};
|
40
|
+
return null;
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Checks if a string is a valid fediverse handle in the format `@user@server` or `user@server`.
|
44
|
+
* The `user` part can contain alphanumeric characters and some special characters except `@`.
|
45
|
+
* The `server` part is all characters after the `@` symbol in the middle.
|
46
|
+
*
|
47
|
+
* @param handle - The string to test as a fediverse handle.
|
48
|
+
* @returns `true` if the string matches the fediverse handle pattern; otherwise `false`.
|
49
|
+
* @since 1.8.0
|
50
|
+
* @example
|
51
|
+
* ```typescript
|
52
|
+
* console.log(isFediverseHandle("@username@example.com")); // true
|
53
|
+
* console.log(isFediverseHandle("username@example.com")); // true
|
54
|
+
* console.log(isFediverseHandle("@username@")); // false
|
55
|
+
* ```
|
56
|
+
*/
|
57
|
+
function isFediverseHandle(handle) {
|
58
|
+
return handleRegexp.test(handle);
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* Converts a fediverse handle in the format `@user@server` or `user@server`
|
62
|
+
* to an `acct:` URI, which is a URL-like identifier for ActivityPub actors.
|
63
|
+
*
|
64
|
+
* @param handle - The fediverse handle string to convert.
|
65
|
+
* @returns A `URL` object representing the `acct:` URI if conversion succeeds; otherwise `null`.
|
66
|
+
* @since 1.8.0
|
67
|
+
* @example
|
68
|
+
* ```typescript
|
69
|
+
* const identifier = convertFediverseHandle("@username@example.com");
|
70
|
+
* console.log(identifier?.href); // "acct:username@example.com"
|
71
|
+
* ```
|
72
|
+
*/
|
73
|
+
function convertFediverseHandle(handle) {
|
74
|
+
const parsed = parseFediverseHandle(handle);
|
75
|
+
if (!parsed) return null;
|
76
|
+
const identifier = new URL(`acct:${parsed.username}@${parsed.host}`);
|
77
|
+
return identifier;
|
78
|
+
}
|
79
|
+
|
80
|
+
//#endregion
|
12
81
|
//#region vocab/lookup.ts
|
13
82
|
const logger = getLogger([
|
14
83
|
"fedify",
|
15
84
|
"vocab",
|
16
85
|
"lookup"
|
17
86
|
]);
|
18
|
-
const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]+)$/;
|
19
87
|
/**
|
20
88
|
* Looks up an ActivityStreams object by its URI (including `acct:` URIs)
|
21
89
|
* or a fediverse handle (e.g., `@user@server` or `user@server`).
|
@@ -74,11 +142,7 @@ async function lookupObject(identifier, options = {}) {
|
|
74
142
|
}
|
75
143
|
async function lookupObjectInternal(identifier, options = {}) {
|
76
144
|
const documentLoader = options.documentLoader ?? getDocumentLoader({ userAgent: options.userAgent });
|
77
|
-
if (typeof identifier === "string")
|
78
|
-
const match = handleRegexp.exec(identifier);
|
79
|
-
if (match) identifier = `acct:${match[1]}@${match[2]}`;
|
80
|
-
identifier = new URL(identifier);
|
81
|
-
}
|
145
|
+
if (typeof identifier === "string") identifier = convertFediverseHandle(identifier) ?? new URL(identifier);
|
82
146
|
let document = null;
|
83
147
|
if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
|
84
148
|
const remoteDoc = await documentLoader(identifier.href);
|
@@ -169,4 +233,4 @@ async function* traverseCollection(collection, options = {}) {
|
|
169
233
|
const PUBLIC_COLLECTION = new URL("https://www.w3.org/ns/activitystreams#Public");
|
170
234
|
|
171
235
|
//#endregion
|
172
|
-
export { PUBLIC_COLLECTION, lookupObject, traverseCollection };
|
236
|
+
export { PUBLIC_COLLECTION, convertFediverseHandle, isFediverseHandle, lookupObject, parseFediverseHandle, traverseCollection };
|
@@ -7,32 +7,32 @@ import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
|
7
7
|
import "../assert-DwEa6glZ.js";
|
8
8
|
import "../assert_instance_of-C9QtN-X9.js";
|
9
9
|
import { MemoryKvStore } from "../kv-D7Yt6pnB.js";
|
10
|
-
import { createFederation, handleWebFinger } from "../middleware-
|
11
|
-
import "../docloader-
|
10
|
+
import { createFederation, handleWebFinger } from "../middleware-DH9rY9E_.js";
|
11
|
+
import "../docloader-Bi_V6FC-.js";
|
12
12
|
import "../url-kTAI6_KP.js";
|
13
13
|
import "../semver-DWClQt_5.js";
|
14
|
-
import "../client-
|
14
|
+
import "../client-BV0fJXJ7.js";
|
15
15
|
import "../router-D3UybECj.js";
|
16
16
|
import "../types-C7C_l-jz.js";
|
17
17
|
import "../multibase-DeCHcK8L.js";
|
18
|
-
import { Image, Link, Person } from "../vocab-
|
18
|
+
import { Image, Link, Person } from "../vocab-BV7kb0pN.js";
|
19
19
|
import "../langstr-DbWheeIS.js";
|
20
|
-
import "../lookup-
|
20
|
+
import "../lookup-DUCImox4.js";
|
21
21
|
import "../type-D2s5lmbZ.js";
|
22
|
-
import "../actor
|
23
|
-
import "../key-
|
24
|
-
import "../http-
|
25
|
-
import "../authdocloader-
|
26
|
-
import "../ld-
|
27
|
-
import "../owner-
|
28
|
-
import "../proof-
|
29
|
-
import "../lookup-
|
30
|
-
import "../inbox-
|
31
|
-
import "../builder-
|
22
|
+
import "../actor--sCIf3jA.js";
|
23
|
+
import "../key-CLimdMhd.js";
|
24
|
+
import "../http-jd14OJZP.js";
|
25
|
+
import "../authdocloader-BzCueVQv.js";
|
26
|
+
import "../ld-DrrdKgn8.js";
|
27
|
+
import "../owner-DyS24Ob_.js";
|
28
|
+
import "../proof-D3ymVTZM.js";
|
29
|
+
import "../lookup-DPDZ8owV.js";
|
30
|
+
import "../inbox-C8kkp-lX.js";
|
31
|
+
import "../builder-kV8ozffu.js";
|
32
32
|
import "../collection-Dfb0TPno.js";
|
33
|
-
import "../keycache-
|
33
|
+
import "../keycache-CkQMYyUw.js";
|
34
34
|
import "../retry-BiIhZWgD.js";
|
35
|
-
import "../send-
|
35
|
+
import "../send-MI4kpRWT.js";
|
36
36
|
import { test } from "../testing-BZ0dJ4qn.js";
|
37
37
|
import "../std__assert-B3iAixc-.js";
|
38
38
|
import "../assert_rejects-DceVjUlD.js";
|
@@ -40,7 +40,7 @@ import "../assert_is_error-DQdKoRgb.js";
|
|
40
40
|
import "../assert_not_equals-7pyUM3Ib.js";
|
41
41
|
import "../assert_throws-DTDC_gwN.js";
|
42
42
|
import "../docloader-09nVWLAZ.js";
|
43
|
-
import { createRequestContext } from "../context-
|
43
|
+
import { createRequestContext } from "../context-Uij-MjMF.js";
|
44
44
|
|
45
45
|
//#region webfinger/handler.test.ts
|
46
46
|
test("handleWebFinger()", async (t) => {
|
@@ -6,9 +6,9 @@
|
|
6
6
|
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
7
|
import "../assert-DwEa6glZ.js";
|
8
8
|
import "../assert_instance_of-C9QtN-X9.js";
|
9
|
-
import "../docloader-
|
9
|
+
import "../docloader-Bi_V6FC-.js";
|
10
10
|
import "../url-kTAI6_KP.js";
|
11
|
-
import { lookupWebFinger } from "../lookup-
|
11
|
+
import { lookupWebFinger } from "../lookup-DUCImox4.js";
|
12
12
|
import { test } from "../testing-BZ0dJ4qn.js";
|
13
13
|
import "../std__assert-B3iAixc-.js";
|
14
14
|
import "../assert_rejects-DceVjUlD.js";
|
package/dist/webfinger/mod.js
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import "../docloader-
|
6
|
-
import { lookupWebFinger } from "../lookup-
|
5
|
+
import "../docloader-CSNJ-JAo.js";
|
6
|
+
import { lookupWebFinger } from "../lookup-CEmgLHBN.js";
|
7
7
|
import "../webfinger-C3GIyXIg.js";
|
8
8
|
|
9
9
|
export { lookupWebFinger };
|
package/dist/x/hono.d.ts
CHANGED
@@ -7,9 +7,9 @@ import "../vocab-By6mpzr-.js";
|
|
7
7
|
import "../actor-B4TBtqRP.js";
|
8
8
|
import "../http-CP2ZUALI.js";
|
9
9
|
import "../owner-CEv_PfyK.js";
|
10
|
-
import "../mod-
|
10
|
+
import "../mod-yjbK0F05.js";
|
11
11
|
import "../lookup-DHNtuVcT.js";
|
12
|
-
import { Federation } from "../context-
|
12
|
+
import { Federation } from "../context-CutbDY_L.js";
|
13
13
|
import "../mq-DYKDDJmp.js";
|
14
14
|
|
15
15
|
//#region x/hono.d.ts
|
package/dist/x/sveltekit.d.ts
CHANGED
@@ -7,9 +7,9 @@ import "../vocab-By6mpzr-.js";
|
|
7
7
|
import "../actor-B4TBtqRP.js";
|
8
8
|
import "../http-CP2ZUALI.js";
|
9
9
|
import "../owner-CEv_PfyK.js";
|
10
|
-
import "../mod-
|
10
|
+
import "../mod-yjbK0F05.js";
|
11
11
|
import "../lookup-DHNtuVcT.js";
|
12
|
-
import { Federation } from "../context-
|
12
|
+
import { Federation } from "../context-CutbDY_L.js";
|
13
13
|
import "../mq-DYKDDJmp.js";
|
14
14
|
|
15
15
|
//#region x/sveltekit.d.ts
|
package/package.json
CHANGED
@@ -1,33 +0,0 @@
|
|
1
|
-
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
4
|
-
globalThis.addEventListener = () => {};
|
5
|
-
|
6
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-DMt6riUW.js";
|
7
|
-
import "./docloader-CBdigsN-.js";
|
8
|
-
import "./url-kTAI6_KP.js";
|
9
|
-
import "./semver-DWClQt_5.js";
|
10
|
-
import "./client-KG_gq9AG.js";
|
11
|
-
import "./router-D3UybECj.js";
|
12
|
-
import "./types-C7C_l-jz.js";
|
13
|
-
import "./multibase-DeCHcK8L.js";
|
14
|
-
import "./vocab-BtM93CMX.js";
|
15
|
-
import "./langstr-DbWheeIS.js";
|
16
|
-
import "./lookup-CqvNcEt7.js";
|
17
|
-
import "./type-D2s5lmbZ.js";
|
18
|
-
import "./actor-DfOruFo2.js";
|
19
|
-
import "./key-IHUIlLUI.js";
|
20
|
-
import "./http-mGIT7DMH.js";
|
21
|
-
import "./authdocloader-CCOEYRRB.js";
|
22
|
-
import "./ld-C99pPj8Q.js";
|
23
|
-
import "./owner-DMng4Qkq.js";
|
24
|
-
import "./proof-BeMLogYC.js";
|
25
|
-
import "./lookup-BuClDTj_.js";
|
26
|
-
import "./inbox-BbPGdiUv.js";
|
27
|
-
import "./builder-BO9cwrZF.js";
|
28
|
-
import "./collection-Dfb0TPno.js";
|
29
|
-
import "./keycache-Dd821AkF.js";
|
30
|
-
import "./retry-BiIhZWgD.js";
|
31
|
-
import "./send-CaYuB8ZE.js";
|
32
|
-
|
33
|
-
export { FederationImpl };
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
3
|
-
import { URLPattern } from "urlpattern-polyfill";
|
4
|
-
|
5
|
-
import "./transformers-ghwJuzGY.js";
|
6
|
-
import "./docloader-Dtg3MfAD.js";
|
7
|
-
import "./actor-CWUk7Rx3.js";
|
8
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-BnixuKUX.js";
|
9
|
-
import "./lookup-BvnYwlBP.js";
|
10
|
-
import "./key-D35sS1bj.js";
|
11
|
-
import "./http-1Y9JjKI_.js";
|
12
|
-
import "./proof-B3eLbwox.js";
|
13
|
-
import "./types-BGnhROgZ.js";
|
14
|
-
import "./authdocloader-Tgywh0l9.js";
|
15
|
-
import "./vocab-EMhU6jSv.js";
|
16
|
-
|
17
|
-
export { FederationImpl };
|