@fedify/fedify 1.8.1-pr.315.1090 → 1.8.1-pr.318.1225

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 (130) hide show
  1. package/README.md +4 -1
  2. package/dist/{actor-BX-pKSuT.js → actor-C5n4A944.js} +1 -4
  3. package/dist/{actor-1rvS-py8.d.ts → actor-CWNAGvnO.d.ts} +2 -2
  4. package/dist/{actor-C02Getjh.js → actor-s5mQBwHr.js} +179 -179
  5. package/dist/{assert_rejects-DceVjUlD.js → assert_rejects-AjlKk-Vo.js} +1 -1
  6. package/dist/{assert_throws-DTDC_gwN.js → assert_throws-CqMKbTh_.js} +1 -1
  7. package/dist/{authdocloader-BZs3nvC8.js → authdocloader-4RSyvLgz.js} +4 -5
  8. package/dist/{authdocloader-BbVFhkcz.js → authdocloader-CPaXUreA.js} +4 -4
  9. package/dist/{builder-DuW8p2S3.js → builder-CChGxW97.js} +74 -5
  10. package/dist/{client-BD0mI7gk.js → client-49mgdebk.js} +2 -2
  11. package/dist/{client-DK4qnXK0.d.ts → client-B0IOer6B.d.ts} +1 -1
  12. package/dist/compat/mod.d.ts +11 -11
  13. package/dist/compat/mod.js +1 -1
  14. package/dist/compat/transformers.test.js +20 -27
  15. package/dist/{context-BhO5LP_t.d.ts → context-BNA3vzcr.d.ts} +273 -60
  16. package/dist/{docloader-DtGccyuM.d.ts → docloader-CLolPVL_.d.ts} +2 -11
  17. package/dist/{docloader-umQd797n.js → docloader-DfooRmPz.js} +26 -13
  18. package/dist/{esm-d-9EVGaP.js → esm-3l5DpT9c.js} +1 -1
  19. package/dist/federation/builder.test.js +30 -16
  20. package/dist/federation/collection.test.js +9 -7
  21. package/dist/federation/handler.test.js +336 -35
  22. package/dist/federation/inbox.test.js +6 -10
  23. package/dist/federation/keycache.test.js +4 -7
  24. package/dist/federation/kv.test.js +8 -6
  25. package/dist/federation/middleware.test.js +58 -35
  26. package/dist/federation/mod.d.ts +11 -11
  27. package/dist/federation/mod.js +11 -11
  28. package/dist/federation/mq.test.js +10 -8
  29. package/dist/federation/retry.test.js +5 -3
  30. package/dist/federation/router.test.js +8 -7
  31. package/dist/federation/send.test.js +15 -21
  32. package/dist/{http-Cp-0z2Ja.d.ts → http-COez3YdK.d.ts} +4 -4
  33. package/dist/{http-CkS9JLmm.js → http-CsGPBDOo.js} +5 -4
  34. package/dist/{http-D59x3pzl.js → http-DyZD6UXI.js} +4 -4
  35. package/dist/{inbox-BjyNe-HL.js → inbox-DVl0Nqfm.js} +1 -3
  36. package/dist/{key-Btkh3AwY.js → key-CNNi5ktf.js} +3 -3
  37. package/dist/{key-jxin-rRq.js → key-CvnCx-As.js} +3 -4
  38. package/dist/{key-Cf8lNopw.js → key-MvqIkRnS.js} +4 -4
  39. package/dist/key-X4-XaJF1.js +10 -0
  40. package/dist/{keycache-BC5bL06g.js → keycache-BZR7b67J.js} +1 -1
  41. package/dist/{keys-Dfntfi5m.js → keys-CFFCiRYU.js} +1 -1
  42. package/dist/{kv-DDdb1hMa.d.ts → kv-BqOK6zss.d.ts} +1 -1
  43. package/dist/{ld-DwoZFwEd.js → ld-BDA3JCwf.js} +2 -4
  44. package/dist/{lookup-CAXRxPZ3.js → lookup-DcB1UuZA.js} +116 -10
  45. package/dist/{lookup-gQIU9tXW.js → lookup-mq8Ba5Kb.js} +2 -3
  46. package/dist/{lookup-m3U6KA0u.d.ts → lookup-tSXYzgYs.d.ts} +1 -7
  47. package/dist/{middleware-BOHju0mN.js → middleware-BKoKlIe8.js} +617 -12
  48. package/dist/middleware-CJiChbvg.js +26 -0
  49. package/dist/middleware-D6H2vPkH.js +17 -0
  50. package/dist/{middleware-cN6r9o1m.js → middleware-XOfMDFVl.js} +556 -25
  51. package/dist/{mod-yPzXIjJX.d.ts → mod-Bf-mThHd.d.ts} +4 -4
  52. package/dist/{mod-BqCBztub.d.ts → mod-C2jQirfr.d.ts} +2 -7
  53. package/dist/{mod-nlVEnYuj.d.ts → mod-CxD6XXBN.d.ts} +5 -5
  54. package/dist/{mod-c1I-Ydch.d.ts → mod-UTC30uNC.d.ts} +2 -2
  55. package/dist/mod.d.ts +14 -14
  56. package/dist/mod.js +11 -11
  57. package/dist/nodeinfo/client.test.js +11 -11
  58. package/dist/nodeinfo/handler.test.js +25 -34
  59. package/dist/nodeinfo/mod.d.ts +3 -3
  60. package/dist/nodeinfo/mod.js +2 -2
  61. package/dist/nodeinfo/semver.test.js +9 -7
  62. package/dist/nodeinfo/types.test.js +10 -8
  63. package/dist/{owner-BK4eWKBp.d.ts → owner-BlxMNrL4.d.ts} +3 -3
  64. package/dist/{owner-BrSLT3By.js → owner-D_-GBbn-.js} +2 -3
  65. package/dist/{proof-u4rhYX_R.js → proof-BnFHVB6H.js} +3 -5
  66. package/dist/{proof-BDYegzwN.js → proof-C94_doNG.js} +4 -4
  67. package/dist/runtime/authdocloader.test.js +14 -20
  68. package/dist/runtime/docloader.test.js +9 -10
  69. package/dist/runtime/key.test.js +10 -15
  70. package/dist/runtime/langstr.test.js +8 -7
  71. package/dist/runtime/mod.d.ts +5 -5
  72. package/dist/runtime/mod.js +6 -6
  73. package/dist/runtime/multibase/multibase.test.js +8 -7
  74. package/dist/runtime/url.test.js +5 -4
  75. package/dist/{send-DRDKgORs.js → send-DcuZAIY1.js} +2 -2
  76. package/dist/sig/http.test.js +36 -19
  77. package/dist/sig/key.test.js +11 -17
  78. package/dist/sig/ld.test.js +10 -16
  79. package/dist/sig/mod.d.ts +7 -7
  80. package/dist/sig/mod.js +6 -6
  81. package/dist/sig/owner.test.js +12 -19
  82. package/dist/sig/proof.test.js +12 -18
  83. package/dist/testing/docloader.test.js +8 -7
  84. package/dist/testing/mod.d.ts +8599 -1
  85. package/dist/testing/mod.js +4 -2
  86. package/dist/testing-C4oxyGxC.js +302 -0
  87. package/dist/{transformers-ghwJuzGY.js → transformers-DJRB0yFF.js} +3 -3
  88. package/dist/{vocab-C4cyrUaT.js → type-CFzYOYUt.js} +5255 -183
  89. package/dist/{types-D1lhruqy.js → types-Cr8o5d6d.js} +1 -1
  90. package/dist/{types-C7C_l-jz.js → types-n7HI7VFr.js} +1 -1
  91. package/dist/vocab/actor.test.js +10 -16
  92. package/dist/vocab/lookup.test.js +11 -86
  93. package/dist/vocab/mod.d.ts +5 -5
  94. package/dist/vocab/mod.js +4 -4
  95. package/dist/vocab/type.test.js +3 -7
  96. package/dist/vocab/vocab.test.js +9 -13
  97. package/dist/{vocab-BaWeqg9y.js → vocab-BwGxoM8R.js} +6 -7
  98. package/dist/{vocab-B52eQhpN.d.ts → vocab-Cyrb7_co.d.ts} +1 -1
  99. package/dist/webfinger/handler.test.js +25 -34
  100. package/dist/webfinger/lookup.test.js +9 -64
  101. package/dist/webfinger/mod.d.ts +3 -3
  102. package/dist/webfinger/mod.js +2 -2
  103. package/dist/x/cfworkers.d.ts +1 -1
  104. package/dist/x/cfworkers.test.js +8 -6
  105. package/dist/x/hono.d.ts +14 -14
  106. package/dist/x/hono.js +2 -2
  107. package/dist/x/sveltekit.d.ts +11 -11
  108. package/dist/x/sveltekit.js +1 -1
  109. package/package.json +1 -1
  110. package/dist/chunk-HsBuZ-b2.js +0 -41
  111. package/dist/context-V7yd31ov.js +0 -108
  112. package/dist/docloader-Bh-sDknx.js +0 -68
  113. package/dist/docloader-D5BOqs-9.js +0 -4514
  114. package/dist/key-DqZKjPjH.js +0 -16
  115. package/dist/langstr-DbWheeIS.js +0 -33
  116. package/dist/lookup-DvfZUKur.js +0 -133
  117. package/dist/middleware-31SyXabg.js +0 -33
  118. package/dist/middleware-CGl-YyTa.js +0 -17
  119. package/dist/multibase-DeCHcK8L.js +0 -316
  120. package/dist/router-D3UybECj.js +0 -118
  121. package/dist/testing-BZ0dJ4qn.js +0 -143
  122. package/dist/type-D2s5lmbZ.js +0 -14
  123. package/dist/url-kTAI6_KP.js +0 -68
  124. /package/dist/{assert_is_error-DQdKoRgb.js → assert_is_error-CeVBLPsZ.js} +0 -0
  125. /package/dist/{assert_not_equals-7pyUM3Ib.js → assert_not_equals-D2R2nl5h.js} +0 -0
  126. /package/dist/{collection-Dfb0TPno.js → collection-D5V3UzU3.js} +0 -0
  127. /package/dist/{denokv-QWKsIqML.js → denokv-DK9P5Jq7.js} +0 -0
  128. /package/dist/{retry-BiIhZWgD.js → retry-BnpVRGFC.js} +0 -0
  129. /package/dist/{semver-DWClQt_5.js → semver-DCqorrj5.js} +0 -0
  130. /package/dist/{std__assert-B3iAixc-.js → std__assert-BQdmxyzF.js} +0 -0
@@ -1,143 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { __require } from "./chunk-HsBuZ-b2.js";
7
- import { configure, getConsoleSink, reset } from "@logtape/logtape";
8
-
9
- //#region testing/mod.ts
10
- const testDefinitions = [];
11
- function test(name, options, fn) {
12
- const def = typeof name === "string" ? typeof options === "function" ? {
13
- name,
14
- fn: options
15
- } : {
16
- name,
17
- ...options,
18
- fn
19
- } : name;
20
- testDefinitions.push(def);
21
- if ("Deno" in globalThis) {
22
- const func = def.fn;
23
- Deno.test({
24
- ...def,
25
- async fn(t) {
26
- const records = [];
27
- await configure({
28
- sinks: {
29
- buffer(record) {
30
- if (record.category.length > 1 && record.category[0] === "logtape" && record.category[1] === "meta") return;
31
- records.push(record);
32
- },
33
- console: getConsoleSink()
34
- },
35
- filters: {},
36
- loggers: [{
37
- category: [],
38
- sinks: [Deno.env.get("LOG") === "always" ? "console" : "buffer"]
39
- }]
40
- });
41
- try {
42
- await func(t);
43
- } catch (e) {
44
- const consoleSink = getConsoleSink();
45
- for (const record of records) consoleSink(record);
46
- throw e;
47
- } finally {
48
- await reset();
49
- }
50
- }
51
- });
52
- } else if ("Bun" in globalThis) {
53
- let failed = void 0;
54
- async function step(defOrNameOrFn, fn$2) {
55
- let def$1;
56
- if (typeof defOrNameOrFn === "string") def$1 = {
57
- name: defOrNameOrFn,
58
- fn: fn$2
59
- };
60
- else if (typeof defOrNameOrFn === "function") def$1 = {
61
- name: defOrNameOrFn.name,
62
- fn: defOrNameOrFn
63
- };
64
- else def$1 = defOrNameOrFn;
65
- if (def$1.ignore) return true;
66
- try {
67
- await def$1.fn({
68
- name: def$1.name,
69
- origin: "",
70
- step
71
- });
72
- } catch (e) {
73
- failed ??= e;
74
- return false;
75
- }
76
- return true;
77
- }
78
- const ctx = {
79
- name: def.name,
80
- origin: "",
81
- step
82
- };
83
- async function fn$1() {
84
- await def.fn(ctx);
85
- if (failed) throw failed;
86
- }
87
- const bunTest = Bun.jest(caller()).test;
88
- if (def.ignore) bunTest.skip(def.name, fn$1);
89
- else if (def.only) bunTest.only(def.name, fn$1);
90
- else bunTest(def.name, fn$1);
91
- } else try {
92
- const { test: nodeTest } = __require("node:test");
93
- nodeTest(def.name, {
94
- only: def.only,
95
- skip: def.ignore
96
- }, async (t) => {
97
- await def.fn(intoDenoTestContext(def.name, t));
98
- });
99
- } catch {}
100
- }
101
- function intoDenoTestContext(name, ctx) {
102
- async function step(defOrNameOrFn, fn) {
103
- let def;
104
- if (typeof defOrNameOrFn === "string") def = {
105
- name: defOrNameOrFn,
106
- fn
107
- };
108
- else if (typeof defOrNameOrFn === "function") def = {
109
- name: defOrNameOrFn.name,
110
- fn: defOrNameOrFn
111
- };
112
- else def = defOrNameOrFn;
113
- let failed = false;
114
- await ctx.test(def.name, async (ctx2) => {
115
- try {
116
- await def.fn(intoDenoTestContext(def.name, ctx2));
117
- } catch (e) {
118
- failed = true;
119
- throw e;
120
- }
121
- });
122
- return failed;
123
- }
124
- const denoCtx = {
125
- name,
126
- origin: ctx.filePath ?? "",
127
- step
128
- };
129
- return denoCtx;
130
- }
131
- /** Retrieve caller test file. */
132
- function caller() {
133
- const Trace = Error;
134
- const _ = Trace.prepareStackTrace;
135
- Trace.prepareStackTrace = (_$1, stack$1) => stack$1;
136
- const { stack } = /* @__PURE__ */ new Error();
137
- Trace.prepareStackTrace = _;
138
- const caller$1 = stack[2];
139
- return caller$1.getFileName().replaceAll("\\", "/");
140
- }
141
-
142
- //#endregion
143
- export { test, testDefinitions };
@@ -1,14 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- //#region vocab/type.ts
7
- function getTypeId(object) {
8
- if (object == null) return object;
9
- const cls = object.constructor;
10
- return cls.typeId;
11
- }
12
-
13
- //#endregion
14
- export { getTypeId };
@@ -1,68 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { lookup } from "node:dns/promises";
7
- import { isIP } from "node:net";
8
-
9
- //#region runtime/url.ts
10
- var UrlError = class extends Error {
11
- constructor(message) {
12
- super(message);
13
- this.name = "UrlError";
14
- }
15
- };
16
- /**
17
- * Validates a URL to prevent SSRF attacks.
18
- */
19
- async function validatePublicUrl(url) {
20
- const parsed = new URL(url);
21
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new UrlError(`Unsupported protocol: ${parsed.protocol}`);
22
- let hostname = parsed.hostname;
23
- if (hostname.startsWith("[") && hostname.endsWith("]")) hostname = hostname.substring(1, hostname.length - 2);
24
- if (hostname === "localhost") throw new UrlError("Localhost is not allowed");
25
- if ("Deno" in globalThis && !isIP(hostname)) {
26
- const netPermission = await Deno.permissions.query({ name: "net" });
27
- if (netPermission.state !== "granted") return;
28
- }
29
- if ("Bun" in globalThis) {
30
- if (hostname === "example.com" || hostname.endsWith(".example.com")) return;
31
- else if (hostname === "fedify-test.internal") throw new UrlError("Invalid or private address: fedify-test.internal");
32
- }
33
- let addresses;
34
- try {
35
- addresses = await lookup(hostname, { all: true });
36
- } catch {
37
- addresses = [];
38
- }
39
- 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}`);
40
- }
41
- function isValidPublicIPv4Address(address) {
42
- const parts = address.split(".");
43
- const first = parseInt(parts[0]);
44
- if (first === 0 || first === 10 || first === 127) return false;
45
- const second = parseInt(parts[1]);
46
- if (first === 169 && second === 254) return false;
47
- if (first === 172 && second >= 16 && second <= 31) return false;
48
- if (first === 192 && second === 168) return false;
49
- return true;
50
- }
51
- function isValidPublicIPv6Address(address) {
52
- address = expandIPv6Address(address);
53
- if (address.at(4) !== ":") return false;
54
- const firstWord = parseInt(address.substring(0, 4), 16);
55
- return !(firstWord >= 64512 && firstWord <= 65023 || firstWord >= 65152 && firstWord <= 65215 || firstWord === 0 || firstWord >= 65280);
56
- }
57
- function expandIPv6Address(address) {
58
- address = address.toLowerCase();
59
- if (address === "::") return "0000:0000:0000:0000:0000:0000:0000:0000";
60
- if (address.startsWith("::")) address = "0000" + address;
61
- if (address.endsWith("::")) address = address + "0000";
62
- address = address.replace("::", ":0000".repeat(8 - (address.match(/:/g) || []).length) + ":");
63
- const parts = address.split(":");
64
- return parts.map((part) => part.padStart(4, "0")).join(":");
65
- }
66
-
67
- //#endregion
68
- export { UrlError, expandIPv6Address, isValidPublicIPv4Address, isValidPublicIPv6Address, validatePublicUrl };
File without changes
File without changes
File without changes