@fedify/fedify 2.3.0-dev.994 → 2.3.0-pr.809.36

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 (138) hide show
  1. package/README.md +16 -7
  2. package/dist/{assert-DikXweDx.mjs → assert-OguE97r2.mjs} +1 -1
  3. package/dist/{assert_instance_of-C4Ri6VuN.mjs → assert_instance_of-DBC5X09g.mjs} +1 -1
  4. package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-DkVK8oqV.mjs} +1 -1
  5. package/dist/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-DN60FHPX.mjs} +28 -3
  6. package/dist/{assert_strict_equals-Dmjbg-bA.mjs → assert_strict_equals-XEgZAlrj.mjs} +1 -1
  7. package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-BOkhLGYc.mjs} +1 -1
  8. package/dist/{builder-yAlpiIqP.mjs → builder-DSZ7FZmg.mjs} +96 -42
  9. package/dist/{chunk-nlSIicah.js → chunk-CRNNMoPX.js} +2 -2
  10. package/dist/circuit-breaker-CSWsyoef.mjs +337 -0
  11. package/dist/{client-z-8dc-e1.d.cts → client-CAM_bQXx.d.cts} +1 -0
  12. package/dist/{client-AtlibPOU.d.ts → client-CSddvgWN.d.ts} +1 -2
  13. package/dist/compat/mod.d.cts +2 -1
  14. package/dist/compat/mod.d.ts +2 -3
  15. package/dist/compat/mod.js +3 -3
  16. package/dist/compat/outgoing-jsonld.test.mjs +4 -4
  17. package/dist/compat/public-audience.test.mjs +4 -4
  18. package/dist/compat/transformers.test.mjs +5 -5
  19. package/dist/{context-BzH2-ajs.d.ts → context-BBVLF7lx.d.cts} +342 -269
  20. package/dist/{context-DJGagtNd.d.cts → context-BU6jSQdo.d.ts} +344 -266
  21. package/dist/{context-Dk_tacqz.mjs → context-DVoTs_wM.mjs} +64 -5
  22. package/dist/{deno-XBVlKnOX.mjs → deno-DCdM7d93.mjs} +1 -1
  23. package/dist/{docloader-DPp-X6gk.mjs → docloader-B7mVwA5_.mjs} +4 -4
  24. package/dist/{esm-DVILvP5e.mjs → esm-vrlUxr60.mjs} +4 -7
  25. package/dist/federation/builder.test.mjs +163 -11
  26. package/dist/federation/circuit-breaker.test.d.mts +2 -0
  27. package/dist/federation/circuit-breaker.test.mjs +446 -0
  28. package/dist/federation/collection.test.mjs +3 -3
  29. package/dist/federation/handler.test.mjs +1770 -29
  30. package/dist/federation/idempotency.test.mjs +5 -5
  31. package/dist/federation/inbox.test.mjs +4 -4
  32. package/dist/federation/keycache.test.mjs +5 -5
  33. package/dist/federation/kv.test.mjs +2 -2
  34. package/dist/federation/metrics.test.d.mts +2 -0
  35. package/dist/federation/metrics.test.mjs +634 -0
  36. package/dist/federation/middleware.test.mjs +4036 -146
  37. package/dist/federation/mod.cjs +195 -14
  38. package/dist/federation/mod.d.cts +6 -4
  39. package/dist/federation/mod.d.ts +6 -6
  40. package/dist/federation/mod.js +192 -14
  41. package/dist/federation/mq.test.mjs +176 -15
  42. package/dist/federation/negotiation.test.mjs +4 -4
  43. package/dist/federation/retry.test.mjs +3 -3
  44. package/dist/federation/router.test.mjs +190 -9
  45. package/dist/federation/send.test.mjs +153 -15
  46. package/dist/federation/temporal.test.d.mts +2 -0
  47. package/dist/federation/temporal.test.mjs +71 -0
  48. package/dist/federation/webfinger.test.mjs +150 -5
  49. package/dist/{http-CSlLA54v.mjs → http-BufbkLuW.mjs} +146 -47
  50. package/dist/{http-B4rrzxtg.js → http-Dh18nwJg.js} +994 -64
  51. package/dist/{http-aQzN9Ayi.d.ts → http-VyDTd4G3.d.cts} +15 -3
  52. package/dist/{http-BrGqJDXL.cjs → http-gOiudB3g.cjs} +1099 -61
  53. package/dist/{http-CrGuipxe.d.cts → http-lf8Hsd91.d.ts} +15 -1
  54. package/dist/{key-Bzx--sHD.mjs → key-DZdKLJXT.mjs} +43 -18
  55. package/dist/{kv-CbLNp3zQ.d.cts → kv-D6hNiMTK.d.ts} +1 -0
  56. package/dist/{kv-cache-DI-Sk7-I.cjs → kv-cache-BuK_nlpY.cjs} +20 -3
  57. package/dist/{kv-cache-U__xU4qR.mjs → kv-cache-C7SQnkGI.mjs} +21 -3
  58. package/dist/{kv-cache-EMIqoIuB.js → kv-cache-DNDSb6Po.js} +20 -3
  59. package/dist/{kv-GFYnFoOl.d.ts → kv-gJ8LYbxX.d.cts} +1 -3
  60. package/dist/ld-0Lsznacf.mjs +626 -0
  61. package/dist/metrics-BHeWd24f.mjs +815 -0
  62. package/dist/{middleware-zjZ6AFCW.mjs → middleware-BNANvDh2.mjs} +1 -1
  63. package/dist/{middleware-nidH7VZH.js → middleware-BgzRkDcm.js} +2260 -556
  64. package/dist/{middleware-An4DjES4.cjs → middleware-D-iES1nQ.cjs} +2318 -623
  65. package/dist/{middleware-K1g6bEkV.mjs → middleware-EV6J_eAc.mjs} +1639 -373
  66. package/dist/{mod-CR8soWa9.d.ts → mod-B0hW12_O.d.cts} +26 -4
  67. package/dist/mod-C0F6kvgS.d.cts +182 -0
  68. package/dist/{mod-Cr3f-ACa.d.cts → mod-COIAjwRS.d.ts} +26 -2
  69. package/dist/{mod-CMEbIaNh.d.cts → mod-DFvNJcNb.d.ts} +56 -4
  70. package/dist/mod-vPYVoa5n.d.ts +182 -0
  71. package/dist/{mod-CLgIXe9w.d.ts → mod-yvIXFAEi.d.cts} +56 -6
  72. package/dist/mod.cjs +9 -6
  73. package/dist/mod.d.cts +12 -10
  74. package/dist/mod.d.ts +12 -12
  75. package/dist/mod.js +11 -11
  76. package/dist/mq-D-nlpY04.d.ts +208 -0
  77. package/dist/mq-D8uSFzxe.d.cts +208 -0
  78. package/dist/{negotiation-SQvQgUqe.mjs → negotiation-DDstyBvc.mjs} +29 -0
  79. package/dist/nodeinfo/client.test.mjs +4 -4
  80. package/dist/nodeinfo/handler.test.mjs +4 -4
  81. package/dist/nodeinfo/mod.d.cts +2 -1
  82. package/dist/nodeinfo/mod.d.ts +2 -3
  83. package/dist/nodeinfo/mod.js +3 -3
  84. package/dist/nodeinfo/types.test.mjs +3 -3
  85. package/dist/otel/exporter.test.mjs +28 -25
  86. package/dist/otel/mod.cjs +6 -5
  87. package/dist/otel/mod.d.cts +5 -3
  88. package/dist/otel/mod.d.ts +5 -5
  89. package/dist/otel/mod.js +8 -7
  90. package/dist/{outgoing-jsonld-CNmZLixq.mjs → outgoing-jsonld-L_DbOaFe.mjs} +2 -2
  91. package/dist/{owner-C-tqfvxn.mjs → owner-Cl-1cAR8.mjs} +2 -2
  92. package/dist/{owner-CptqhsOy.d.cts → owner-CnngXDNJ.d.ts} +2 -1
  93. package/dist/{owner-74ARJ5TL.d.ts → owner-DEvZuyOE.d.cts} +2 -3
  94. package/dist/{proof-Bbbwf8_x.js → proof-CyXndf6-.js} +378 -15
  95. package/dist/{proof-BlmRPzrK.mjs → proof-Dnz8jtiQ.mjs} +26 -8
  96. package/dist/{proof-BW89QMVB.cjs → proof-tz35unOj.cjs} +432 -15
  97. package/dist/runtime/mod.d.cts +1 -0
  98. package/dist/runtime/mod.d.ts +1 -2
  99. package/dist/runtime/mod.js +3 -3
  100. package/dist/{send-05pJLcb6.mjs → send-DIbBYN5P.mjs} +72 -26
  101. package/dist/sig/http.test.mjs +356 -33
  102. package/dist/sig/key.test.mjs +103 -6
  103. package/dist/sig/ld.test.mjs +696 -7
  104. package/dist/sig/mod.cjs +2 -2
  105. package/dist/sig/mod.d.cts +4 -3
  106. package/dist/sig/mod.d.ts +4 -5
  107. package/dist/sig/mod.js +4 -4
  108. package/dist/sig/owner.test.mjs +6 -6
  109. package/dist/sig/proof.test.mjs +169 -8
  110. package/dist/{std__assert-CRDpx_HF.mjs → std__assert-BBjXFNOb.mjs} +5 -30
  111. package/dist/temporal-BEwob1Vg.mjs +95 -0
  112. package/dist/testing/mod.d.mts +110 -10
  113. package/dist/testing/mod.mjs +1 -2
  114. package/dist/{transformers-ve6e2xcg.js → transformers-BGMIq1cs.js} +2 -2
  115. package/dist/{types-hvL8ElAs.js → types-CAY3OdLq.js} +2 -2
  116. package/dist/utils/docloader.test.mjs +6 -6
  117. package/dist/utils/kv-cache.test.mjs +67 -2
  118. package/dist/utils/mod.cjs +1 -1
  119. package/dist/utils/mod.d.cts +2 -1
  120. package/dist/utils/mod.d.ts +2 -3
  121. package/dist/utils/mod.js +3 -3
  122. package/dist/vocab/cjs.test.mjs +1 -1
  123. package/dist/vocab/mod.d.cts +1 -0
  124. package/dist/vocab/mod.d.ts +1 -2
  125. package/dist/vocab/mod.js +2 -2
  126. package/package.json +16 -16
  127. package/dist/ld-DR78beiv.mjs +0 -279
  128. package/dist/middleware-BFBaR0mF.cjs +0 -4
  129. package/dist/mod-2d12ffz3.d.ts +0 -64
  130. package/dist/mod-D35TRn09.d.cts +0 -62
  131. package/dist/router-CrMLXoOr.mjs +0 -114
  132. package/dist/{activity-listener-ell7W1s9.mjs → activity-listener-tztVvlNb.mjs} +0 -0
  133. package/dist/{assert_equals-Ew3jOFa3.mjs → assert_equals-C-ZRDbaf.mjs} +0 -0
  134. package/dist/{client-D_1QpnWt.mjs → client-ByXmQhYD.mjs} +1 -1
  135. package/dist/{collection-D-HqUuA2.mjs → collection-Cc3DVAhE.mjs} +0 -0
  136. package/dist/{keycache-EGATflN-.mjs → keycache-BeU0LCII.mjs} +0 -0
  137. package/dist/{public-audience-DYFHzm_c.mjs → public-audience-Cvbr2Gzt.mjs} +1 -1
  138. /package/dist/{retry-bMXBL97A.mjs → retry-CXg_MBI-.mjs} +0 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![npm][npm badge]][npm]
8
8
  [![GitHub Actions][GitHub Actions badge]][GitHub Actions]
9
9
  [![Matrix][Matrix badge]][Matrix]
10
- [![Follow @fedify@hollo.social][@fedify@hollo.social badge]][@fedify@hollo.social]
10
+ [![@fedify@hollo.social][@fedify@hollo.social badge]][@fedify@hollo.social]
11
11
 
12
12
  > [!NOTE]
13
13
  > Looking for a quick demo? Here it is: [Fedify Demo] on Deno Playground.
@@ -36,9 +36,12 @@ If you want to know more about the project, please take a look at the following
36
36
  resources:
37
37
 
38
38
  - [Installation]
39
- - Tutorials:
40
- [Learning the basics] &
41
- [Creating a microblog]
39
+ - Tutorials
40
+ - [Learning the basics of Fedify]
41
+ - [Creating your own federated microblog]
42
+ - [Creating a federated image sharing service]
43
+ - [Building a federated blog]
44
+ - [Building a threadiverse community platform]
42
45
  - [Migrating from other libraries]
43
46
  - [API reference][JSR]
44
47
  - [Examples]
@@ -58,7 +61,7 @@ in the fediverse!
58
61
  [GitHub Actions]: https://github.com/fedify-dev/fedify/actions/workflows/build.yaml
59
62
  [Matrix badge]: https://img.shields.io/matrix/fedify%3Amatrix.org?logo=matrix
60
63
  [Matrix]: https://matrix.to/#/#fedify:matrix.org
61
- [@fedify@hollo.social badge]: https://fedi-badge.deno.dev/@fedify@hollo.social/followers.svg
64
+ [@fedify@hollo.social badge]: https://fedi-badge.minhee.org/@fedify@hollo.social/followers.svg
62
65
  [@fedify@hollo.social]: https://hollo.social/@fedify
63
66
  [Fedify Demo]: https://dash.deno.com/playground/fedify-demo
64
67
  [ActivityPub]: https://www.w3.org/TR/activitypub/
@@ -71,8 +74,11 @@ in the fediverse!
71
74
  [Linked Data Signatures]: https://web.archive.org/web/20170923124140/https://w3c-dvcg.github.io/ld-signatures/
72
75
  [NodeInfo]: https://nodeinfo.diaspora.software/
73
76
  [Installation]: https://fedify.dev/install
74
- [Learning the basics]: https://fedify.dev/tutorial/basics
75
- [Creating a microblog]: https://fedify.dev/tutorial/microblog
77
+ [Learning the basics of Fedify]: https://fedify.dev/tutorial/basics
78
+ [Creating your own federated microblog]: https://fedify.dev/tutorial/microblog
79
+ [Creating a federated image sharing service]: https://fedify.dev/tutorial/content-sharing
80
+ [Building a federated blog]: https://fedify.dev/tutorial/astro-blog
81
+ [Building a threadiverse community platform]: https://fedify.dev/tutorial/threadiverse
76
82
  [Migrating from other libraries]: https://fedify.dev/manual/migrate
77
83
  [Examples]: https://github.com/fedify-dev/fedify/tree/main/examples
78
84
  [GitHub Discussions]: https://github.com/fedify-dev/fedify/discussions
@@ -123,6 +129,7 @@ Here is the list of packages:
123
129
  | [@fedify/sqlite](/packages/sqlite/) | [JSR][jsr:@fedify/sqlite] | [npm][npm:@fedify/sqlite] | SQLite driver |
124
130
  | [@fedify/sveltekit](/packages/sveltekit/) | [JSR][jsr:@fedify/sveltekit] | [npm][npm:@fedify/sveltekit] | SvelteKit integration |
125
131
  | [@fedify/testing](/packages/testing/) | [JSR][jsr:@fedify/testing] | [npm][npm:@fedify/testing] | Testing utilities |
132
+ | [@fedify/uri-template](/packages/uri-template/) | [JSR][jsr:@fedify/uri-template] | [npm][npm:@fedify/uri-template] | RFC 6570 URI Template library |
126
133
  | [@fedify/vocab](/packages/vocab/) | [JSR][jsr:@fedify/vocab] | [npm][npm:@fedify/vocab] | Activity Vocabulary library |
127
134
  | [@fedify/vocab-runtime](/packages/vocab-runtime/) | [JSR][jsr:@fedify/vocab-runtime] | [npm][npm:@fedify/vocab-runtime] | Runtime library for code-generated vocab |
128
135
  | [@fedify/vocab-tools](/packages/vocab-tools/) | [JSR][jsr:@fedify/vocab-tools] | [npm][npm:@fedify/vocab-tools] | Code generation tools for Activity Vocab |
@@ -176,6 +183,8 @@ Here is the list of packages:
176
183
  [npm:@fedify/sveltekit]: https://www.npmjs.com/package/@fedify/sveltekit
177
184
  [jsr:@fedify/testing]: https://jsr.io/@fedify/testing
178
185
  [npm:@fedify/testing]: https://www.npmjs.com/package/@fedify/testing
186
+ [jsr:@fedify/uri-template]: https://jsr.io/@fedify/uri-template
187
+ [npm:@fedify/uri-template]: https://www.npmjs.com/package/@fedify/uri-template
179
188
  [jsr:@fedify/vocab]: https://jsr.io/@fedify/vocab
180
189
  [npm:@fedify/vocab]: https://www.npmjs.com/package/@fedify/vocab
181
190
  [jsr:@fedify/vocab-runtime]: https://jsr.io/@fedify/vocab-runtime
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { l as AssertionError } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert.js
6
6
  /**
7
7
  * Make an assertion, error will be thrown if `expr` does not have truthy value.
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { l as AssertionError } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_instance_of.js
6
6
  /**
7
7
  * Make an assertion that `obj` is an instance of `type`.
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as equal, l as AssertionError } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { c as equal, l as AssertionError } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_not_equals.js
6
6
  /**
7
7
  * Make an assertion that `actual` and `expected` are not equal, deeply.
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError } from "./assert_equals-Ew3jOFa3.mjs";
5
- import { n as assertIsError } from "./assert_throws-4NwKEy2q.mjs";
4
+ import { l as AssertionError, s as format } from "./assert_equals-C-ZRDbaf.mjs";
5
+ import { n as assertIsError } from "./assert_throws-BOkhLGYc.mjs";
6
6
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_false.js
7
7
  /**
8
8
  * Make an assertion, error will be thrown if `expr` have truthy value.
@@ -21,6 +21,31 @@ import { n as assertIsError } from "./assert_throws-4NwKEy2q.mjs";
21
21
  if (expr) throw new AssertionError(msg);
22
22
  }
23
23
  //#endregion
24
+ //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater_or_equal.js
25
+ /**
26
+ * Make an assertion that `actual` is greater than or equal to `expected`.
27
+ * If not then throw.
28
+ *
29
+ * @example Usage
30
+ * ```ts no-eval
31
+ * import { assertGreaterOrEqual } from "@std/assert/assert-greater-or-equal";
32
+ *
33
+ * assertGreaterOrEqual(2, 1); // Doesn't throw
34
+ * assertGreaterOrEqual(1, 1); // Doesn't throw
35
+ * assertGreaterOrEqual(0, 1); // Throws
36
+ * ```
37
+ *
38
+ * @typeParam T The type of the values to compare.
39
+ * @param actual The actual value to compare.
40
+ * @param expected The expected value to compare.
41
+ * @param msg The optional message to display if the assertion fails.
42
+ */ function assertGreaterOrEqual(actual, expected, msg) {
43
+ if (actual >= expected) return;
44
+ const actualString = format(actual);
45
+ const expectedString = format(expected);
46
+ throw new AssertionError(msg ?? `Expect ${actualString} >= ${expectedString}`);
47
+ }
48
+ //#endregion
24
49
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_rejects.js
25
50
  async function assertRejects(fn, errorClassOrMsg, msgIncludesOrMsg, msg) {
26
51
  let ErrorClass = void 0;
@@ -54,4 +79,4 @@ async function assertRejects(fn, errorClassOrMsg, msgIncludesOrMsg, msg) {
54
79
  return err;
55
80
  }
56
81
  //#endregion
57
- export { assertFalse as n, assertRejects as t };
82
+ export { assertGreaterOrEqual as n, assertFalse as r, assertRejects as t };
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { a as red, i as buildMessage, l as AssertionError, n as diffStr, r as diff, s as format } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { a as red, i as buildMessage, l as AssertionError, n as diffStr, r as diff, s as format } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_strict_equals.js
6
6
  /**
7
7
  * Make an assertion that `actual` and `expected` are equal using
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError, o as stripAnsiCode } from "./assert_equals-Ew3jOFa3.mjs";
4
+ import { l as AssertionError, o as stripAnsiCode } from "./assert_equals-C-ZRDbaf.mjs";
5
5
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_is_error.js
6
6
  /**
7
7
  * Make an assertion that `error` is an `Error`.
@@ -1,24 +1,39 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as RouterError, t as Router } from "./router-CrMLXoOr.mjs";
5
- import { n as version, t as name } from "./deno-XBVlKnOX.mjs";
6
- import { t as ActivityListenerSet } from "./activity-listener-ell7W1s9.mjs";
4
+ import { n as version, t as name } from "./deno-DCdM7d93.mjs";
5
+ import { t as ActivityListenerSet } from "./activity-listener-tztVvlNb.mjs";
6
+ import { getLogger } from "@logtape/logtape";
7
+ import { Router, RouterError, assertPath } from "@fedify/uri-template";
7
8
  import { Tombstone, getTypeId } from "@fedify/vocab";
8
9
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
- import { getLogger } from "@logtape/logtape";
10
10
  //#region src/federation/builder.ts
11
- function validateSingleIdentifierVariablePath(path, errorMessage) {
12
- const operatorMatches = globalThis.Array.from(path.matchAll(/{([+#./;?&]?)([A-Za-z_][A-Za-z0-9_]*)}/g));
13
- if (operatorMatches.length !== 1 || operatorMatches[0]?.[2] !== "identifier") throw new RouterError(errorMessage);
14
- if (operatorMatches.some((match) => [
15
- "?",
16
- "&",
17
- "#"
18
- ].includes(match[1]) && match[2] === "identifier")) throw new RouterError(errorMessage);
19
- const variables = new Router().add(path, "outbox");
20
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError(errorMessage);
21
- }
11
+ const ACTOR_ALIAS_PREFIX = "actorAlias:";
12
+ /**
13
+ * Route options shared by every dispatcher whose path must expose exactly
14
+ * one `{identifier}` variable bound to a single, non-empty value
15
+ * for `setOutboxDispatcher/Listener()`.
16
+ */
17
+ const identifierSingular = {
18
+ exact: true,
19
+ variables: { identifier: { operatables: [""] } }
20
+ };
21
+ /**
22
+ * Route options shared by every dispatcher whose path must expose
23
+ * `{identifier}` and `{+identifier}` variables bound to the same single,
24
+ * non-empty value for following setters:
25
+ * - `setActorDispatcher()` (actor path)
26
+ * - `setInboxDispatcher/Listener()` (inbox path)
27
+ * - `setFollowingDispatcher()` (following path)
28
+ * - `setFollowersDispatcher()` (followers path)
29
+ * - `setLikedDispatcher()` (liked path)
30
+ * - `setFeaturedDispatcher()` (featured path)
31
+ * - `setFeaturedTagsDispatcher()` (featured tags path)
32
+ */
33
+ const identifierSingularAllowPlus = {
34
+ exact: true,
35
+ variables: { identifier: { operatables: ["", "+"] } }
36
+ };
22
37
  var FederationBuilderImpl = class {
23
38
  router;
24
39
  actorCallbacks;
@@ -57,8 +72,15 @@ var FederationBuilderImpl = class {
57
72
  this.collectionCallbacks = {};
58
73
  this.collectionTypeIds = {};
59
74
  }
75
+ /**
76
+ * Builds the federation object.
77
+ * @param options Parameters for initializing the federation object.
78
+ * @returns The federation object.
79
+ * @throws {TypeError} If benchmark mode and `meterProvider` are both
80
+ * specified.
81
+ */
60
82
  async build(options) {
61
- const { FederationImpl } = await import("./middleware-zjZ6AFCW.mjs");
83
+ const { FederationImpl } = await import("./middleware-BNANvDh2.mjs");
62
84
  const f = new FederationImpl(options);
63
85
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
64
86
  f.router = this.router.clone();
@@ -94,8 +116,8 @@ var FederationBuilderImpl = class {
94
116
  }
95
117
  setActorDispatcher(path, dispatcher) {
96
118
  if (this.router.has("actor")) throw new RouterError("Actor dispatcher already set.");
97
- const variables = this.router.add(path, "actor");
98
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for actor dispatcher must have one variable: {identifier}");
119
+ assertPath(path);
120
+ this.router.add(path, "actor", identifierSingularAllowPlus);
99
121
  const callbacks = { dispatcher: async (context, identifier) => {
100
122
  const actor = await this._getTracer().startActiveSpan("activitypub.dispatch_actor", {
101
123
  kind: SpanKind.SERVER,
@@ -194,6 +216,15 @@ var FederationBuilderImpl = class {
194
216
  callbacks.aliasMapper = mapper;
195
217
  return setters;
196
218
  },
219
+ mapActorAlias: (path, identifier) => {
220
+ if (identifier === "") throw new RouterError("Identifier cannot be empty.");
221
+ if (this.router.has(`actorAlias:${identifier}`)) throw new RouterError(`Actor alias for "${identifier}" already set.`);
222
+ if (Router.variables(path).size > 0) throw new RouterError("Path for actor alias must have no variables.");
223
+ const existingRoute = this.router.route(path);
224
+ if (existingRoute != null) throw new RouterError(`Actor alias path "${path}" conflicts with existing route "${existingRoute.name}".`);
225
+ this.router.add(path, `${ACTOR_ALIAS_PREFIX}${identifier}`);
226
+ return setters;
227
+ },
197
228
  authorize(predicate) {
198
229
  callbacks.authorizePredicate = predicate;
199
230
  return setters;
@@ -203,17 +234,25 @@ var FederationBuilderImpl = class {
203
234
  }
204
235
  setNodeInfoDispatcher(path, dispatcher) {
205
236
  if (this.router.has("nodeInfo")) throw new RouterError("NodeInfo dispatcher already set.");
206
- if (this.router.add(path, "nodeInfo").size !== 0) throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
237
+ if (Router.variables(path).size !== 0) throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
238
+ this.router.add(path, "nodeInfo");
207
239
  this.nodeInfoDispatcher = dispatcher;
208
240
  }
209
241
  setWebFingerLinksDispatcher(dispatcher) {
210
242
  this.webFingerLinksDispatcher = dispatcher;
211
243
  }
244
+ /**
245
+ * The RFC 6570 template-literal `path` overloads were removed for
246
+ * type-checking efficiency, so the URI variable types can no longer be
247
+ * inferred from `path` (now typed as a plain `string`); to use them, specify
248
+ * the variable name through the `TParam` generic argument.
249
+ */
212
250
  setObjectDispatcher(cls, path, dispatcher) {
213
251
  const routeName = `object:${cls.typeId.href}`;
214
252
  if (this.router.has(routeName)) throw new RouterError(`Object dispatcher for ${cls.name} already set.`);
215
- const variables = this.router.add(path, routeName);
216
- if (variables.size < 1) throw new RouterError("Path for object dispatcher must have at least one variable.");
253
+ assertPath(path);
254
+ const variables = Router.variables(path);
255
+ this.router.add(path, routeName);
217
256
  const callbacks = {
218
257
  dispatcher: (ctx, values) => {
219
258
  return this._getTracer().startActiveSpan("activitypub.dispatch_object", {
@@ -255,8 +294,8 @@ var FederationBuilderImpl = class {
255
294
  if (this.router.has("inbox")) {
256
295
  if (this.inboxPath !== path) throw new RouterError("Inbox dispatcher path must match inbox listener path.");
257
296
  } else {
258
- const variables = this.router.add(path, "inbox");
259
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for inbox dispatcher must have one variable: {identifier}");
297
+ assertPath(path);
298
+ this.router.add(path, "inbox", identifierSingularAllowPlus);
260
299
  this.inboxPath = path;
261
300
  }
262
301
  const callbacks = { dispatcher };
@@ -286,8 +325,8 @@ var FederationBuilderImpl = class {
286
325
  if (this.router.has("outbox")) {
287
326
  if (this.outboxPath !== path) throw new RouterError("Outbox dispatcher path must match outbox listener path.");
288
327
  } else {
289
- validateSingleIdentifierVariablePath(path, "Path for outbox dispatcher must have one variable: {identifier}");
290
- this.router.add(path, "outbox");
328
+ assertPath(path);
329
+ this.router.add(path, "outbox", identifierSingular);
291
330
  this.outboxPath = path;
292
331
  }
293
332
  const callbacks = { dispatcher };
@@ -317,8 +356,8 @@ var FederationBuilderImpl = class {
317
356
  if (this.router.has("outbox")) {
318
357
  if (this.outboxPath !== outboxPath) throw new RouterError("Outbox listener path must match outbox dispatcher path.");
319
358
  } else {
320
- validateSingleIdentifierVariablePath(outboxPath, "Path for outbox must have one variable: {identifier}");
321
- this.router.add(outboxPath, "outbox");
359
+ assertPath(outboxPath);
360
+ this.router.add(outboxPath, "outbox", identifierSingular);
322
361
  this.outboxPath = outboxPath;
323
362
  }
324
363
  const listeners = this.outboxListeners = new ActivityListenerSet();
@@ -340,8 +379,8 @@ var FederationBuilderImpl = class {
340
379
  }
341
380
  setFollowingDispatcher(path, dispatcher) {
342
381
  if (this.router.has("following")) throw new RouterError("Following collection dispatcher already set.");
343
- const variables = this.router.add(path, "following");
344
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for following collection dispatcher must have one variable: {identifier}");
382
+ assertPath(path);
383
+ this.router.add(path, "following", identifierSingularAllowPlus);
345
384
  const callbacks = { dispatcher };
346
385
  this.followingCallbacks = callbacks;
347
386
  const setters = {
@@ -366,8 +405,8 @@ var FederationBuilderImpl = class {
366
405
  }
367
406
  setFollowersDispatcher(path, dispatcher) {
368
407
  if (this.router.has("followers")) throw new RouterError("Followers collection dispatcher already set.");
369
- const variables = this.router.add(path, "followers");
370
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for followers collection dispatcher must have one variable: {identifier}");
408
+ assertPath(path);
409
+ this.router.add(path, "followers", identifierSingularAllowPlus);
371
410
  const callbacks = { dispatcher };
372
411
  this.followersCallbacks = callbacks;
373
412
  const setters = {
@@ -392,8 +431,8 @@ var FederationBuilderImpl = class {
392
431
  }
393
432
  setLikedDispatcher(path, dispatcher) {
394
433
  if (this.router.has("liked")) throw new RouterError("Liked collection dispatcher already set.");
395
- const variables = this.router.add(path, "liked");
396
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for liked collection dispatcher must have one variable: {identifier}");
434
+ assertPath(path);
435
+ this.router.add(path, "liked", identifierSingularAllowPlus);
397
436
  const callbacks = { dispatcher };
398
437
  this.likedCallbacks = callbacks;
399
438
  const setters = {
@@ -418,8 +457,8 @@ var FederationBuilderImpl = class {
418
457
  }
419
458
  setFeaturedDispatcher(path, dispatcher) {
420
459
  if (this.router.has("featured")) throw new RouterError("Featured collection dispatcher already set.");
421
- const variables = this.router.add(path, "featured");
422
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for featured collection dispatcher must have one variable: {identifier}");
460
+ assertPath(path);
461
+ this.router.add(path, "featured", identifierSingularAllowPlus);
423
462
  const callbacks = { dispatcher };
424
463
  this.featuredCallbacks = callbacks;
425
464
  const setters = {
@@ -444,8 +483,8 @@ var FederationBuilderImpl = class {
444
483
  }
445
484
  setFeaturedTagsDispatcher(path, dispatcher) {
446
485
  if (this.router.has("featuredTags")) throw new RouterError("Featured tags collection dispatcher already set.");
447
- const variables = this.router.add(path, "featuredTags");
448
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for featured tags collection dispatcher must have one variable: {identifier}");
486
+ assertPath(path);
487
+ this.router.add(path, "featuredTags", identifierSingularAllowPlus);
449
488
  const callbacks = { dispatcher };
450
489
  this.featuredTagsCallbacks = callbacks;
451
490
  const setters = {
@@ -473,12 +512,13 @@ var FederationBuilderImpl = class {
473
512
  if (this.router.has("inbox")) {
474
513
  if (this.inboxPath !== inboxPath) throw new RouterError("Inbox listener path must match inbox dispatcher path.");
475
514
  } else {
476
- const variables = this.router.add(inboxPath, "inbox");
477
- if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for inbox must have one variable: {identifier}");
515
+ assertPath(inboxPath);
516
+ this.router.add(inboxPath, "inbox", identifierSingularAllowPlus);
478
517
  this.inboxPath = inboxPath;
479
518
  }
480
519
  if (sharedInboxPath != null) {
481
- if (this.router.add(sharedInboxPath, "sharedInbox").size !== 0) throw new RouterError("Path for shared inbox must have no variables.");
520
+ if (Router.variables(sharedInboxPath).size !== 0) throw new RouterError("Path for shared inbox must have no variables.");
521
+ this.router.add(sharedInboxPath, "sharedInbox");
482
522
  }
483
523
  const listeners = this.inboxListeners = new ActivityListenerSet();
484
524
  const setters = {
@@ -505,9 +545,21 @@ var FederationBuilderImpl = class {
505
545
  };
506
546
  return setters;
507
547
  }
548
+ /**
549
+ * The RFC 6570 template-literal `path` overloads were removed for
550
+ * type-checking efficiency, so the URI variable types can no longer be
551
+ * inferred from `path` (now typed as a plain `string`); to use them, specify
552
+ * the variable name through the `TParam` generic argument.
553
+ */
508
554
  setCollectionDispatcher(name, itemType, path, dispatcher) {
509
555
  return this.#setCustomCollectionDispatcher(name, "collection", itemType, path, dispatcher);
510
556
  }
557
+ /**
558
+ * The RFC 6570 template-literal `path` overloads were removed for
559
+ * type-checking efficiency, so the URI variable types can no longer be
560
+ * inferred from `path` (now typed as a plain `string`); to use them, specify
561
+ * the variable name through the `TParam` generic argument.
562
+ */
511
563
  setOrderedCollectionDispatcher(name, itemType, path, dispatcher) {
512
564
  return this.#setCustomCollectionDispatcher(name, "orderedCollection", itemType, path, dispatcher);
513
565
  }
@@ -516,7 +568,9 @@ var FederationBuilderImpl = class {
516
568
  const routeName = `${collectionType}:${this.#uniqueCollectionId(name)}`;
517
569
  if (this.router.has(routeName)) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
518
570
  if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${strName} already set.`);
519
- if (this.router.add(path, routeName).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
571
+ assertPath(path);
572
+ if (Router.variables(path).size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
573
+ this.router.add(path, routeName);
520
574
  const callbacks = { dispatcher };
521
575
  this.collectionCallbacks[name] = callbacks;
522
576
  this.collectionTypeIds[name] = itemType;
@@ -578,4 +632,4 @@ function createFederationBuilder() {
578
632
  return new FederationBuilderImpl();
579
633
  }
580
634
  //#endregion
581
- export { createFederationBuilder as n, FederationBuilderImpl as t };
635
+ export { FederationBuilderImpl as n, createFederationBuilder as r, ACTOR_ALIAS_PREFIX as t };
@@ -1,5 +1,5 @@
1
- import "@js-temporal/polyfill";
2
- import "urlpattern-polyfill";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
3
  //#region \0rolldown/runtime.js
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;