@fedify/fedify 2.0.0-pr.451.1731 → 2.0.0-pr.451.1735

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 (162) hide show
  1. package/dist/{actor-GwnlqPRv.js → actor-BlCt_BFA.js} +1 -1
  2. package/dist/{actor-Cd2CREO0.d.ts → actor-DqFajh9s.d.ts} +2 -2
  3. package/dist/{actor-Ci-5y3ml.cjs → actor-SSKGPs2C.cjs} +186 -187
  4. package/dist/{actor-DDhZuMGl.d.cts → actor-f2NtjyCg.d.cts} +2 -2
  5. package/dist/{actor-CRQwUlsr.js → actor-qRieKMCS.js} +185 -186
  6. package/dist/{builder-BflZmL4k.js → builder-Daev8Oe3.js} +3 -3
  7. package/dist/{client-Cle5j1T1.d.cts → client-94iWEfQa.d.cts} +1 -1
  8. package/dist/{client-Bkaw0_PR.d.ts → client-BsGzbnV-.d.ts} +1 -1
  9. package/dist/{client-DylapB-t.js → client-pY7-3icS.js} +1 -1
  10. package/dist/compat/mod.d.cts +11 -12
  11. package/dist/compat/mod.d.ts +11 -12
  12. package/dist/compat/transformers.test.js +16 -16
  13. package/dist/{context-BOYzcFSe.d.cts → context-BvYz3eOb.d.cts} +11 -11
  14. package/dist/{context-DqFifMwj.d.ts → context-myrGWbL_.d.ts} +11 -11
  15. package/dist/{docloader-BpcE9hBI.js → docloader-CuY-IQHN.js} +4 -5
  16. package/dist/{esm-DjbC-dsH.js → esm-CO0P-prF.js} +1 -1
  17. package/dist/federation/builder.test.js +4 -4
  18. package/dist/federation/collection.test.js +2 -2
  19. package/dist/federation/handler.test.js +17 -17
  20. package/dist/federation/idempotency.test.js +17 -17
  21. package/dist/federation/inbox.test.js +3 -3
  22. package/dist/federation/keycache.test.js +3 -3
  23. package/dist/federation/kv.test.js +2 -2
  24. package/dist/federation/middleware.test.js +18 -18
  25. package/dist/federation/mod.cjs +9 -10
  26. package/dist/federation/mod.d.cts +11 -12
  27. package/dist/federation/mod.d.ts +11 -12
  28. package/dist/federation/mod.js +9 -10
  29. package/dist/federation/mq.test.js +2 -2
  30. package/dist/federation/negotiation.test.js +2 -2
  31. package/dist/federation/retry.test.js +2 -2
  32. package/dist/federation/router.test.js +2 -2
  33. package/dist/federation/send.test.js +9 -9
  34. package/dist/{http-CCUJdi0H.js → http--W_KqmV8.js} +2 -2
  35. package/dist/{http-BE7aFuqn.d.ts → http-BbO0ejuk.d.ts} +1 -1
  36. package/dist/{http-DtUGyvkU.cjs → http-CZRSpr-0.cjs} +5 -5
  37. package/dist/{http-B6SKO6NJ.d.cts → http-M8k5mKc0.d.cts} +1 -1
  38. package/dist/{http-BzsavjR2.js → http-cj5p1nm9.js} +2 -2
  39. package/dist/{inbox-DizLjfhC.js → inbox-DCOu4Fxg.js} +1 -1
  40. package/dist/{key-De1MJH3k.js → key-CLBIsQ2b.js} +2 -2
  41. package/dist/{keycache-D2HiBv4F.js → keycache-C_E92fAZ.js} +1 -1
  42. package/dist/{keys-B4ZjS1Ot.js → keys-CESa8pOV.js} +1 -1
  43. package/dist/kv-cache-6gn8hq87.cjs +133 -0
  44. package/dist/kv-cache-D6OS46Qp.js +121 -0
  45. package/dist/kv-cache-z0lgwFi_.js +93 -0
  46. package/dist/{ld-Dux3_Cw2.js → ld-uohK5TcN.js} +2 -2
  47. package/dist/{lookup-Bql--V-C.js → lookup-B4NiLSoR.js} +129 -60
  48. package/dist/{lookup-Bep-EOgr.js → lookup-Bp3gBRGD.js} +188 -297
  49. package/dist/lookup-CfVdYD74.cjs +273 -0
  50. package/dist/{middleware-DrpnHeGO.cjs → middleware-B5t3REnT.cjs} +18 -19
  51. package/dist/middleware-B86mRO81.cjs +15 -0
  52. package/dist/{middleware-BBTmHKGh.js → middleware-BEWbWO0t.js} +8 -9
  53. package/dist/middleware-BzGmhttT.js +26 -0
  54. package/dist/middleware-DxFOBA0V.js +15 -0
  55. package/dist/{middleware-D7tP9Tq6.js → middleware-yd4xq6Dt.js} +13 -13
  56. package/dist/{mod-DLIidI_j.d.ts → mod-B2iOw50L.d.ts} +2 -2
  57. package/dist/{mod-Cm97bAiT.d.ts → mod-BYynOiJG.d.ts} +2 -2
  58. package/dist/{mod-CRENK2dd.d.ts → mod-BlVovdcy.d.ts} +2 -3
  59. package/dist/{mod--K7l84wp.d.cts → mod-BxRCHTz-.d.cts} +2 -3
  60. package/dist/{mod-DuclhZjh.d.cts → mod-C58MZ7Wx.d.cts} +1 -1
  61. package/dist/{mod-D9XZsft2.d.cts → mod-DbFNTF7m.d.cts} +2 -2
  62. package/dist/{mod-COlOrmr9.d.cts → mod-DgdBYYa0.d.cts} +2 -2
  63. package/dist/{mod-CB80AlIA.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
  64. package/dist/{mod-CLKu6Uo_.d.cts → mod-VastcQsk.d.cts} +2 -2
  65. package/dist/{mod-CaWbCg0N.d.ts → mod-k0Dk3fGk.d.ts} +2 -2
  66. package/dist/mod.cjs +13 -15
  67. package/dist/mod.d.cts +15 -16
  68. package/dist/mod.d.ts +16 -17
  69. package/dist/mod.js +14 -15
  70. package/dist/nodeinfo/client.test.js +4 -4
  71. package/dist/nodeinfo/handler.test.js +16 -16
  72. package/dist/nodeinfo/mod.cjs +2 -3
  73. package/dist/nodeinfo/mod.d.cts +2 -3
  74. package/dist/nodeinfo/mod.d.ts +2 -3
  75. package/dist/nodeinfo/mod.js +2 -3
  76. package/dist/nodeinfo/types.test.js +2 -2
  77. package/dist/{owner-dkg5OpSC.d.cts → owner-B4HbyP8s.d.cts} +2 -2
  78. package/dist/{owner-Zq8du9WO.js → owner-DMwt6EnB.js} +2 -2
  79. package/dist/{owner-CktUdA0h.d.ts → owner-kQRGVXG1.d.ts} +2 -2
  80. package/dist/{proof-aIlK5BTc.js → proof-BRMzWGtg.js} +3 -3
  81. package/dist/{proof-0PY1LDZY.cjs → proof-DVvnQ6WP.cjs} +7 -7
  82. package/dist/{proof-C5S_3hdJ.js → proof-X6v_1MA6.js} +2 -2
  83. package/dist/{send-BbVnlsQO.js → send-Cy3TUzxE.js} +2 -2
  84. package/dist/sig/http.test.js +7 -7
  85. package/dist/sig/key.test.js +5 -5
  86. package/dist/sig/ld.test.js +6 -6
  87. package/dist/sig/mod.cjs +5 -6
  88. package/dist/sig/mod.d.cts +5 -6
  89. package/dist/sig/mod.d.ts +5 -6
  90. package/dist/sig/mod.js +5 -6
  91. package/dist/sig/owner.test.js +6 -6
  92. package/dist/sig/proof.test.js +6 -6
  93. package/dist/testing/docloader.test.js +2 -2
  94. package/dist/testing/mod.d.ts +1 -27
  95. package/dist/testing/mod.js +2 -2
  96. package/dist/{testing-BkidWE0N.js → testing-BJJvJvZe.js} +1 -1
  97. package/dist/{types-CXnyjUdK.js → types-BtUjyi5y.js} +1 -1
  98. package/dist/{types-BDNYgodm.cjs → types-CWgzGaqk.cjs} +3 -3
  99. package/dist/utils/docloader.test.js +9 -8
  100. package/dist/utils/kv-cache.test.js +4 -3
  101. package/dist/utils/mod.cjs +5 -7
  102. package/dist/utils/mod.d.cts +5 -6
  103. package/dist/utils/mod.d.ts +5 -6
  104. package/dist/utils/mod.js +6 -7
  105. package/dist/vocab/actor.test.js +4 -4
  106. package/dist/vocab/lookup.test.js +3 -3
  107. package/dist/vocab/mod.cjs +3 -4
  108. package/dist/vocab/mod.d.cts +3 -4
  109. package/dist/vocab/mod.d.ts +3 -4
  110. package/dist/vocab/mod.js +3 -4
  111. package/dist/vocab/type.test.js +2 -2
  112. package/dist/vocab/vocab.test.js +3 -3
  113. package/dist/{vocab-Dapemq3v.cjs → vocab-BPtsEU8k.cjs} +3 -4
  114. package/dist/{vocab-BiKK7m2H.js → vocab-DFaqbY9O.js} +2 -3
  115. package/dist/webfinger/handler.test.js +16 -16
  116. package/dist/webfinger/lookup.test.js +3 -3
  117. package/dist/webfinger/mod.cjs +2 -3
  118. package/dist/webfinger/mod.d.cts +1 -2
  119. package/dist/webfinger/mod.d.ts +1 -2
  120. package/dist/webfinger/mod.js +2 -3
  121. package/dist/x/cfworkers.d.cts +2 -2
  122. package/dist/x/cfworkers.d.ts +2 -2
  123. package/dist/x/cfworkers.test.js +2 -2
  124. package/dist/x/hono.d.cts +10 -11
  125. package/dist/x/hono.d.ts +10 -11
  126. package/dist/x/sveltekit.d.cts +10 -11
  127. package/dist/x/sveltekit.d.ts +10 -11
  128. package/package.json +2 -3
  129. package/dist/kv-cache-3VK2-wq_.cjs +0 -4279
  130. package/dist/kv-cache-DNvS-egZ.js +0 -4236
  131. package/dist/kv-cache-rR-Cnl95.js +0 -4267
  132. package/dist/lookup-BmGuy-Ps.cjs +0 -210
  133. package/dist/middleware-BUZSGsQH.js +0 -16
  134. package/dist/middleware-BusTq7Js.cjs +0 -16
  135. package/dist/middleware-tZdLtCWz.js +0 -26
  136. package/dist/request-BbHkedIU.d.cts +0 -35
  137. package/dist/request-Bc5CHBqO.cjs +0 -208
  138. package/dist/request-C0Ags1gQ.js +0 -184
  139. package/dist/request-U1t6zZtk.d.ts +0 -39
  140. package/dist/utils/request.test.d.ts +0 -3
  141. package/dist/utils/request.test.js +0 -48
  142. package/dist/utils/url.test.d.ts +0 -3
  143. package/dist/utils/url.test.js +0 -41
  144. /package/dist/{federation-DOuZpcAw.cjs → federation-CRpdnOMS.cjs} +0 -0
  145. /package/dist/{federation-pZJsapBn.js → federation-jcR8-ZxP.js} +0 -0
  146. /package/dist/{kv-Dt06smFt.d.ts → kv-BKNZ-Tb-.d.ts} +0 -0
  147. /package/dist/{kv-BMKIFXNW.d.cts → kv-Bxr0Q87_.d.cts} +0 -0
  148. /package/dist/{mod-FZd39qVq.d.cts → mod-B-hUPT2N.d.cts} +0 -0
  149. /package/dist/{mod-B-ZQqbGe.d.ts → mod-CVgZgliM.d.ts} +0 -0
  150. /package/dist/{mod-CjsiSl7_.d.ts → mod-xIj-IT58.d.ts} +0 -0
  151. /package/dist/{mq-CPRJk4mZ.d.ts → mq-CUKlBw08.d.ts} +0 -0
  152. /package/dist/{mq-B7R1Q-M5.d.cts → mq-DcJPkXD5.d.cts} +0 -0
  153. /package/dist/{nodeinfo-B0UefMXO.js → nodeinfo-BnthBobC.js} +0 -0
  154. /package/dist/{nodeinfo-ByTd7HpT.cjs → nodeinfo-CdN0rEnZ.cjs} +0 -0
  155. /package/dist/{sig-Dx59zAgn.js → sig-C34-oHBl.js} +0 -0
  156. /package/dist/{sig-DE_NC_VQ.cjs → sig-YYj5tCnr.cjs} +0 -0
  157. /package/dist/{utils-BXMGcmqK.js → utils-D-Va7aXC.js} +0 -0
  158. /package/dist/{utils-B6yXfxAQ.cjs → utils-DyRU1gdZ.cjs} +0 -0
  159. /package/dist/{vocab-ivDKb439.d.ts → vocab-BCWe1Ih5.d.ts} +0 -0
  160. /package/dist/{vocab-DCBw44JZ.d.cts → vocab-CeDBzu-f.d.cts} +0 -0
  161. /package/dist/{webfinger-qG8R5jc3.js → webfinger-C72Y8lrh.js} +0 -0
  162. /package/dist/{webfinger-C949bxcD.cjs → webfinger-vAtLmxOF.cjs} +0 -0
@@ -2,69 +2,138 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { deno_default, getUserAgent } from "./request-C0Ags1gQ.js";
6
5
  import { getLogger } from "@logtape/logtape";
7
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
- import { lookup } from "node:dns/promises";
9
- import { isIP } from "node:net";
7
+ import { UrlError, getUserAgent, validatePublicUrl } from "@fedify/vocab-runtime";
10
8
 
11
- //#region src/utils/url.ts
12
- var UrlError = class extends Error {
13
- constructor(message) {
14
- super(message);
15
- this.name = "UrlError";
16
- }
9
+ //#region deno.json
10
+ var name = "@fedify/fedify";
11
+ var version = "2.0.0-pr.451.1735+e5916226";
12
+ var license = "MIT";
13
+ var exports = {
14
+ ".": "./src/mod.ts",
15
+ "./compat": "./src/compat/mod.ts",
16
+ "./federation": "./src/federation/mod.ts",
17
+ "./nodeinfo": "./src/nodeinfo/mod.ts",
18
+ "./sig": "./src/sig/mod.ts",
19
+ "./testing": "./src/testing/mod.ts",
20
+ "./vocab": "./src/vocab/mod.ts",
21
+ "./utils": "./src/utils/mod.ts",
22
+ "./webfinger": "./src/webfinger/mod.ts",
23
+ "./x/cfworkers": "./src/x/cfworkers.ts",
24
+ "./x/denokv": "./src/x/denokv.ts",
25
+ "./x/fresh": "./src/x/fresh.ts",
26
+ "./x/hono": "./src/x/hono.ts",
27
+ "./x/sveltekit": "./src/x/sveltekit.ts"
28
+ };
29
+ var imports = {
30
+ "@cfworker/json-schema": "npm:@cfworker/json-schema@^4.1.1",
31
+ "@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
32
+ "@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
33
+ "@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
34
+ "@std/assert": "jsr:@std/assert@^0.226.0",
35
+ "@std/testing": "jsr:@std/testing@^0.224.0",
36
+ "@std/url": "jsr:@std/url@^0.225.1",
37
+ "asn1js": "npm:asn1js@^3.0.5",
38
+ "byte-encodings": "npm:byte-encodings@^1.0.11",
39
+ "es-toolkit": "jsr:@es-toolkit/es-toolkit@^1.39.5",
40
+ "fast-check": "npm:fast-check@^3.22.0",
41
+ "fetch-mock": "npm:fetch-mock@^12.5.2",
42
+ "json-canon": "npm:json-canon@^1.0.1",
43
+ "jsonld": "npm:jsonld@^8.3.2",
44
+ "multicodec": "npm:multicodec@^3.2.1",
45
+ "pkijs": "npm:pkijs@^3.2.4",
46
+ "structured-field-values": "npm:structured-field-values@^2.0.4",
47
+ "uri-template-router": "npm:uri-template-router@^0.0.17",
48
+ "url-template": "npm:url-template@^3.1.1"
49
+ };
50
+ var include = ["src/vocab/vocab.ts"];
51
+ var exclude = [
52
+ ".test-report.xml",
53
+ "apidoc/",
54
+ "dist/",
55
+ "node_modules/",
56
+ "npm/",
57
+ "pnpm-lock.yaml",
58
+ "src/cfworkers/dist/",
59
+ "src/cfworkers/fixtures/",
60
+ "src/cfworkers/imports.ts",
61
+ "src/cfworkers/README.md",
62
+ "src/cfworkers/server.ts",
63
+ "src/cfworkers/server.js",
64
+ "src/cfworkers/server.js.map",
65
+ "src/codegen/schema.yaml",
66
+ "src/vocab/*.yaml",
67
+ "!src/vocab/vocab.ts"
68
+ ];
69
+ var tasks = {
70
+ "codegen": "GENPATH=vocab-$(deno eval \"console.log(crypto.randomUUID());\").ts && deno run --allow-read --allow-write --check src/codegen/main.ts src/vocab/ src/vocab/$GENPATH && deno fmt src/vocab/$GENPATH && mv src/vocab/$GENPATH src/vocab/vocab.ts && deno cache src/vocab/vocab.ts && deno check src/vocab/vocab.ts",
71
+ "cache": {
72
+ "command": "deno cache src/mod.ts",
73
+ "dependencies": ["codegen"]
74
+ },
75
+ "check": {
76
+ "command": "deno fmt --check && deno lint && deno check src/**/*.ts",
77
+ "dependencies": ["codegen"]
78
+ },
79
+ "test": {
80
+ "command": "deno test --check --doc --allow-read --allow-write --allow-env --unstable-kv --trace-leaks --parallel",
81
+ "dependencies": ["codegen"]
82
+ },
83
+ "coverage": "deno task test --clean --coverage && deno coverage --html coverage",
84
+ "bench": {
85
+ "command": "deno bench --allow-read --allow-write --allow-net --allow-env --allow-run --unstable-kv",
86
+ "dependencies": ["codegen"]
87
+ },
88
+ "apidoc": {
89
+ "command": "deno doc --html --name=Fedify --output=apidoc/ src/mod.ts",
90
+ "dependencies": ["codegen"]
91
+ },
92
+ "publish": {
93
+ "command": "deno publish",
94
+ "dependencies": ["codegen"]
95
+ },
96
+ "pnpm:install": "pnpm install --silent",
97
+ "pnpm:build": {
98
+ "command": "pnpm exec tsdown",
99
+ "dependencies": [
100
+ "codegen",
101
+ "pnpm:install",
102
+ "pnpm:build-vocab"
103
+ ]
104
+ },
105
+ "pnpm:build-vocab-runtime": { "command": "cd ../vocab-runtime && pnpm build" },
106
+ "pnpm:build-vocab": { "dependencies": ["pnpm:build-vocab-runtime"] },
107
+ "test:node": {
108
+ "command": "cd dist/ && node --test",
109
+ "dependencies": ["pnpm:build"]
110
+ },
111
+ "test:bun": {
112
+ "command": "cd dist/ && bun test --timeout 60000",
113
+ "dependencies": ["pnpm:build-vocab", "pnpm:build"]
114
+ },
115
+ "test:cfworkers": {
116
+ "command": "pnpm exec wrangler deploy --dry-run --outdir src/cfworkers && node --import=tsx src/cfworkers/client.ts",
117
+ "dependencies": ["pnpm:build-vocab", "pnpm:build"]
118
+ },
119
+ "test-all": { "dependencies": [
120
+ "check",
121
+ "test",
122
+ "test:node",
123
+ "test:bun",
124
+ "test:cfworkers"
125
+ ] }
126
+ };
127
+ var deno_default = {
128
+ name,
129
+ version,
130
+ license,
131
+ exports,
132
+ imports,
133
+ include,
134
+ exclude,
135
+ tasks
17
136
  };
18
- /**
19
- * Validates a URL to prevent SSRF attacks.
20
- */
21
- async function validatePublicUrl(url) {
22
- const parsed = new URL(url);
23
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new UrlError(`Unsupported protocol: ${parsed.protocol}`);
24
- let hostname = parsed.hostname;
25
- if (hostname.startsWith("[") && hostname.endsWith("]")) hostname = hostname.substring(1, hostname.length - 2);
26
- if (hostname === "localhost") throw new UrlError("Localhost is not allowed");
27
- if ("Deno" in globalThis && !isIP(hostname)) {
28
- const netPermission = await Deno.permissions.query({ name: "net" });
29
- if (netPermission.state !== "granted") return;
30
- }
31
- if ("Bun" in globalThis) {
32
- if (hostname === "example.com" || hostname.endsWith(".example.com")) return;
33
- else if (hostname === "fedify-test.internal") throw new UrlError("Invalid or private address: fedify-test.internal");
34
- }
35
- let addresses;
36
- try {
37
- addresses = await lookup(hostname, { all: true });
38
- } catch {
39
- addresses = [];
40
- }
41
- for (const { address, family } of addresses) if (family === 4 && !isValidPublicIPv4Address(address) || family === 6 && !isValidPublicIPv6Address(address) || family < 4 || family === 5 || family > 6) throw new UrlError(`Invalid or private address: ${address}`);
42
- }
43
- function isValidPublicIPv4Address(address) {
44
- const parts = address.split(".");
45
- const first = parseInt(parts[0]);
46
- if (first === 0 || first === 10 || first === 127) return false;
47
- const second = parseInt(parts[1]);
48
- if (first === 169 && second === 254) return false;
49
- if (first === 172 && second >= 16 && second <= 31) return false;
50
- if (first === 192 && second === 168) return false;
51
- return true;
52
- }
53
- function isValidPublicIPv6Address(address) {
54
- address = expandIPv6Address(address);
55
- if (address.at(4) !== ":") return false;
56
- const firstWord = parseInt(address.substring(0, 4), 16);
57
- return !(firstWord >= 64512 && firstWord <= 65023 || firstWord >= 65152 && firstWord <= 65215 || firstWord === 0 || firstWord >= 65280);
58
- }
59
- function expandIPv6Address(address) {
60
- address = address.toLowerCase();
61
- if (address === "::") return "0000:0000:0000:0000:0000:0000:0000:0000";
62
- if (address.startsWith("::")) address = "0000" + address;
63
- if (address.endsWith("::")) address = address + "0000";
64
- address = address.replace("::", ":0000".repeat(8 - (address.match(/:/g) || []).length) + ":");
65
- const parts = address.split(":");
66
- return parts.map((part) => part.padStart(4, "0")).join(":");
67
- }
68
137
 
69
138
  //#endregion
70
139
  //#region src/webfinger/lookup.ts
@@ -189,4 +258,4 @@ async function lookupWebFingerInternal(resource, options = {}) {
189
258
  }
190
259
 
191
260
  //#endregion
192
- export { UrlError, lookupWebFinger, validatePublicUrl };
261
+ export { deno_default, lookupWebFinger };