@fedify/fedify 2.0.0-dev.1593 → 2.0.0-dev.1604

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 (99) hide show
  1. package/dist/{actor-DNwcqwPT.js → actor-BC3XtGTj.js} +187 -187
  2. package/dist/{actor-Bj1Vq2XG.js → actor-CmRlosMl.js} +1 -1
  3. package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-7UF4R_Qs.js} +1 -1
  4. package/dist/{assert_throws-BOO88avQ.js → assert_throws-53_pKeP3.js} +1 -1
  5. package/dist/{authdocloader-DJtdyVPc.js → authdocloader-CzpPQC01.js} +3 -3
  6. package/dist/{authdocloader-qkvj_KZY.js → authdocloader-D-DICGXT.js} +3 -3
  7. package/dist/{builder-BgzJcrpt.js → builder-D9zidAqR.js} +4 -4
  8. package/dist/{client-CpxFv8ft.js → client-Bsj0vQPr.js} +3 -22
  9. package/dist/{client-DF8anIB5.d.ts → client-bgSdkFa2.d.ts} +2 -74
  10. package/dist/compat/mod.d.ts +3 -3
  11. package/dist/compat/transformers.test.js +19 -20
  12. package/dist/{context-9gCpIkiz.d.ts → context-CDSZdQHD.d.ts} +1 -1
  13. package/dist/{docloader-9_osWaaH.js → docloader-CkASOfZ5.js} +1 -1
  14. package/dist/{esm-5nsZYnVB.js → esm-CXF1VoeR.js} +1 -1
  15. package/dist/federation/builder.test.js +11 -12
  16. package/dist/federation/collection.test.js +9 -9
  17. package/dist/federation/handler.test.js +25 -26
  18. package/dist/federation/inbox.test.js +6 -6
  19. package/dist/federation/keycache.test.js +4 -4
  20. package/dist/federation/kv.test.js +8 -8
  21. package/dist/federation/middleware.test.js +29 -44
  22. package/dist/federation/mod.d.ts +2 -2
  23. package/dist/federation/mod.js +10 -10
  24. package/dist/federation/mq.test.js +10 -10
  25. package/dist/federation/retry.test.js +5 -5
  26. package/dist/federation/router.test.js +8 -8
  27. package/dist/federation/send.test.js +15 -15
  28. package/dist/{http-BqklewFY.js → http-B_pxY5of.js} +3 -3
  29. package/dist/{http-CQulyTuw.js → http-CSYNybkH.js} +2 -2
  30. package/dist/{inbox-B97Wrppe.js → inbox-DoJlwIE4.js} +1 -1
  31. package/dist/{key-D-s3dQbK.js → key-BOzqiGbl.js} +2 -2
  32. package/dist/{key-CNCeen0u.js → key-Bif4eMj7.js} +2 -2
  33. package/dist/{key-3jGPh5To.js → key-BteSu1lX.js} +4 -4
  34. package/dist/{key-C3CEOTh7.js → key-DWWqeyaq.js} +3 -3
  35. package/dist/{keycache-Br0-hsD5.js → keycache--NYDYifd.js} +1 -1
  36. package/dist/{keys-DSk2aqlj.js → keys-MacD9GP6.js} +1 -1
  37. package/dist/{ld-CYUQO1l4.js → ld-D9oTBLrs.js} +2 -2
  38. package/dist/{lookup-BNFlahf3.js → lookup-Cz9VSYxw.js} +1 -1
  39. package/dist/{lookup-CnJK1NUl.js → lookup-DuzrBbTj.js} +1 -1
  40. package/dist/{middleware-tfSiCl9w.js → middleware-C0w2M0tb.js} +10 -10
  41. package/dist/middleware-CNfiKLIZ.js +25 -0
  42. package/dist/{middleware-CovCqg8w.js → middleware-CgNm3XOJ.js} +16 -16
  43. package/dist/middleware-CnvU63kV.js +17 -0
  44. package/dist/{mod-Bqxcp7eN.d.ts → mod-RI3-KvUI.d.ts} +1 -1
  45. package/dist/mod.d.ts +4 -4
  46. package/dist/mod.js +11 -11
  47. package/dist/nodeinfo/client.test.js +32 -111
  48. package/dist/nodeinfo/handler.test.js +25 -26
  49. package/dist/nodeinfo/mod.d.ts +2 -2
  50. package/dist/nodeinfo/mod.js +3 -3
  51. package/dist/nodeinfo/types.test.js +10 -15
  52. package/dist/{owner-CBeUJR68.js → owner-gB-pDKA-.js} +2 -2
  53. package/dist/{proof-CHQnDg0z.js → proof-CScVkkIT.js} +2 -2
  54. package/dist/{proof-D436ezTT.js → proof-VPikK_0V.js} +3 -3
  55. package/dist/runtime/authdocloader.test.js +14 -14
  56. package/dist/runtime/docloader.test.js +9 -9
  57. package/dist/runtime/key.test.js +10 -10
  58. package/dist/runtime/langstr.test.js +8 -8
  59. package/dist/runtime/mod.js +6 -6
  60. package/dist/runtime/multibase/multibase.test.js +8 -8
  61. package/dist/runtime/url.test.js +5 -5
  62. package/dist/{send-Bc0QdRlp.js → send-flZ7H10-.js} +2 -2
  63. package/dist/sig/http.test.js +13 -13
  64. package/dist/sig/key.test.js +11 -11
  65. package/dist/sig/ld.test.js +10 -10
  66. package/dist/sig/mod.js +6 -6
  67. package/dist/sig/owner.test.js +12 -12
  68. package/dist/sig/proof.test.js +12 -12
  69. package/dist/testing/docloader.test.js +8 -8
  70. package/dist/testing/mod.d.ts +1 -28
  71. package/dist/testing/mod.js +3 -3
  72. package/dist/{testing-D4xRiVJV.js → testing-CdBSI4xF.js} +2 -2
  73. package/dist/{type-qs0mWLTm.js → type-CAteiET0.js} +186 -186
  74. package/dist/{types-BIgY6c-l.js → types-BSuWJsOm.js} +1 -3
  75. package/dist/{types-RbpvCErq.js → types-Vo0qKhN7.js} +5 -166
  76. package/dist/vocab/actor.test.js +10 -10
  77. package/dist/vocab/lookup.test.js +9 -9
  78. package/dist/vocab/mod.js +4 -4
  79. package/dist/vocab/type.test.js +3 -3
  80. package/dist/vocab/vocab.test.js +9 -9
  81. package/dist/{vocab-r-I1_ZmK.js → vocab-89qErSc9.js} +3 -3
  82. package/dist/webfinger/handler.test.js +24 -25
  83. package/dist/webfinger/lookup.test.js +9 -9
  84. package/dist/webfinger/mod.js +2 -2
  85. package/dist/x/cfworkers.test.js +8 -8
  86. package/dist/x/hono.d.ts +2 -2
  87. package/dist/x/sveltekit.d.ts +2 -2
  88. package/package.json +1 -1
  89. package/dist/middleware-CJbNYdw9.js +0 -17
  90. package/dist/middleware-zDdNBo-m.js +0 -26
  91. package/dist/nodeinfo/semver.test.d.ts +0 -3
  92. package/dist/nodeinfo/semver.test.js +0 -143
  93. package/dist/semver-dArNLkR9.js +0 -149
  94. /package/dist/{assert_is_error-BPGph1Jx.js → assert_is_error-B035L3om.js} +0 -0
  95. /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
  96. /package/dist/{collection-CSzG2j1P.js → collection-CcnIw1qY.js} +0 -0
  97. /package/dist/{denokv-Bv33Xxea.js → denokv-jZ0Z2h0M.js} +0 -0
  98. /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
  99. /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.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 "../type-qs0mWLTm.js";
7
- import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
- import "../assert-MZs1qjMx.js";
9
- import "../assert_instance_of-DHz7EHNU.js";
10
- import { formatSemVer, parseSemVer } from "../semver-dArNLkR9.js";
11
- import "../lookup-CnJK1NUl.js";
12
- import { test } from "../testing-D4xRiVJV.js";
13
- import "../std__assert-X-_kMxKM.js";
14
- import "../assert_rejects-DiIiJbZn.js";
15
- import "../assert_is_error-BPGph1Jx.js";
16
- import "../assert_not_equals-f3m3epl3.js";
17
- import { assertThrows } from "../assert_throws-BOO88avQ.js";
18
-
19
- //#region src/nodeinfo/semver.test.ts
20
- test("parseSemVer() handles major", async (t) => {
21
- const versions = [
22
- ["1.2.3", 1],
23
- [" 1.2.3 ", 1],
24
- [" 2.2.3-4 ", 2],
25
- [" 3.2.3-pre ", 3],
26
- ["v5.2.3", 5],
27
- [" v8.2.3 ", 8],
28
- [" 13.2.3", 13]
29
- ];
30
- for (const [v, expected] of versions) await t.step(v, () => {
31
- const version = parseSemVer(v);
32
- assertEquals(version.major, expected);
33
- });
34
- });
35
- test("parseSemVer() handles minor", async (t) => {
36
- const versions = [
37
- ["1.1.3", 1],
38
- [" 1.1.3 ", 1],
39
- [" 1.2.3-4 ", 2],
40
- [" 1.3.3-pre ", 3],
41
- ["v1.5.3", 5],
42
- [" v1.8.3 ", 8],
43
- [" 1.13.3", 13]
44
- ];
45
- for (const [v, expected] of versions) await t.step(v, () => {
46
- const version = parseSemVer(v);
47
- assertEquals(version.minor, expected);
48
- });
49
- });
50
- test("parseSemVer() handles patch", async (t) => {
51
- const versions = [
52
- ["1.2.1", 1],
53
- [" 1.2.1 ", 1],
54
- [" 1.2.2-4 ", 2],
55
- [" 1.2.3-pre ", 3],
56
- ["v1.2.5", 5],
57
- [" v1.2.8 ", 8],
58
- [" 1.2.13", 13]
59
- ];
60
- for (const [v, expected] of versions) await t.step(v, () => {
61
- const semver = parseSemVer(v);
62
- const actual = semver.patch;
63
- assertEquals(actual, expected);
64
- });
65
- });
66
- test("parseSemVer() handles prerelease", async (t) => {
67
- const versions = [
68
- ["1.2.2-alpha.1", ["alpha", 1]],
69
- ["0.6.1-1", [1]],
70
- ["1.0.0-beta.2", ["beta", 2]],
71
- ["v0.5.4-pre", ["pre"]],
72
- ["1.2.2-alpha.1", ["alpha", 1]],
73
- ["1.2.0-1b3-4", ["1b3-4"]],
74
- ["1.2.0-3.6-pre2", [3, "6-pre2"]],
75
- ["2.0.0", []]
76
- ];
77
- for (const [v, expected] of versions) await t.step(`${v} : ${JSON.stringify(expected)}`, () => {
78
- const semver = parseSemVer(v);
79
- assertEquals(semver.prerelease, expected);
80
- });
81
- });
82
- test({
83
- name: "parseSemVer() throws on bad versions",
84
- fn: async (t) => {
85
- const versions = [
86
- ["1.2." + new Array(256).join("1")],
87
- ["1.2." + new Array(100).join("1")],
88
- [null],
89
- [void 0],
90
- [{}],
91
- [[]],
92
- [false],
93
- [true],
94
- [0],
95
- [""],
96
- ["not a version"],
97
- ["∞.∞.∞"],
98
- ["NaN.NaN.NaN"]
99
- ];
100
- for (const [v] of versions) await t.step(`${JSON.stringify(v)}`, () => {
101
- assertThrows(() => parseSemVer(v));
102
- });
103
- }
104
- });
105
- test("parseSemVer() throws on invalid versions", async (t) => {
106
- const versions = [
107
- "1.2.3.4",
108
- "NOT VALID",
109
- 1.2,
110
- null,
111
- "Infinity.NaN.Infinity"
112
- ];
113
- for (const v of versions) await t.step(`invalid ${v}`, () => {
114
- assertThrows(function() {
115
- parseSemVer(v);
116
- }, TypeError);
117
- });
118
- });
119
- test("parseSemVer() handles big numeric prerelease", function() {
120
- const r = parseSemVer(`1.2.3-beta.${Number.MAX_SAFE_INTEGER}0`);
121
- assertEquals(r.prerelease, ["beta", "90071992547409910"]);
122
- });
123
- test("formatSemVer()", async (t) => {
124
- const versions = [
125
- ["0.0.0", "0.0.0"],
126
- ["1.2.3", "1.2.3"],
127
- ["1.2.3-pre", "1.2.3-pre"],
128
- ["1.2.3-pre.0", "1.2.3-pre.0"],
129
- ["1.2.3+b", "1.2.3+b"],
130
- ["1.2.3+b.0", "1.2.3+b.0"],
131
- ["1.2.3-pre.0+b.0", "1.2.3-pre.0+b.0"]
132
- ];
133
- for (const [version, expected] of versions) await t.step({
134
- name: version,
135
- fn: () => {
136
- const v = parseSemVer(version);
137
- const actual = formatSemVer(v);
138
- assertEquals(actual, expected);
139
- }
140
- });
141
- });
142
-
143
- //#endregion
@@ -1,149 +0,0 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- //#region src/nodeinfo/semver.ts
7
- const MAX_LENGTH = 256;
8
- /**
9
- * A single `0`, or a non-zero digit followed by zero or more digits.
10
- */
11
- const NUMERIC_IDENTIFIER = "0|[1-9]\\d*";
12
- /**
13
- * Zero or more digits, followed by a letter or hyphen, and then zero or more letters, digits, or hyphens.
14
- */
15
- const NON_NUMERIC_IDENTIFIER = "\\d*[a-zA-Z-][a-zA-Z0-9-]*";
16
- /**
17
- * Three dot-separated numeric identifiers.
18
- */
19
- const VERSION_CORE = `(?<major>${NUMERIC_IDENTIFIER})\\.(?<minor>${NUMERIC_IDENTIFIER})\\.(?<patch>${NUMERIC_IDENTIFIER})`;
20
- /**
21
- * A numeric identifier, or a non-numeric identifier.
22
- */
23
- const PRERELEASE_IDENTIFIER = `(?:${NUMERIC_IDENTIFIER}|${NON_NUMERIC_IDENTIFIER})`;
24
- /**
25
- * A hyphen, followed by one or more dot-separated pre-release version identifiers.
26
- * @example "-pre.release"
27
- */
28
- const PRERELEASE = `(?:-(?<prerelease>${PRERELEASE_IDENTIFIER}(?:\\.${PRERELEASE_IDENTIFIER})*))`;
29
- /**
30
- * Any combination of digits, letters, or hyphens.
31
- */
32
- const BUILD_IDENTIFIER = "[0-9A-Za-z-]+";
33
- /**
34
- * A plus sign, followed by one or more period-separated build metadata identifiers.
35
- * @example "+build.meta"
36
- */
37
- const BUILD = `(?:\\+(?<buildmetadata>${BUILD_IDENTIFIER}(?:\\.${BUILD_IDENTIFIER})*))`;
38
- /**
39
- * A version, followed optionally by a pre-release version and build metadata.
40
- */
41
- const FULL_VERSION = `v?${VERSION_CORE}${PRERELEASE}?${BUILD}?`;
42
- const FULL_REGEXP = /* @__PURE__ */ new RegExp(`^${FULL_VERSION}$`);
43
- /**
44
- * Attempt to parse a string as a semantic version, returning a SemVer object.
45
- *
46
- * @example Usage
47
- * ```ts
48
- * import { parseSemVer } from "@fedify/fedify/nodeinfo";
49
- * import { assertEquals } from "@std/assert";
50
- *
51
- * const version = parseSemVer("1.2.3");
52
- * assertEquals(version, {
53
- * major: 1,
54
- * minor: 2,
55
- * patch: 3,
56
- * prerelease: [],
57
- * build: [],
58
- * });
59
- * ```
60
- *
61
- * @throws {TypeError} If the input string is invalid.
62
- * @param value The version string to parse
63
- * @returns A valid SemVer
64
- * @since 1.2.0
65
- */
66
- function parseSemVer(value) {
67
- if (typeof value !== "string") throw new TypeError(`Cannot parse version as version must be a string: received ${typeof value}`);
68
- if (value.length > MAX_LENGTH) throw new TypeError(`Cannot parse version as version length is too long: length is ${value.length}, max length is ${MAX_LENGTH}`);
69
- value = value.trim();
70
- const groups = value.match(FULL_REGEXP)?.groups;
71
- if (!groups) throw new TypeError(`Cannot parse version: ${value}`);
72
- const major = parseNumber(groups.major, `Cannot parse version ${value}: invalid major version`);
73
- const minor = parseNumber(groups.minor, `Cannot parse version ${value}: invalid minor version`);
74
- const patch = parseNumber(groups.patch, `Cannot parse version ${value}: invalid patch version`);
75
- const prerelease = groups.prerelease ? parsePrerelease(groups.prerelease) : [];
76
- const build = groups.buildmetadata ? parseBuild(groups.buildmetadata) : [];
77
- return {
78
- major,
79
- minor,
80
- patch,
81
- prerelease,
82
- build
83
- };
84
- }
85
- /**
86
- * Returns true if the value is a valid SemVer number.
87
- *
88
- * Must be a number. Must not be NaN. Can be positive or negative infinity.
89
- * Can be between 0 and MAX_SAFE_INTEGER.
90
- * @param value The value to check
91
- * @returns True if its a valid semver number
92
- */
93
- function isValidNumber(value) {
94
- return typeof value === "number" && !Number.isNaN(value) && (!Number.isFinite(value) || 0 <= value && value <= Number.MAX_SAFE_INTEGER);
95
- }
96
- const NUMERIC_IDENTIFIER_REGEXP = /* @__PURE__ */ new RegExp(`^${NUMERIC_IDENTIFIER}$`);
97
- function parsePrerelease(prerelease) {
98
- return prerelease.split(".").filter(Boolean).map((id) => {
99
- if (NUMERIC_IDENTIFIER_REGEXP.test(id)) {
100
- const number = Number(id);
101
- if (isValidNumber(number)) return number;
102
- }
103
- return id;
104
- });
105
- }
106
- function parseBuild(buildmetadata) {
107
- return buildmetadata.split(".").filter(Boolean);
108
- }
109
- function parseNumber(input, errorMessage) {
110
- const number = Number(input);
111
- if (!isValidNumber(number)) throw new TypeError(errorMessage);
112
- return number;
113
- }
114
- function formatNumber(value) {
115
- return value.toFixed(0);
116
- }
117
- /**
118
- * Format a SemVer object into a string.
119
- *
120
- * @example Usage
121
- * ```ts
122
- * import { formatSemVer } from "@fedify/fedify/nodeinfo";
123
- * import { assertEquals } from "@std/assert";
124
- *
125
- * const semver = {
126
- * major: 1,
127
- * minor: 2,
128
- * patch: 3,
129
- * };
130
- * assertEquals(formatSemVer(semver), "1.2.3");
131
- * ```
132
- *
133
- * @param version The SemVer to format
134
- * @returns The string representation of a semantic version.
135
- * @since 1.2.0
136
- */
137
- function formatSemVer(version) {
138
- const major = formatNumber(version.major);
139
- const minor = formatNumber(version.minor);
140
- const patch = formatNumber(version.patch);
141
- const pre = version.prerelease?.join(".") ?? "";
142
- const build = version.build?.join(".") ?? "";
143
- const primary = `${major}.${minor}.${patch}`;
144
- const release = [primary, pre].filter((v) => v).join("-");
145
- return [release, build].filter((v) => v).join("+");
146
- }
147
-
148
- //#endregion
149
- export { formatSemVer, parseSemVer };
File without changes
File without changes