@fedify/fedify 0.5.0-dev.88

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.

Potentially problematic release.


This version of @fedify/fedify might be problematic. Click here for more details.

Files changed (496) hide show
  1. package/CHANGES.md +239 -0
  2. package/LICENSE +661 -0
  3. package/README.md +96 -0
  4. package/esm/_dnt.shims.d.ts +11 -0
  5. package/esm/_dnt.shims.d.ts.map +1 -0
  6. package/esm/_dnt.shims.js +67 -0
  7. package/esm/_dnt.test_polyfills.d.ts.map +1 -0
  8. package/esm/_dnt.test_shims.d.ts.map +1 -0
  9. package/esm/codegen/fs.d.ts.map +1 -0
  10. package/esm/codegen/schema.d.ts.map +1 -0
  11. package/esm/codegen/schema.yaml +194 -0
  12. package/esm/codegen/type.d.ts.map +1 -0
  13. package/esm/deps/crux.land/api/get/2KNRVU.d.ts.map +1 -0
  14. package/esm/deps/deno.land/x/mock_fetch@0.3.0/mod.d.ts.map +1 -0
  15. package/esm/deps/jsr.io/@david/which-runtime/0.2.0/mod.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/mod.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/collections.d.ts.map +1 -0
  18. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/concat.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/drop.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/filter.d.ts.map +1 -0
  21. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/fold.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/infinite.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/map.d.ts.map +1 -0
  24. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/mod.d.ts.map +1 -0
  25. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/range.d.ts.map +1 -0
  26. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/take.d.ts.map +1 -0
  27. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/tee.d.ts.map +1 -0
  28. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/testing.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/unique.d.ts.map +1 -0
  30. package/esm/deps/jsr.io/@std/assert/0.220.1/_constants.d.ts.map +1 -0
  31. package/esm/deps/jsr.io/@std/assert/0.220.1/_diff.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@std/assert/0.220.1/_format.d.ts.map +1 -0
  33. package/esm/deps/jsr.io/@std/assert/0.220.1/assert.d.ts.map +1 -0
  34. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_almost_equals.d.ts.map +1 -0
  35. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_array_includes.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_equals.d.ts.map +1 -0
  37. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_exists.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_false.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_greater.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_greater_or_equal.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_instance_of.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_is_error.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_less.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_less_or_equal.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_match.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_equals.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_instance_of.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_match.d.ts.map +1 -0
  49. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_strict_equals.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_object_match.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_rejects.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_strict_equals.d.ts.map +1 -0
  53. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_string_includes.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@std/assert/0.220.1/assert_throws.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@std/assert/0.220.1/assertion_error.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/assert/0.220.1/equal.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@std/assert/0.220.1/fail.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@std/assert/0.220.1/mod.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@std/assert/0.220.1/unimplemented.d.ts.map +1 -0
  60. package/esm/deps/jsr.io/@std/assert/0.220.1/unreachable.d.ts.map +1 -0
  61. package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.d.ts +14 -0
  62. package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.d.ts.map +1 -0
  63. package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.js +27 -0
  64. package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.d.ts +28 -0
  65. package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.js +37 -0
  67. package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.d.ts +14 -0
  68. package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.d.ts.map +1 -0
  69. package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.js +23 -0
  70. package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.d.ts +6 -0
  71. package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.js +44 -0
  73. package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.d.ts +17 -0
  74. package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.d.ts.map +1 -0
  75. package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.js +21 -0
  76. package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.d.ts +18 -0
  77. package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.d.ts.map +1 -0
  78. package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.js +45 -0
  79. package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.d.ts +18 -0
  80. package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.d.ts.map +1 -0
  81. package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.js +45 -0
  82. package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.d.ts +24 -0
  83. package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.d.ts.map +1 -0
  84. package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.js +25 -0
  85. package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.d.ts +15 -0
  86. package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.d.ts.map +1 -0
  87. package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.js +33 -0
  88. package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.d.ts +14 -0
  89. package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.d.ts.map +1 -0
  90. package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.js +21 -0
  91. package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.d.ts +2 -0
  92. package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.d.ts.map +1 -0
  93. package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.js +26 -0
  94. package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.d.ts +27 -0
  95. package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.d.ts.map +1 -0
  96. package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.js +141 -0
  97. package/esm/deps/jsr.io/@std/fmt/0.220.1/colors.d.ts.map +1 -0
  98. package/esm/deps/jsr.io/@std/fs/0.220.1/_get_file_info_type.d.ts.map +1 -0
  99. package/esm/deps/jsr.io/@std/fs/0.220.1/_to_path_string.d.ts.map +1 -0
  100. package/esm/deps/jsr.io/@std/fs/0.220.1/ensure_dir.d.ts.map +1 -0
  101. package/esm/deps/jsr.io/@std/fs/0.220.1/ensure_file.d.ts.map +1 -0
  102. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.d.ts +38 -0
  103. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.d.ts.map +1 -0
  104. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.js +40 -0
  105. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.d.ts +34 -0
  106. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.d.ts.map +1 -0
  107. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.js +121 -0
  108. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.d.ts +31 -0
  109. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.d.ts.map +1 -0
  110. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.js +113 -0
  111. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.d.ts +31 -0
  112. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.d.ts.map +1 -0
  113. package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.js +140 -0
  114. package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.d.ts +128 -0
  115. package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.d.ts.map +1 -0
  116. package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.js +37 -0
  117. package/esm/deps/jsr.io/@std/path/0.220.1/_common/assert_path.d.ts.map +1 -0
  118. package/esm/deps/jsr.io/@std/path/0.220.1/_common/basename.d.ts.map +1 -0
  119. package/esm/deps/jsr.io/@std/path/0.220.1/_common/common.d.ts.map +1 -0
  120. package/esm/deps/jsr.io/@std/path/0.220.1/_common/constants.d.ts.map +1 -0
  121. package/esm/deps/jsr.io/@std/path/0.220.1/_common/dirname.d.ts.map +1 -0
  122. package/esm/deps/jsr.io/@std/path/0.220.1/_common/format.d.ts.map +1 -0
  123. package/esm/deps/jsr.io/@std/path/0.220.1/_common/from_file_url.d.ts.map +1 -0
  124. package/esm/deps/jsr.io/@std/path/0.220.1/_common/glob_to_reg_exp.d.ts.map +1 -0
  125. package/esm/deps/jsr.io/@std/path/0.220.1/_common/normalize.d.ts.map +1 -0
  126. package/esm/deps/jsr.io/@std/path/0.220.1/_common/normalize_string.d.ts.map +1 -0
  127. package/esm/deps/jsr.io/@std/path/0.220.1/_common/relative.d.ts.map +1 -0
  128. package/esm/deps/jsr.io/@std/path/0.220.1/_common/strip_trailing_separators.d.ts.map +1 -0
  129. package/esm/deps/jsr.io/@std/path/0.220.1/_common/to_file_url.d.ts.map +1 -0
  130. package/esm/deps/jsr.io/@std/path/0.220.1/_interface.d.ts.map +1 -0
  131. package/esm/deps/jsr.io/@std/path/0.220.1/_os.d.ts.map +1 -0
  132. package/esm/deps/jsr.io/@std/path/0.220.1/basename.d.ts.map +1 -0
  133. package/esm/deps/jsr.io/@std/path/0.220.1/common.d.ts.map +1 -0
  134. package/esm/deps/jsr.io/@std/path/0.220.1/constants.d.ts.map +1 -0
  135. package/esm/deps/jsr.io/@std/path/0.220.1/dirname.d.ts.map +1 -0
  136. package/esm/deps/jsr.io/@std/path/0.220.1/extname.d.ts.map +1 -0
  137. package/esm/deps/jsr.io/@std/path/0.220.1/format.d.ts.map +1 -0
  138. package/esm/deps/jsr.io/@std/path/0.220.1/from_file_url.d.ts.map +1 -0
  139. package/esm/deps/jsr.io/@std/path/0.220.1/glob_to_regexp.d.ts.map +1 -0
  140. package/esm/deps/jsr.io/@std/path/0.220.1/is_absolute.d.ts.map +1 -0
  141. package/esm/deps/jsr.io/@std/path/0.220.1/is_glob.d.ts.map +1 -0
  142. package/esm/deps/jsr.io/@std/path/0.220.1/join.d.ts.map +1 -0
  143. package/esm/deps/jsr.io/@std/path/0.220.1/join_globs.d.ts.map +1 -0
  144. package/esm/deps/jsr.io/@std/path/0.220.1/mod.d.ts.map +1 -0
  145. package/esm/deps/jsr.io/@std/path/0.220.1/normalize.d.ts.map +1 -0
  146. package/esm/deps/jsr.io/@std/path/0.220.1/normalize_glob.d.ts.map +1 -0
  147. package/esm/deps/jsr.io/@std/path/0.220.1/parse.d.ts.map +1 -0
  148. package/esm/deps/jsr.io/@std/path/0.220.1/posix/_util.d.ts.map +1 -0
  149. package/esm/deps/jsr.io/@std/path/0.220.1/posix/basename.d.ts.map +1 -0
  150. package/esm/deps/jsr.io/@std/path/0.220.1/posix/common.d.ts.map +1 -0
  151. package/esm/deps/jsr.io/@std/path/0.220.1/posix/constants.d.ts.map +1 -0
  152. package/esm/deps/jsr.io/@std/path/0.220.1/posix/dirname.d.ts.map +1 -0
  153. package/esm/deps/jsr.io/@std/path/0.220.1/posix/extname.d.ts.map +1 -0
  154. package/esm/deps/jsr.io/@std/path/0.220.1/posix/format.d.ts.map +1 -0
  155. package/esm/deps/jsr.io/@std/path/0.220.1/posix/from_file_url.d.ts.map +1 -0
  156. package/esm/deps/jsr.io/@std/path/0.220.1/posix/glob_to_regexp.d.ts.map +1 -0
  157. package/esm/deps/jsr.io/@std/path/0.220.1/posix/is_absolute.d.ts.map +1 -0
  158. package/esm/deps/jsr.io/@std/path/0.220.1/posix/is_glob.d.ts.map +1 -0
  159. package/esm/deps/jsr.io/@std/path/0.220.1/posix/join.d.ts.map +1 -0
  160. package/esm/deps/jsr.io/@std/path/0.220.1/posix/join_globs.d.ts.map +1 -0
  161. package/esm/deps/jsr.io/@std/path/0.220.1/posix/mod.d.ts.map +1 -0
  162. package/esm/deps/jsr.io/@std/path/0.220.1/posix/normalize.d.ts.map +1 -0
  163. package/esm/deps/jsr.io/@std/path/0.220.1/posix/normalize_glob.d.ts.map +1 -0
  164. package/esm/deps/jsr.io/@std/path/0.220.1/posix/parse.d.ts.map +1 -0
  165. package/esm/deps/jsr.io/@std/path/0.220.1/posix/relative.d.ts.map +1 -0
  166. package/esm/deps/jsr.io/@std/path/0.220.1/posix/resolve.d.ts.map +1 -0
  167. package/esm/deps/jsr.io/@std/path/0.220.1/posix/to_file_url.d.ts.map +1 -0
  168. package/esm/deps/jsr.io/@std/path/0.220.1/posix/to_namespaced_path.d.ts.map +1 -0
  169. package/esm/deps/jsr.io/@std/path/0.220.1/relative.d.ts.map +1 -0
  170. package/esm/deps/jsr.io/@std/path/0.220.1/resolve.d.ts.map +1 -0
  171. package/esm/deps/jsr.io/@std/path/0.220.1/to_file_url.d.ts.map +1 -0
  172. package/esm/deps/jsr.io/@std/path/0.220.1/to_namespaced_path.d.ts.map +1 -0
  173. package/esm/deps/jsr.io/@std/path/0.220.1/windows/_util.d.ts.map +1 -0
  174. package/esm/deps/jsr.io/@std/path/0.220.1/windows/basename.d.ts.map +1 -0
  175. package/esm/deps/jsr.io/@std/path/0.220.1/windows/common.d.ts.map +1 -0
  176. package/esm/deps/jsr.io/@std/path/0.220.1/windows/constants.d.ts.map +1 -0
  177. package/esm/deps/jsr.io/@std/path/0.220.1/windows/dirname.d.ts.map +1 -0
  178. package/esm/deps/jsr.io/@std/path/0.220.1/windows/extname.d.ts.map +1 -0
  179. package/esm/deps/jsr.io/@std/path/0.220.1/windows/format.d.ts.map +1 -0
  180. package/esm/deps/jsr.io/@std/path/0.220.1/windows/from_file_url.d.ts.map +1 -0
  181. package/esm/deps/jsr.io/@std/path/0.220.1/windows/glob_to_regexp.d.ts.map +1 -0
  182. package/esm/deps/jsr.io/@std/path/0.220.1/windows/is_absolute.d.ts.map +1 -0
  183. package/esm/deps/jsr.io/@std/path/0.220.1/windows/is_glob.d.ts.map +1 -0
  184. package/esm/deps/jsr.io/@std/path/0.220.1/windows/join.d.ts.map +1 -0
  185. package/esm/deps/jsr.io/@std/path/0.220.1/windows/join_globs.d.ts.map +1 -0
  186. package/esm/deps/jsr.io/@std/path/0.220.1/windows/mod.d.ts.map +1 -0
  187. package/esm/deps/jsr.io/@std/path/0.220.1/windows/normalize.d.ts.map +1 -0
  188. package/esm/deps/jsr.io/@std/path/0.220.1/windows/normalize_glob.d.ts.map +1 -0
  189. package/esm/deps/jsr.io/@std/path/0.220.1/windows/parse.d.ts.map +1 -0
  190. package/esm/deps/jsr.io/@std/path/0.220.1/windows/relative.d.ts.map +1 -0
  191. package/esm/deps/jsr.io/@std/path/0.220.1/windows/resolve.d.ts.map +1 -0
  192. package/esm/deps/jsr.io/@std/path/0.220.1/windows/to_file_url.d.ts.map +1 -0
  193. package/esm/deps/jsr.io/@std/path/0.220.1/windows/to_namespaced_path.d.ts.map +1 -0
  194. package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.d.ts +2 -0
  195. package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.d.ts.map +1 -0
  196. package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.js +10 -0
  197. package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.d.ts +44 -0
  198. package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.d.ts.map +1 -0
  199. package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.js +161 -0
  200. package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.d.ts +2 -0
  201. package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.d.ts.map +1 -0
  202. package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.js +14 -0
  203. package/esm/deps/jsr.io/@std/semver/0.220.1/compare.d.ts +11 -0
  204. package/esm/deps/jsr.io/@std/semver/0.220.1/compare.d.ts.map +1 -0
  205. package/esm/deps/jsr.io/@std/semver/0.220.1/compare.js +18 -0
  206. package/esm/deps/jsr.io/@std/semver/0.220.1/constants.d.ts +43 -0
  207. package/esm/deps/jsr.io/@std/semver/0.220.1/constants.d.ts.map +1 -0
  208. package/esm/deps/jsr.io/@std/semver/0.220.1/constants.js +73 -0
  209. package/esm/deps/jsr.io/@std/semver/0.220.1/difference.d.ts +6 -0
  210. package/esm/deps/jsr.io/@std/semver/0.220.1/difference.d.ts.map +1 -0
  211. package/esm/deps/jsr.io/@std/semver/0.220.1/difference.js +16 -0
  212. package/esm/deps/jsr.io/@std/semver/0.220.1/equals.d.ts +8 -0
  213. package/esm/deps/jsr.io/@std/semver/0.220.1/equals.d.ts.map +1 -0
  214. package/esm/deps/jsr.io/@std/semver/0.220.1/equals.js +10 -0
  215. package/esm/deps/jsr.io/@std/semver/0.220.1/format.d.ts +13 -0
  216. package/esm/deps/jsr.io/@std/semver/0.220.1/format.d.ts.map +1 -0
  217. package/esm/deps/jsr.io/@std/semver/0.220.1/format.js +36 -0
  218. package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.d.ts +9 -0
  219. package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.d.ts.map +1 -0
  220. package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.js +16 -0
  221. package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.d.ts +8 -0
  222. package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.d.ts.map +1 -0
  223. package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.js +9 -0
  224. package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.d.ts +8 -0
  225. package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.d.ts.map +1 -0
  226. package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.js +10 -0
  227. package/esm/deps/jsr.io/@std/semver/0.220.1/increment.d.ts +29 -0
  228. package/esm/deps/jsr.io/@std/semver/0.220.1/increment.d.ts.map +1 -0
  229. package/esm/deps/jsr.io/@std/semver/0.220.1/increment.js +160 -0
  230. package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.d.ts +13 -0
  231. package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.d.ts.map +1 -0
  232. package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.js +28 -0
  233. package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.d.ts +18 -0
  234. package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.d.ts.map +1 -0
  235. package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.js +38 -0
  236. package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.d.ts +8 -0
  237. package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.d.ts.map +1 -0
  238. package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.js +9 -0
  239. package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.d.ts +8 -0
  240. package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.d.ts.map +1 -0
  241. package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.js +9 -0
  242. package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.d.ts +10 -0
  243. package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.d.ts.map +1 -0
  244. package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.js +18 -0
  245. package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.d.ts +10 -0
  246. package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.d.ts.map +1 -0
  247. package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.js +18 -0
  248. package/esm/deps/jsr.io/@std/semver/0.220.1/mod.d.ts +291 -0
  249. package/esm/deps/jsr.io/@std/semver/0.220.1/mod.d.ts.map +1 -0
  250. package/esm/deps/jsr.io/@std/semver/0.220.1/mod.js +293 -0
  251. package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.d.ts +8 -0
  252. package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.d.ts.map +1 -0
  253. package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.js +9 -0
  254. package/esm/deps/jsr.io/@std/semver/0.220.1/parse.d.ts +9 -0
  255. package/esm/deps/jsr.io/@std/semver/0.220.1/parse.d.ts.map +1 -0
  256. package/esm/deps/jsr.io/@std/semver/0.220.1/parse.js +34 -0
  257. package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.d.ts +8 -0
  258. package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.d.ts.map +1 -0
  259. package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.js +336 -0
  260. package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.d.ts +9 -0
  261. package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.d.ts.map +1 -0
  262. package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.js +72 -0
  263. package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.d.ts +8 -0
  264. package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.d.ts.map +1 -0
  265. package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.js +58 -0
  266. package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.d.ts +8 -0
  267. package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.d.ts.map +1 -0
  268. package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.js +49 -0
  269. package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.d.ts +9 -0
  270. package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.d.ts.map +1 -0
  271. package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.js +69 -0
  272. package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.d.ts +8 -0
  273. package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.d.ts.map +1 -0
  274. package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.js +17 -0
  275. package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.d.ts +8 -0
  276. package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.d.ts.map +1 -0
  277. package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.js +17 -0
  278. package/esm/deps/jsr.io/@std/semver/0.220.1/types.d.ts +38 -0
  279. package/esm/deps/jsr.io/@std/semver/0.220.1/types.d.ts.map +1 -0
  280. package/esm/deps/jsr.io/@std/semver/0.220.1/types.js +2 -0
  281. package/esm/deps/jsr.io/@std/testing/0.220.1/snapshot.d.ts.map +1 -0
  282. package/esm/deps/jsr.io/@std/text/0.220.1/_util.d.ts.map +1 -0
  283. package/esm/deps/jsr.io/@std/text/0.220.1/case.d.ts.map +1 -0
  284. package/esm/deps/jsr.io/@std/text/0.220.1/closest_string.d.ts.map +1 -0
  285. package/esm/deps/jsr.io/@std/text/0.220.1/compare_similarity.d.ts.map +1 -0
  286. package/esm/deps/jsr.io/@std/text/0.220.1/levenshtein_distance.d.ts.map +1 -0
  287. package/esm/deps/jsr.io/@std/text/0.220.1/mod.d.ts.map +1 -0
  288. package/esm/deps/jsr.io/@std/text/0.220.1/word_similarity_sort.d.ts.map +1 -0
  289. package/esm/deps/jsr.io/@std/url/0.220.1/_strip.d.ts.map +1 -0
  290. package/esm/deps/jsr.io/@std/url/0.220.1/basename.d.ts.map +1 -0
  291. package/esm/deps/jsr.io/@std/url/0.220.1/dirname.d.ts.map +1 -0
  292. package/esm/deps/jsr.io/@std/url/0.220.1/extname.d.ts.map +1 -0
  293. package/esm/deps/jsr.io/@std/url/0.220.1/join.d.ts.map +1 -0
  294. package/esm/deps/jsr.io/@std/url/0.220.1/mod.d.ts.map +1 -0
  295. package/esm/deps/jsr.io/@std/url/0.220.1/normalize.d.ts.map +1 -0
  296. package/esm/deps/jsr.io/@std/yaml/0.220.1/_dumper/dumper.d.ts.map +1 -0
  297. package/esm/deps/jsr.io/@std/yaml/0.220.1/_dumper/dumper_state.d.ts.map +1 -0
  298. package/esm/deps/jsr.io/@std/yaml/0.220.1/_error.d.ts.map +1 -0
  299. package/esm/deps/jsr.io/@std/yaml/0.220.1/_loader/loader.d.ts.map +1 -0
  300. package/esm/deps/jsr.io/@std/yaml/0.220.1/_loader/loader_state.d.ts.map +1 -0
  301. package/esm/deps/jsr.io/@std/yaml/0.220.1/_mark.d.ts.map +1 -0
  302. package/esm/deps/jsr.io/@std/yaml/0.220.1/_state.d.ts.map +1 -0
  303. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/binary.d.ts.map +1 -0
  304. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/bool.d.ts.map +1 -0
  305. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/float.d.ts.map +1 -0
  306. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/function.d.ts.map +1 -0
  307. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/int.d.ts.map +1 -0
  308. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/map.d.ts.map +1 -0
  309. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/merge.d.ts.map +1 -0
  310. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/mod.d.ts.map +1 -0
  311. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/nil.d.ts.map +1 -0
  312. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/omap.d.ts.map +1 -0
  313. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/pairs.d.ts.map +1 -0
  314. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/regexp.d.ts.map +1 -0
  315. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/seq.d.ts.map +1 -0
  316. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/set.d.ts.map +1 -0
  317. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/str.d.ts.map +1 -0
  318. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/timestamp.d.ts.map +1 -0
  319. package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/undefined.d.ts.map +1 -0
  320. package/esm/deps/jsr.io/@std/yaml/0.220.1/_utils.d.ts.map +1 -0
  321. package/esm/deps/jsr.io/@std/yaml/0.220.1/mod.d.ts.map +1 -0
  322. package/esm/deps/jsr.io/@std/yaml/0.220.1/parse.d.ts.map +1 -0
  323. package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/core.d.ts.map +1 -0
  324. package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/default.d.ts.map +1 -0
  325. package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/extended.d.ts.map +1 -0
  326. package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/failsafe.d.ts.map +1 -0
  327. package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/json.d.ts.map +1 -0
  328. package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/mod.d.ts.map +1 -0
  329. package/esm/deps/jsr.io/@std/yaml/0.220.1/schema.d.ts.map +1 -0
  330. package/esm/deps/jsr.io/@std/yaml/0.220.1/stringify.d.ts.map +1 -0
  331. package/esm/deps/jsr.io/@std/yaml/0.220.1/type.d.ts.map +1 -0
  332. package/esm/federation/callback.d.ts +56 -0
  333. package/esm/federation/callback.d.ts.map +1 -0
  334. package/esm/federation/callback.js +1 -0
  335. package/esm/federation/collection.d.ts +9 -0
  336. package/esm/federation/collection.d.ts.map +1 -0
  337. package/esm/federation/collection.js +1 -0
  338. package/esm/federation/context.d.ts +148 -0
  339. package/esm/federation/context.d.ts.map +1 -0
  340. package/esm/federation/context.js +1 -0
  341. package/esm/federation/handler.d.ts +83 -0
  342. package/esm/federation/handler.d.ts.map +1 -0
  343. package/esm/federation/handler.js +266 -0
  344. package/esm/federation/handler.test.d.ts.map +1 -0
  345. package/esm/federation/kv.d.ts +58 -0
  346. package/esm/federation/kv.d.ts.map +1 -0
  347. package/esm/federation/kv.js +45 -0
  348. package/esm/federation/middleware.d.ts +309 -0
  349. package/esm/federation/middleware.d.ts.map +1 -0
  350. package/esm/federation/middleware.js +626 -0
  351. package/esm/federation/middleware.test.d.ts.map +1 -0
  352. package/esm/federation/mod.d.ts +14 -0
  353. package/esm/federation/mod.d.ts.map +1 -0
  354. package/esm/federation/mod.js +13 -0
  355. package/esm/federation/mq.d.ts +42 -0
  356. package/esm/federation/mq.d.ts.map +1 -0
  357. package/esm/federation/mq.js +26 -0
  358. package/esm/federation/queue.d.ts +10 -0
  359. package/esm/federation/queue.d.ts.map +1 -0
  360. package/esm/federation/queue.js +1 -0
  361. package/esm/federation/router.d.ts +52 -0
  362. package/esm/federation/router.d.ts.map +1 -0
  363. package/esm/federation/router.js +80 -0
  364. package/esm/federation/router.test.d.ts.map +1 -0
  365. package/esm/federation/send.d.ts +60 -0
  366. package/esm/federation/send.d.ts.map +1 -0
  367. package/esm/federation/send.js +45 -0
  368. package/esm/federation/send.test.d.ts.map +1 -0
  369. package/esm/httpsig/key.d.ts +32 -0
  370. package/esm/httpsig/key.d.ts.map +1 -0
  371. package/esm/httpsig/key.js +62 -0
  372. package/esm/httpsig/key.test.d.ts.map +1 -0
  373. package/esm/httpsig/mod.d.ts +47 -0
  374. package/esm/httpsig/mod.d.ts.map +1 -0
  375. package/esm/httpsig/mod.js +193 -0
  376. package/esm/httpsig/mod.test.d.ts.map +1 -0
  377. package/esm/mod.d.ts +51 -0
  378. package/esm/mod.d.ts.map +1 -0
  379. package/esm/mod.js +50 -0
  380. package/esm/nodeinfo/handler.d.ts +33 -0
  381. package/esm/nodeinfo/handler.d.ts.map +1 -0
  382. package/esm/nodeinfo/handler.js +49 -0
  383. package/esm/nodeinfo/handler.test.d.ts.map +1 -0
  384. package/esm/nodeinfo/mod.d.ts +8 -0
  385. package/esm/nodeinfo/mod.d.ts.map +1 -0
  386. package/esm/nodeinfo/mod.js +7 -0
  387. package/esm/nodeinfo/types.d.ts +133 -0
  388. package/esm/nodeinfo/types.d.ts.map +1 -0
  389. package/esm/nodeinfo/types.js +60 -0
  390. package/esm/nodeinfo/types.test.d.ts.map +1 -0
  391. package/esm/package.json +3 -0
  392. package/esm/runtime/docloader.d.ts +104 -0
  393. package/esm/runtime/docloader.d.ts.map +1 -0
  394. package/esm/runtime/docloader.js +124 -0
  395. package/esm/runtime/docloader.test.d.ts.map +1 -0
  396. package/esm/runtime/key.d.ts +14 -0
  397. package/esm/runtime/key.d.ts.map +1 -0
  398. package/esm/runtime/key.js +24 -0
  399. package/esm/runtime/key.test.d.ts.map +1 -0
  400. package/esm/runtime/langstr.d.ts +15 -0
  401. package/esm/runtime/langstr.d.ts.map +1 -0
  402. package/esm/runtime/langstr.js +25 -0
  403. package/esm/runtime/langstr.test.d.ts.map +1 -0
  404. package/esm/runtime/mod.d.ts +10 -0
  405. package/esm/runtime/mod.d.ts.map +1 -0
  406. package/esm/runtime/mod.js +9 -0
  407. package/esm/shim/event.d.ts.map +1 -0
  408. package/esm/testing/context.d.ts.map +1 -0
  409. package/esm/testing/docloader.d.ts.map +1 -0
  410. package/esm/testing/fixtures/example.com/hong-gildong +11 -0
  411. package/esm/testing/fixtures/example.com/key +7 -0
  412. package/esm/testing/fixtures/example.com/key2 +6 -0
  413. package/esm/testing/fixtures/example.com/object +6 -0
  414. package/esm/testing/fixtures/example.com/person +22 -0
  415. package/esm/testing/fixtures/example.com/test +5 -0
  416. package/esm/testing/fixtures/example.com/users/handle +16 -0
  417. package/esm/testing/fixtures/example.com/wrong-type +3 -0
  418. package/esm/testing/fixtures/w3id.org/security/v1 +50 -0
  419. package/esm/testing/fixtures/www.w3.org/ns/activitystreams +379 -0
  420. package/esm/testing/keys.d.ts.map +1 -0
  421. package/esm/vocab/accept.yaml +11 -0
  422. package/esm/vocab/activity.yaml +42 -0
  423. package/esm/vocab/actor.d.ts +52 -0
  424. package/esm/vocab/actor.d.ts.map +1 -0
  425. package/esm/vocab/actor.js +94 -0
  426. package/esm/vocab/actor.test.d.ts.map +1 -0
  427. package/esm/vocab/add.yaml +12 -0
  428. package/esm/vocab/announce.yaml +11 -0
  429. package/esm/vocab/application.yaml +179 -0
  430. package/esm/vocab/article.yaml +8 -0
  431. package/esm/vocab/audio.yaml +8 -0
  432. package/esm/vocab/block.yaml +12 -0
  433. package/esm/vocab/collection.yaml +63 -0
  434. package/esm/vocab/collectionpage.yaml +38 -0
  435. package/esm/vocab/create.yaml +8 -0
  436. package/esm/vocab/delete.yaml +10 -0
  437. package/esm/vocab/dislike.yaml +8 -0
  438. package/esm/vocab/document.yaml +8 -0
  439. package/esm/vocab/endpoints.yaml +78 -0
  440. package/esm/vocab/event.yaml +8 -0
  441. package/esm/vocab/flag.yaml +11 -0
  442. package/esm/vocab/follow.yaml +12 -0
  443. package/esm/vocab/group.yaml +179 -0
  444. package/esm/vocab/ignore.yaml +10 -0
  445. package/esm/vocab/image.yaml +8 -0
  446. package/esm/vocab/intransitiveactivity.yaml +11 -0
  447. package/esm/vocab/key.yaml +25 -0
  448. package/esm/vocab/like.yaml +10 -0
  449. package/esm/vocab/link.yaml +92 -0
  450. package/esm/vocab/lookup.d.ts +42 -0
  451. package/esm/vocab/lookup.d.ts.map +1 -0
  452. package/esm/vocab/lookup.js +82 -0
  453. package/esm/vocab/lookup.test.d.ts.map +1 -0
  454. package/esm/vocab/mention.yaml +8 -0
  455. package/esm/vocab/mod.d.ts +55 -0
  456. package/esm/vocab/mod.d.ts.map +1 -0
  457. package/esm/vocab/mod.js +54 -0
  458. package/esm/vocab/note.yaml +10 -0
  459. package/esm/vocab/object.yaml +301 -0
  460. package/esm/vocab/orderedcollection.yaml +11 -0
  461. package/esm/vocab/orderedcollectionpage.yaml +20 -0
  462. package/esm/vocab/organization.yaml +179 -0
  463. package/esm/vocab/page.yaml +8 -0
  464. package/esm/vocab/person.yaml +179 -0
  465. package/esm/vocab/place.yaml +66 -0
  466. package/esm/vocab/profile.yaml +22 -0
  467. package/esm/vocab/reject.yaml +10 -0
  468. package/esm/vocab/relationship.yaml +46 -0
  469. package/esm/vocab/remove.yaml +10 -0
  470. package/esm/vocab/service.yaml +179 -0
  471. package/esm/vocab/undo.yaml +15 -0
  472. package/esm/vocab/update.yaml +13 -0
  473. package/esm/vocab/video.yaml +8 -0
  474. package/esm/vocab/vocab.d.ts +7191 -0
  475. package/esm/vocab/vocab.d.ts.map +1 -0
  476. package/esm/vocab/vocab.js +14279 -0
  477. package/esm/vocab/vocab.test.d.ts.map +1 -0
  478. package/esm/webfinger/handler.d.ts +29 -0
  479. package/esm/webfinger/handler.d.ts.map +1 -0
  480. package/esm/webfinger/handler.js +76 -0
  481. package/esm/webfinger/handler.test.d.ts.map +1 -0
  482. package/esm/webfinger/jrd.d.ts +52 -0
  483. package/esm/webfinger/jrd.d.ts.map +1 -0
  484. package/esm/webfinger/jrd.js +1 -0
  485. package/esm/webfinger/lookup.d.ts +9 -0
  486. package/esm/webfinger/lookup.d.ts.map +1 -0
  487. package/esm/webfinger/lookup.js +44 -0
  488. package/esm/webfinger/lookup.test.d.ts.map +1 -0
  489. package/esm/webfinger/mod.d.ts +8 -0
  490. package/esm/webfinger/mod.d.ts.map +1 -0
  491. package/esm/webfinger/mod.js +7 -0
  492. package/esm/x/fresh.d.ts +58 -0
  493. package/esm/x/fresh.d.ts.map +1 -0
  494. package/esm/x/fresh.js +77 -0
  495. package/logo.svg +187 -0
  496. package/package.json +60 -0
@@ -0,0 +1,626 @@
1
+ import * as dntShim from "../_dnt.shims.js";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { exportJwk, importJwk, validateCryptoKey } from "../httpsig/key.js";
4
+ import { handleNodeInfo, handleNodeInfoJrd } from "../nodeinfo/handler.js";
5
+ import { fetchDocumentLoader, getAuthenticatedDocumentLoader, kvCache, } from "../runtime/docloader.js";
6
+ import { Activity, CryptographicKey } from "../vocab/mod.js";
7
+ import { handleWebFinger } from "../webfinger/handler.js";
8
+ import { handleActor, handleCollection, handleInbox, } from "./handler.js";
9
+ import { Router, RouterError } from "./router.js";
10
+ import { extractInboxes, sendActivity } from "./send.js";
11
+ /**
12
+ * An object that registers federation-related business logic and dispatches
13
+ * requests to the appropriate handlers.
14
+ *
15
+ * It also provides a middleware interface for handling requests before your
16
+ * web framework's router; see {@link Federation.handle}.
17
+ */
18
+ export class Federation {
19
+ #kv;
20
+ #kvPrefixes;
21
+ #queue;
22
+ #router;
23
+ #nodeInfoDispatcher;
24
+ #actorCallbacks;
25
+ #outboxCallbacks;
26
+ #followingCallbacks;
27
+ #followersCallbacks;
28
+ #inboxListeners;
29
+ #inboxErrorHandler;
30
+ #documentLoader;
31
+ #authenticatedDocumentLoaderFactory;
32
+ #treatHttps;
33
+ #backoffSchedule;
34
+ /**
35
+ * Create a new {@link Federation} instance.
36
+ * @param parameters Parameters for initializing the instance.
37
+ */
38
+ constructor({ kv, kvPrefixes, queue, documentLoader, authenticatedDocumentLoaderFactory, treatHttps, backoffSchedule, }) {
39
+ this.#kv = kv;
40
+ this.#kvPrefixes = {
41
+ ...({
42
+ activityIdempotence: ["_fedify", "activityIdempotence"],
43
+ remoteDocument: ["_fedify", "remoteDocument"],
44
+ }),
45
+ ...(kvPrefixes ?? {}),
46
+ };
47
+ this.#queue = queue;
48
+ this.#router = new Router();
49
+ this.#router.add("/.well-known/webfinger", "webfinger");
50
+ this.#router.add("/.well-known/nodeinfo", "nodeInfoJrd");
51
+ this.#inboxListeners = new Map();
52
+ this.#documentLoader = documentLoader ?? kvCache({
53
+ loader: fetchDocumentLoader,
54
+ kv: kv,
55
+ prefix: this.#kvPrefixes.remoteDocument,
56
+ });
57
+ this.#authenticatedDocumentLoaderFactory =
58
+ authenticatedDocumentLoaderFactory ??
59
+ getAuthenticatedDocumentLoader;
60
+ this.#treatHttps = treatHttps ?? false;
61
+ if (backoffSchedule != null) {
62
+ // TODO: Deno KV Queue's backoff schedule is too limited for our needs.
63
+ // We should manually implement our own backoff retrial mechanism.
64
+ // Fortunately, Deno KV Queue's delay option allows up to 30 days.
65
+ // We can use that to implement our own backoff schedule.
66
+ if (backoffSchedule.length > 5) {
67
+ throw new Error("Backoff schedule must have at most 5 entries.");
68
+ }
69
+ const hour = Temporal.Duration.from({ hours: 1 });
70
+ if (backoffSchedule.some((d) => Temporal.Duration.compare(d, hour) > 0)) {
71
+ throw new Error("Backoff schedule must not exceed 1 hour.");
72
+ }
73
+ }
74
+ this.#backoffSchedule = backoffSchedule ?? [
75
+ 3000,
76
+ 15000,
77
+ 60000,
78
+ 15 * 60000,
79
+ 60 * 60000,
80
+ ].map((ms) => Temporal.Duration.from({ milliseconds: ms }));
81
+ queue?.listen(this.#listenQueue.bind(this));
82
+ }
83
+ async #listenQueue(message) {
84
+ try {
85
+ await sendActivity({
86
+ keyId: new URL(message.keyId),
87
+ privateKey: await importJwk(message.privateKey, "private"),
88
+ activity: await Activity.fromJsonLd(message.activity, {
89
+ documentLoader: this.#documentLoader,
90
+ }),
91
+ inbox: new URL(message.inbox),
92
+ documentLoader: this.#documentLoader,
93
+ });
94
+ }
95
+ catch (_) {
96
+ if (message.trial < this.#backoffSchedule.length) {
97
+ this.#queue?.enqueue({
98
+ ...message,
99
+ trial: message.trial + 1,
100
+ }, { delay: this.#backoffSchedule[message.trial] });
101
+ }
102
+ }
103
+ }
104
+ createContext(urlOrRequest, contextData) {
105
+ const request = urlOrRequest instanceof Request ? urlOrRequest : null;
106
+ const url = urlOrRequest instanceof URL
107
+ ? new URL(urlOrRequest)
108
+ : new URL(urlOrRequest.url);
109
+ if (request == null) {
110
+ url.pathname = "/";
111
+ url.hash = "";
112
+ url.search = "";
113
+ }
114
+ if (this.#treatHttps)
115
+ url.protocol = "https:";
116
+ const getKeyPairFromHandle = async (handle) => {
117
+ if (this.#actorCallbacks?.keyPairDispatcher == null) {
118
+ throw new Error("No actor key pair dispatcher registered.");
119
+ }
120
+ let keyPair = this.#actorCallbacks?.keyPairDispatcher(contextData, handle);
121
+ if (keyPair instanceof Promise)
122
+ keyPair = await keyPair;
123
+ if (keyPair == null) {
124
+ throw new Error(`No key pair found for actor ${JSON.stringify(handle)}`);
125
+ }
126
+ return {
127
+ keyId: new URL(`${context.getActorUri(handle)}#main-key`),
128
+ privateKey: keyPair.privateKey,
129
+ };
130
+ };
131
+ const getAuthenticatedDocumentLoader = this.#authenticatedDocumentLoaderFactory;
132
+ function getDocumentLoader(identity) {
133
+ if ("handle" in identity) {
134
+ const keyPair = getKeyPairFromHandle(identity.handle);
135
+ return keyPair.then((pair) => getAuthenticatedDocumentLoader(pair));
136
+ }
137
+ return getAuthenticatedDocumentLoader(identity);
138
+ }
139
+ const context = {
140
+ data: contextData,
141
+ documentLoader: this.#documentLoader,
142
+ getNodeInfoUri: () => {
143
+ const path = this.#router.build("nodeInfo", {});
144
+ if (path == null) {
145
+ throw new RouterError("No NodeInfo dispatcher registered.");
146
+ }
147
+ return new URL(path, url);
148
+ },
149
+ getActorUri: (handle) => {
150
+ const path = this.#router.build("actor", { handle });
151
+ if (path == null) {
152
+ throw new RouterError("No actor dispatcher registered.");
153
+ }
154
+ return new URL(path, url);
155
+ },
156
+ getOutboxUri: (handle) => {
157
+ const path = this.#router.build("outbox", { handle });
158
+ if (path == null) {
159
+ throw new RouterError("No outbox dispatcher registered.");
160
+ }
161
+ return new URL(path, url);
162
+ },
163
+ getInboxUri: (handle) => {
164
+ if (handle == null) {
165
+ const path = this.#router.build("sharedInbox", {});
166
+ if (path == null) {
167
+ throw new RouterError("No shared inbox path registered.");
168
+ }
169
+ return new URL(path, url);
170
+ }
171
+ const path = this.#router.build("inbox", { handle });
172
+ if (path == null) {
173
+ throw new RouterError("No inbox path registered.");
174
+ }
175
+ return new URL(path, url);
176
+ },
177
+ getFollowingUri: (handle) => {
178
+ const path = this.#router.build("following", { handle });
179
+ if (path == null) {
180
+ throw new RouterError("No following collection path registered.");
181
+ }
182
+ return new URL(path, url);
183
+ },
184
+ getFollowersUri: (handle) => {
185
+ const path = this.#router.build("followers", { handle });
186
+ if (path == null) {
187
+ throw new RouterError("No followers collection path registered.");
188
+ }
189
+ return new URL(path, url);
190
+ },
191
+ getHandleFromActorUri: (actorUri) => {
192
+ if (actorUri.origin !== url.origin)
193
+ return null;
194
+ const route = this.#router.route(actorUri.pathname);
195
+ if (route?.name !== "actor")
196
+ return null;
197
+ return route.values.handle;
198
+ },
199
+ getActorKey: async (handle) => {
200
+ let keyPair = this.#actorCallbacks?.keyPairDispatcher?.(contextData, handle);
201
+ if (keyPair instanceof Promise)
202
+ keyPair = await keyPair;
203
+ if (keyPair == null)
204
+ return null;
205
+ return new CryptographicKey({
206
+ id: new URL(`${context.getActorUri(handle)}#main-key`),
207
+ owner: context.getActorUri(handle),
208
+ publicKey: keyPair.publicKey,
209
+ });
210
+ },
211
+ getDocumentLoader,
212
+ sendActivity: async (sender, recipients, activity, options = {}) => {
213
+ const senderPair = "handle" in sender
214
+ ? await getKeyPairFromHandle(sender.handle)
215
+ : sender;
216
+ return await this.sendActivity(senderPair, recipients, activity, options);
217
+ },
218
+ };
219
+ if (request == null)
220
+ return context;
221
+ const reqCtx = {
222
+ ...context,
223
+ request,
224
+ url,
225
+ };
226
+ return reqCtx;
227
+ }
228
+ /**
229
+ * Registers a NodeInfo dispatcher.
230
+ * @param path The URI path pattern for the NodeInfo dispatcher. The syntax
231
+ * is based on URI Template
232
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
233
+ * must have no variables.
234
+ * @param dispatcher A NodeInfo dispatcher callback to register.
235
+ * @throws {RouterError} Thrown if the path pattern is invalid.
236
+ */
237
+ setNodeInfoDispatcher(path, dispatcher) {
238
+ if (this.#router.has("nodeInfo")) {
239
+ throw new RouterError("NodeInfo dispatcher already set.");
240
+ }
241
+ const variables = this.#router.add(path, "nodeInfo");
242
+ if (variables.size !== 0) {
243
+ throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
244
+ }
245
+ this.#nodeInfoDispatcher = dispatcher;
246
+ }
247
+ /**
248
+ * Registers an actor dispatcher.
249
+ *
250
+ * @example
251
+ * ``` typescript
252
+ * federation.setActorDispatcher(
253
+ * "/users/{handle}",
254
+ * async (ctx, handle, key) => {
255
+ * return new Person({
256
+ * id: ctx.getActorUri(handle),
257
+ * preferredUsername: handle,
258
+ * // ...
259
+ * });
260
+ * }
261
+ * );
262
+ * ```
263
+ *
264
+ * @param path The URI path pattern for the actor dispatcher. The syntax is
265
+ * based on URI Template
266
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
267
+ * must have one variable: `{handle}`.
268
+ * @param dispatcher An actor dispatcher callback to register.
269
+ * @returns An object with methods to set other actor dispatcher callbacks.
270
+ * @throws {RouterError} Thrown if the path pattern is invalid.
271
+ */
272
+ setActorDispatcher(path, dispatcher) {
273
+ if (this.#router.has("actor")) {
274
+ throw new RouterError("Actor dispatcher already set.");
275
+ }
276
+ const variables = this.#router.add(path, "actor");
277
+ if (variables.size !== 1 || !variables.has("handle")) {
278
+ throw new RouterError("Path for actor dispatcher must have one variable: {handle}");
279
+ }
280
+ const callbacks = { dispatcher };
281
+ this.#actorCallbacks = callbacks;
282
+ const setters = {
283
+ setKeyPairDispatcher: (dispatcher) => {
284
+ callbacks.keyPairDispatcher = dispatcher;
285
+ return setters;
286
+ },
287
+ };
288
+ return setters;
289
+ }
290
+ /**
291
+ * Registers an outbox dispatcher.
292
+ *
293
+ * @example
294
+ * ``` typescript
295
+ * federation.setOutboxDispatcher(
296
+ * "/users/{handle}/outbox",
297
+ * async (ctx, handle, options) => {
298
+ * let items: Activity[];
299
+ * let nextCursor: string;
300
+ * // ...
301
+ * return { items, nextCursor };
302
+ * }
303
+ * );
304
+ * ```
305
+ *
306
+ * @param path The URI path pattern for the outbox dispatcher. The syntax is
307
+ * based on URI Template
308
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
309
+ * must have one variable: `{handle}`.
310
+ * @param dispatcher An outbox dispatcher callback to register.
311
+ * @throws {@link RouterError} Thrown if the path pattern is invalid.
312
+ */
313
+ setOutboxDispatcher(path, dispatcher) {
314
+ if (this.#router.has("outbox")) {
315
+ throw new RouterError("Outbox dispatcher already set.");
316
+ }
317
+ const variables = this.#router.add(path, "outbox");
318
+ if (variables.size !== 1 || !variables.has("handle")) {
319
+ throw new RouterError("Path for outbox dispatcher must have one variable: {handle}");
320
+ }
321
+ const callbacks = {
322
+ dispatcher,
323
+ };
324
+ this.#outboxCallbacks = callbacks;
325
+ const setters = {
326
+ setCounter(counter) {
327
+ callbacks.counter = counter;
328
+ return setters;
329
+ },
330
+ setFirstCursor(cursor) {
331
+ callbacks.firstCursor = cursor;
332
+ return setters;
333
+ },
334
+ setLastCursor(cursor) {
335
+ callbacks.lastCursor = cursor;
336
+ return setters;
337
+ },
338
+ };
339
+ return setters;
340
+ }
341
+ /**
342
+ * Registers a following collection dispatcher.
343
+ * @param path The URI path pattern for the following collection. The syntax
344
+ * is based on URI Template
345
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
346
+ * must have one variable: `{handle}`.
347
+ * @param dispatcher A following collection callback to register.
348
+ * @returns An object with methods to set other following collection
349
+ * callbacks.
350
+ * @throws {RouterError} Thrown if the path pattern is invalid.
351
+ */
352
+ setFollowingDispatcher(path, dispatcher) {
353
+ if (this.#router.has("following")) {
354
+ throw new RouterError("Following collection dispatcher already set.");
355
+ }
356
+ const variables = this.#router.add(path, "following");
357
+ if (variables.size !== 1 || !variables.has("handle")) {
358
+ throw new RouterError("Path for following collection dispatcher must have one variable: {handle}");
359
+ }
360
+ const callbacks = {
361
+ dispatcher,
362
+ };
363
+ this.#followingCallbacks = callbacks;
364
+ const setters = {
365
+ setCounter(counter) {
366
+ callbacks.counter = counter;
367
+ return setters;
368
+ },
369
+ setFirstCursor(cursor) {
370
+ callbacks.firstCursor = cursor;
371
+ return setters;
372
+ },
373
+ setLastCursor(cursor) {
374
+ callbacks.lastCursor = cursor;
375
+ return setters;
376
+ },
377
+ };
378
+ return setters;
379
+ }
380
+ /**
381
+ * Registers a followers collection dispatcher.
382
+ * @param path The URI path pattern for the followers collection. The syntax
383
+ * is based on URI Template
384
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The path
385
+ * must have one variable: `{handle}`.
386
+ * @param dispatcher A followers collection callback to register.
387
+ * @returns An object with methods to set other followers collection
388
+ * callbacks.
389
+ * @throws {@link RouterError} Thrown if the path pattern is invalid.
390
+ */
391
+ setFollowersDispatcher(path, dispatcher) {
392
+ if (this.#router.has("followers")) {
393
+ throw new RouterError("Followers collection dispatcher already set.");
394
+ }
395
+ const variables = this.#router.add(path, "followers");
396
+ if (variables.size !== 1 || !variables.has("handle")) {
397
+ throw new RouterError("Path for followers collection dispatcher must have one variable: {handle}");
398
+ }
399
+ const callbacks = {
400
+ dispatcher,
401
+ };
402
+ this.#followersCallbacks = callbacks;
403
+ const setters = {
404
+ setCounter(counter) {
405
+ callbacks.counter = counter;
406
+ return setters;
407
+ },
408
+ setFirstCursor(cursor) {
409
+ callbacks.firstCursor = cursor;
410
+ return setters;
411
+ },
412
+ setLastCursor(cursor) {
413
+ callbacks.lastCursor = cursor;
414
+ return setters;
415
+ },
416
+ };
417
+ return setters;
418
+ }
419
+ /**
420
+ * Assigns the URL path for the inbox and starts setting inbox listeners.
421
+ *
422
+ * @example
423
+ * ``` typescript
424
+ * federation
425
+ * .setInboxListeners("/users/{handle/inbox", "/inbox")
426
+ * .on(Follow, async (ctx, follow) => {
427
+ * const from = await follow.getActor(ctx);
428
+ * if (!isActor(from)) return;
429
+ * // ...
430
+ * await ctx.sendActivity({ })
431
+ * })
432
+ * .on(Undo, async (ctx, undo) => {
433
+ * // ...
434
+ * });
435
+ * ```
436
+ *
437
+ * @param inboxPath The URI path pattern for the inbox. The syntax is based
438
+ * on URI Template
439
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
440
+ * The path must have one variable: `{handle}`.
441
+ * @param sharedInboxPath An optional URI path pattern for the shared inbox.
442
+ * The syntax is based on URI Template
443
+ * ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
444
+ * The path must have no variables.
445
+ * @returns An object to register inbox listeners.
446
+ * @throws {RouteError} Thrown if the path pattern is invalid.
447
+ */
448
+ setInboxListeners(inboxPath, sharedInboxPath) {
449
+ if (this.#router.has("inbox")) {
450
+ throw new RouterError("Inbox already set.");
451
+ }
452
+ const variables = this.#router.add(inboxPath, "inbox");
453
+ if (variables.size !== 1 || !variables.has("handle")) {
454
+ throw new RouterError("Path for inbox must have one variable: {handle}");
455
+ }
456
+ if (sharedInboxPath != null) {
457
+ const siVars = this.#router.add(sharedInboxPath, "sharedInbox");
458
+ if (siVars.size !== 0) {
459
+ throw new RouterError("Path for shared inbox must have no variables.");
460
+ }
461
+ }
462
+ const listeners = this.#inboxListeners;
463
+ const setter = {
464
+ on(
465
+ // deno-lint-ignore no-explicit-any
466
+ type, listener) {
467
+ if (listeners.has(type)) {
468
+ throw new TypeError("Listener already set for this type.");
469
+ }
470
+ listeners.set(type, listener);
471
+ return setter;
472
+ },
473
+ onError: (handler) => {
474
+ this.#inboxErrorHandler = handler;
475
+ return setter;
476
+ },
477
+ };
478
+ return setter;
479
+ }
480
+ /**
481
+ * Sends an activity to recipients' inboxes. You would typically use
482
+ * {@link Context.sendActivity} instead of this method.
483
+ *
484
+ * @param sender The sender's key pair.
485
+ * @param recipients The recipients of the activity.
486
+ * @param activity The activity to send.
487
+ * @param options Options for sending the activity.
488
+ */
489
+ async sendActivity({ keyId, privateKey }, recipients, activity, { preferSharedInbox, immediate } = {}) {
490
+ if (activity.id == null) {
491
+ activity = activity.clone({
492
+ id: new URL(`urn:uuid:${dntShim.crypto.randomUUID()}`),
493
+ });
494
+ }
495
+ validateCryptoKey(privateKey, "private");
496
+ const inboxes = extractInboxes({
497
+ recipients: Array.isArray(recipients) ? recipients : [recipients],
498
+ preferSharedInbox,
499
+ });
500
+ if (immediate || this.#queue == null) {
501
+ const promises = [];
502
+ for (const inbox of inboxes) {
503
+ promises.push(sendActivity({
504
+ keyId,
505
+ privateKey,
506
+ activity,
507
+ inbox,
508
+ documentLoader: this.#documentLoader,
509
+ }));
510
+ }
511
+ await Promise.all(promises);
512
+ return;
513
+ }
514
+ const privateKeyJwk = await exportJwk(privateKey);
515
+ const activityJson = await activity.toJsonLd({ expand: true });
516
+ for (const inbox of inboxes) {
517
+ const message = {
518
+ type: "outbox",
519
+ keyId: keyId.href,
520
+ privateKey: privateKeyJwk,
521
+ activity: activityJson,
522
+ inbox: inbox.href,
523
+ trial: 0,
524
+ };
525
+ this.#queue.enqueue(message);
526
+ }
527
+ }
528
+ /**
529
+ * Handles a request related to federation. If a request is not related to
530
+ * federation, the `onNotFound` or `onNotAcceptable` callback is called.
531
+ *
532
+ * Usually, this method is called from a server's request handler or
533
+ * a web framework's middleware.
534
+ *
535
+ * @param request The request object.
536
+ * @param parameters The parameters for handling the request.
537
+ * @returns The response to the request.
538
+ */
539
+ async handle(request, { onNotFound, onNotAcceptable, contextData, }) {
540
+ onNotFound ??= notFound;
541
+ onNotAcceptable ??= notAcceptable;
542
+ const url = new URL(request.url);
543
+ const route = this.#router.route(url.pathname);
544
+ if (route == null) {
545
+ const response = onNotFound(request);
546
+ return response instanceof Promise ? await response : response;
547
+ }
548
+ let context = this.createContext(request, contextData);
549
+ switch (route.name) {
550
+ case "webfinger":
551
+ return await handleWebFinger(request, {
552
+ context,
553
+ actorDispatcher: this.#actorCallbacks?.dispatcher,
554
+ onNotFound,
555
+ });
556
+ case "nodeInfoJrd":
557
+ return await handleNodeInfoJrd(request, context);
558
+ case "nodeInfo":
559
+ return await handleNodeInfo(request, {
560
+ context,
561
+ nodeInfoDispatcher: this.#nodeInfoDispatcher,
562
+ });
563
+ case "actor":
564
+ return await handleActor(request, {
565
+ handle: route.values.handle,
566
+ context,
567
+ actorDispatcher: this.#actorCallbacks?.dispatcher,
568
+ onNotFound,
569
+ onNotAcceptable,
570
+ });
571
+ case "outbox":
572
+ return await handleCollection(request, {
573
+ handle: route.values.handle,
574
+ context,
575
+ collectionCallbacks: this.#outboxCallbacks,
576
+ onNotFound,
577
+ onNotAcceptable,
578
+ });
579
+ case "inbox":
580
+ context = {
581
+ ...context,
582
+ documentLoader: await context.getDocumentLoader({
583
+ handle: route.values.handle,
584
+ }),
585
+ };
586
+ // falls through
587
+ case "sharedInbox":
588
+ return await handleInbox(request, {
589
+ handle: route.values.handle ?? null,
590
+ context,
591
+ kv: this.#kv,
592
+ kvPrefix: this.#kvPrefixes.activityIdempotence,
593
+ actorDispatcher: this.#actorCallbacks?.dispatcher,
594
+ inboxListeners: this.#inboxListeners,
595
+ inboxErrorHandler: this.#inboxErrorHandler,
596
+ onNotFound,
597
+ });
598
+ case "following":
599
+ return await handleCollection(request, {
600
+ handle: route.values.handle,
601
+ context,
602
+ collectionCallbacks: this.#followingCallbacks,
603
+ onNotFound,
604
+ onNotAcceptable,
605
+ });
606
+ case "followers":
607
+ return await handleCollection(request, {
608
+ handle: route.values.handle,
609
+ context,
610
+ collectionCallbacks: this.#followersCallbacks,
611
+ onNotFound,
612
+ onNotAcceptable,
613
+ });
614
+ default: {
615
+ const response = onNotFound(request);
616
+ return response instanceof Promise ? await response : response;
617
+ }
618
+ }
619
+ }
620
+ }
621
+ function notFound(_request) {
622
+ return new Response("Not Found", { status: 404 });
623
+ }
624
+ function notAcceptable(_request) {
625
+ return new Response("Not Acceptable", { status: 406 });
626
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.test.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.test.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The federated server framework.
3
+ *
4
+ * @module
5
+ */
6
+ export * from "./callback.js";
7
+ export * from "./collection.js";
8
+ export * from "./context.js";
9
+ export { respondWithObject, respondWithObjectIfAcceptable, type RespondWithObjectOptions, } from "./handler.js";
10
+ export * from "./kv.js";
11
+ export * from "./middleware.js";
12
+ export * from "./mq.js";
13
+ export * from "./router.js";
14
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/federation/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,cAAc,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The federated server framework.
3
+ *
4
+ * @module
5
+ */
6
+ export * from "./callback.js";
7
+ export * from "./collection.js";
8
+ export * from "./context.js";
9
+ export { respondWithObject, respondWithObjectIfAcceptable, } from "./handler.js";
10
+ export * from "./kv.js";
11
+ export * from "./middleware.js";
12
+ export * from "./mq.js";
13
+ export * from "./router.js";