@fedify/fedify 1.8.0-pr.278.945 → 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.
Files changed (75) hide show
  1. package/dist/{actor-Dxvx0f9P.js → actor--sCIf3jA.js} +3 -3
  2. package/dist/{actor-Behcj9py.js → actor-BzhtrugN.js} +179 -179
  3. package/dist/{authdocloader-BXc1BFZ8.js → authdocloader-BbC6gc3r.js} +3 -3
  4. package/dist/{authdocloader-DY1c6aOs.js → authdocloader-BzCueVQv.js} +3 -3
  5. package/dist/{builder-gDKDK22-.js → builder-kV8ozffu.js} +3 -3
  6. package/dist/{client-BPCBiziZ.js → client-BV0fJXJ7.js} +1 -1
  7. package/dist/compat/mod.d.ts +3 -3
  8. package/dist/compat/transformers.test.js +17 -17
  9. package/dist/{context-BcKmG9xN.d.ts → context-CutbDY_L.d.ts} +1 -1
  10. package/dist/{context-C1ubq7jR.js → context-Uij-MjMF.js} +2 -2
  11. package/dist/{docloader-DcinBWzj.js → docloader-Bi_V6FC-.js} +1 -1
  12. package/dist/{docloader-O4fyv2uj.js → docloader-CSNJ-JAo.js} +1 -1
  13. package/dist/federation/builder.test.js +4 -4
  14. package/dist/federation/handler.test.js +19 -19
  15. package/dist/federation/inbox.test.js +3 -3
  16. package/dist/federation/keycache.test.js +3 -3
  17. package/dist/federation/middleware.test.js +18 -18
  18. package/dist/federation/mod.d.ts +2 -2
  19. package/dist/federation/mod.js +10 -10
  20. package/dist/federation/send.test.js +9 -9
  21. package/dist/{http-hLVF16gF.js → http-DNpdqn4y.js} +3 -3
  22. package/dist/{http-IR0xaYwB.js → http-jd14OJZP.js} +3 -3
  23. package/dist/{inbox-DqwAYVig.js → inbox-C8kkp-lX.js} +2 -2
  24. package/dist/{key-t46lhcQN.js → key-CLimdMhd.js} +3 -3
  25. package/dist/{key-WFNxUdQ-.js → key-D2l08Z-N.js} +2 -2
  26. package/dist/{key-C1tpCgUM.js → key-D8G3-XEK.js} +5 -5
  27. package/dist/{key-CbzWCmJI.js → key-Dfqy3GoG.js} +4 -4
  28. package/dist/{keycache-BgQFkjKO.js → keycache-CkQMYyUw.js} +1 -1
  29. package/dist/{keys-GHRFZ7j3.js → keys-CK71hg8N.js} +1 -1
  30. package/dist/{ld-BhYJt-vy.js → ld-DrrdKgn8.js} +3 -3
  31. package/dist/{lookup-De-_toBG.js → lookup-CEmgLHBN.js} +1 -1
  32. package/dist/{lookup-Di6jcHLC.js → lookup-DPDZ8owV.js} +55 -14
  33. package/dist/{lookup-CDaogTUU.js → lookup-DUCImox4.js} +1 -1
  34. package/dist/middleware-B5CFtEgn.js +33 -0
  35. package/dist/middleware-BW9BLnNF.js +17 -0
  36. package/dist/{middleware-rf7kn0wx.js → middleware-CCbvt6PC.js} +10 -10
  37. package/dist/{middleware-Q4Z2LOxp.js → middleware-DH9rY9E_.js} +15 -15
  38. package/dist/{mod-C8RR-LnX.d.ts → mod-DUH25XRb.d.ts} +1 -1
  39. package/dist/{mod-NxG6Toqa.d.ts → mod-yjbK0F05.d.ts} +66 -7
  40. package/dist/mod.d.ts +4 -4
  41. package/dist/mod.js +11 -11
  42. package/dist/nodeinfo/client.test.js +2 -2
  43. package/dist/nodeinfo/handler.test.js +18 -18
  44. package/dist/nodeinfo/mod.js +2 -2
  45. package/dist/{owner-DaEtXgj4.js → owner-DyS24Ob_.js} +3 -3
  46. package/dist/{proof-DLb5N3kt.js → proof-D3ymVTZM.js} +3 -3
  47. package/dist/{proof-CfZsNDSH.js → proof-LpYTDZkp.js} +3 -3
  48. package/dist/runtime/authdocloader.test.js +8 -8
  49. package/dist/runtime/docloader.test.js +1 -1
  50. package/dist/runtime/key.test.js +5 -5
  51. package/dist/runtime/mod.js +6 -6
  52. package/dist/{send-BlXELCOR.js → send-MI4kpRWT.js} +2 -2
  53. package/dist/sig/http.test.js +7 -7
  54. package/dist/sig/key.test.js +6 -6
  55. package/dist/sig/ld.test.js +7 -7
  56. package/dist/sig/mod.js +6 -6
  57. package/dist/sig/owner.test.js +8 -8
  58. package/dist/sig/proof.test.js +7 -7
  59. package/dist/{types-CBbRiLwY.js → types-A7zhi9NR.js} +1 -1
  60. package/dist/vocab/actor.test.js +4 -4
  61. package/dist/vocab/lookup.test.js +4 -4
  62. package/dist/vocab/mod.d.ts +2 -2
  63. package/dist/vocab/mod.js +5 -5
  64. package/dist/vocab/type.test.js +2 -2
  65. package/dist/vocab/vocab.test.js +3 -3
  66. package/dist/{vocab-CzWmRNkq.js → vocab-BV7kb0pN.js} +178 -178
  67. package/dist/{vocab-gGnDYBK6.js → vocab-PLuG5HcC.js} +74 -15
  68. package/dist/webfinger/handler.test.js +18 -18
  69. package/dist/webfinger/lookup.test.js +2 -2
  70. package/dist/webfinger/mod.js +2 -2
  71. package/dist/x/hono.d.ts +2 -2
  72. package/dist/x/sveltekit.d.ts +2 -2
  73. package/package.json +1 -1
  74. package/dist/middleware-CMoyF9JL.js +0 -17
  75. package/dist/middleware-DslY5EoX.js +0 -33
@@ -2,19 +2,14 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { deno_default, getDocumentLoader } from "./docloader-O4fyv2uj.js";
6
- import { Object as Object$1, getTypeId } from "./actor-Behcj9py.js";
7
- import { lookupWebFinger } from "./lookup-De-_toBG.js";
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/lookup.ts
13
- const logger = getLogger([
14
- "fedify",
15
- "vocab",
16
- "lookup"
17
- ]);
12
+ //#region vocab/handle.ts
18
13
  /**
19
14
  * Regular expression to match a fediverse handle in the format `@user@server` or `user@server`.
20
15
  * The `user` part can contain alphanumeric characters and some special characters except `@`.
@@ -22,6 +17,74 @@ const logger = getLogger([
22
17
  */
23
18
  const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]+)$/;
24
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
81
+ //#region vocab/lookup.ts
82
+ const logger = getLogger([
83
+ "fedify",
84
+ "vocab",
85
+ "lookup"
86
+ ]);
87
+ /**
25
88
  * Looks up an ActivityStreams object by its URI (including `acct:` URIs)
26
89
  * or a fediverse handle (e.g., `@user@server` or `user@server`).
27
90
  *
@@ -79,11 +142,7 @@ async function lookupObject(identifier, options = {}) {
79
142
  }
80
143
  async function lookupObjectInternal(identifier, options = {}) {
81
144
  const documentLoader = options.documentLoader ?? getDocumentLoader({ userAgent: options.userAgent });
82
- if (typeof identifier === "string") {
83
- const match = handleRegexp.exec(identifier);
84
- if (match) identifier = `acct:${match[1]}@${match[2]}`;
85
- identifier = new URL(identifier);
86
- }
145
+ if (typeof identifier === "string") identifier = convertFediverseHandle(identifier) ?? new URL(identifier);
87
146
  let document = null;
88
147
  if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
89
148
  const remoteDoc = await documentLoader(identifier.href);
@@ -174,4 +233,4 @@ async function* traverseCollection(collection, options = {}) {
174
233
  const PUBLIC_COLLECTION = new URL("https://www.w3.org/ns/activitystreams#Public");
175
234
 
176
235
  //#endregion
177
- export { PUBLIC_COLLECTION, handleRegexp, 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-Q4Z2LOxp.js";
11
- import "../docloader-DcinBWzj.js";
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-BPCBiziZ.js";
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-CzWmRNkq.js";
18
+ import { Image, Link, Person } from "../vocab-BV7kb0pN.js";
19
19
  import "../langstr-DbWheeIS.js";
20
- import "../lookup-CDaogTUU.js";
20
+ import "../lookup-DUCImox4.js";
21
21
  import "../type-D2s5lmbZ.js";
22
- import "../actor-Dxvx0f9P.js";
23
- import "../key-t46lhcQN.js";
24
- import "../http-IR0xaYwB.js";
25
- import "../authdocloader-DY1c6aOs.js";
26
- import "../ld-BhYJt-vy.js";
27
- import "../owner-DaEtXgj4.js";
28
- import "../proof-DLb5N3kt.js";
29
- import "../lookup-Di6jcHLC.js";
30
- import "../inbox-DqwAYVig.js";
31
- import "../builder-gDKDK22-.js";
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-BgQFkjKO.js";
33
+ import "../keycache-CkQMYyUw.js";
34
34
  import "../retry-BiIhZWgD.js";
35
- import "../send-BlXELCOR.js";
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-C1ubq7jR.js";
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-DcinBWzj.js";
9
+ import "../docloader-Bi_V6FC-.js";
10
10
  import "../url-kTAI6_KP.js";
11
- import { lookupWebFinger } from "../lookup-CDaogTUU.js";
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";
@@ -2,8 +2,8 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import "../docloader-O4fyv2uj.js";
6
- import { lookupWebFinger } from "../lookup-De-_toBG.js";
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-NxG6Toqa.js";
10
+ import "../mod-yjbK0F05.js";
11
11
  import "../lookup-DHNtuVcT.js";
12
- import { Federation } from "../context-BcKmG9xN.js";
12
+ import { Federation } from "../context-CutbDY_L.js";
13
13
  import "../mq-DYKDDJmp.js";
14
14
 
15
15
  //#region x/hono.d.ts
@@ -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-NxG6Toqa.js";
10
+ import "../mod-yjbK0F05.js";
11
11
  import "../lookup-DHNtuVcT.js";
12
- import { Federation } from "../context-BcKmG9xN.js";
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "1.8.0-pr.278.945+c548281b",
3
+ "version": "1.8.0-pr.278.948+6dd1f8b6",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -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-O4fyv2uj.js";
7
- import "./actor-Behcj9py.js";
8
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-rf7kn0wx.js";
9
- import "./lookup-De-_toBG.js";
10
- import "./key-WFNxUdQ-.js";
11
- import "./http-hLVF16gF.js";
12
- import "./proof-CfZsNDSH.js";
13
- import "./types-CBbRiLwY.js";
14
- import "./authdocloader-BXc1BFZ8.js";
15
- import "./vocab-gGnDYBK6.js";
16
-
17
- export { FederationImpl };
@@ -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-Q4Z2LOxp.js";
7
- import "./docloader-DcinBWzj.js";
8
- import "./url-kTAI6_KP.js";
9
- import "./semver-DWClQt_5.js";
10
- import "./client-BPCBiziZ.js";
11
- import "./router-D3UybECj.js";
12
- import "./types-C7C_l-jz.js";
13
- import "./multibase-DeCHcK8L.js";
14
- import "./vocab-CzWmRNkq.js";
15
- import "./langstr-DbWheeIS.js";
16
- import "./lookup-CDaogTUU.js";
17
- import "./type-D2s5lmbZ.js";
18
- import "./actor-Dxvx0f9P.js";
19
- import "./key-t46lhcQN.js";
20
- import "./http-IR0xaYwB.js";
21
- import "./authdocloader-DY1c6aOs.js";
22
- import "./ld-BhYJt-vy.js";
23
- import "./owner-DaEtXgj4.js";
24
- import "./proof-DLb5N3kt.js";
25
- import "./lookup-Di6jcHLC.js";
26
- import "./inbox-DqwAYVig.js";
27
- import "./builder-gDKDK22-.js";
28
- import "./collection-Dfb0TPno.js";
29
- import "./keycache-BgQFkjKO.js";
30
- import "./retry-BiIhZWgD.js";
31
- import "./send-BlXELCOR.js";
32
-
33
- export { FederationImpl };