@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.
- package/CHANGES.md +239 -0
- package/LICENSE +661 -0
- package/README.md +96 -0
- package/esm/_dnt.shims.d.ts +11 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +67 -0
- package/esm/_dnt.test_polyfills.d.ts.map +1 -0
- package/esm/_dnt.test_shims.d.ts.map +1 -0
- package/esm/codegen/fs.d.ts.map +1 -0
- package/esm/codegen/schema.d.ts.map +1 -0
- package/esm/codegen/schema.yaml +194 -0
- package/esm/codegen/type.d.ts.map +1 -0
- package/esm/deps/crux.land/api/get/2KNRVU.d.ts.map +1 -0
- package/esm/deps/deno.land/x/mock_fetch@0.3.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@david/which-runtime/0.2.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/collections.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/concat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/drop.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/filter.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/fold.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/infinite.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/take.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/tee.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/testing.d.ts.map +1 -0
- package/esm/deps/jsr.io/@hongminhee/aitertools/0.6.0/src/unique.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/_constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/_diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/_format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_almost_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_array_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_greater.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_less.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_object_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_string_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assert_throws.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/fail.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/unimplemented.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/0.220.1/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.d.ts +14 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/concat.js +27 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.d.ts +28 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/copy.js +37 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.d.ts +14 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/ends_with.js +23 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.d.ts +6 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/equals.js +44 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.d.ts +17 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/includes_needle.js +21 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.d.ts +18 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/index_of_needle.js +45 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.d.ts +18 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/last_index_of_needle.js +45 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.d.ts +24 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/mod.js +25 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.d.ts +15 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/repeat.js +33 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.d.ts +14 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/0.220.1/starts_with.js +21 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.d.ts +2 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/_util.js +26 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.d.ts +27 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/0.220.1/base64.js +141 -0
- package/esm/deps/jsr.io/@std/fmt/0.220.1/colors.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/0.220.1/_get_file_info_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/0.220.1/_to_path_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/0.220.1/ensure_dir.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/0.220.1/ensure_file.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.d.ts +38 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/common.js +40 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.d.ts +34 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/encoding.js +121 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.d.ts +31 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/language.js +113 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.d.ts +31 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/_negotiation/media_type.js +140 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.d.ts +128 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/http/0.220.1/negotiation.js +37 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/assert_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/from_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/glob_to_reg_exp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/normalize_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/relative.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/strip_trailing_separators.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_common/to_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_interface.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/_os.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/from_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/glob_to_regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/is_absolute.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/is_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/join.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/join_globs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/normalize_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/from_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/glob_to_regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/is_absolute.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/is_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/join.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/join_globs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/normalize_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/relative.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/resolve.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/to_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/posix/to_namespaced_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/relative.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/resolve.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/to_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/to_namespaced_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/common.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/from_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/glob_to_regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/is_absolute.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/is_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/join.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/join_globs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/normalize_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/relative.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/resolve.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/to_file_url.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/0.220.1/windows/to_namespaced_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.d.ts +2 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_constants.js +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.d.ts +44 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/_shared.js +161 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.d.ts +2 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/can_parse.js +14 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/compare.d.ts +11 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/compare.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/compare.js +18 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/constants.d.ts +43 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/constants.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/constants.js +73 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/difference.d.ts +6 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/difference.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/difference.js +16 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/equals.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/equals.js +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format.d.ts +13 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format.js +36 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.d.ts +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/format_range.js +16 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_or_equal.js +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/greater_than.js +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/increment.d.ts +29 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/increment.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/increment.js +160 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.d.ts +13 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_range.js +28 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.d.ts +18 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/is_semver.js +38 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_or_equal.js +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/less_than.js +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.d.ts +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/max_satisfying.js +18 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.d.ts +10 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/min_satisfying.js +18 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/mod.d.ts +291 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/mod.js +293 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/not_equals.js +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse.d.ts +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse.js +34 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/parse_range.js +336 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.d.ts +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_intersects.js +72 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_max.js +58 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/range_min.js +49 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.d.ts +9 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/test_range.js +69 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse.js +17 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.d.ts +8 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/try_parse_range.js +17 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/types.d.ts +38 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/semver/0.220.1/types.js +2 -0
- package/esm/deps/jsr.io/@std/testing/0.220.1/snapshot.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/_util.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/case.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/closest_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/compare_similarity.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/levenshtein_distance.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/text/0.220.1/word_similarity_sort.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/_strip.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/basename.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/dirname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/join.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/url/0.220.1/normalize.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_dumper/dumper.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_dumper/dumper_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_loader/loader.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_loader/loader_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_mark.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/binary.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/bool.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/float.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/function.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/int.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/nil.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/omap.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/pairs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/seq.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/set.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/timestamp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_type/undefined.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/core.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/default.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/extended.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/failsafe.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/json.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/schema.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/stringify.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/0.220.1/type.d.ts.map +1 -0
- package/esm/federation/callback.d.ts +56 -0
- package/esm/federation/callback.d.ts.map +1 -0
- package/esm/federation/callback.js +1 -0
- package/esm/federation/collection.d.ts +9 -0
- package/esm/federation/collection.d.ts.map +1 -0
- package/esm/federation/collection.js +1 -0
- package/esm/federation/context.d.ts +148 -0
- package/esm/federation/context.d.ts.map +1 -0
- package/esm/federation/context.js +1 -0
- package/esm/federation/handler.d.ts +83 -0
- package/esm/federation/handler.d.ts.map +1 -0
- package/esm/federation/handler.js +266 -0
- package/esm/federation/handler.test.d.ts.map +1 -0
- package/esm/federation/kv.d.ts +58 -0
- package/esm/federation/kv.d.ts.map +1 -0
- package/esm/federation/kv.js +45 -0
- package/esm/federation/middleware.d.ts +309 -0
- package/esm/federation/middleware.d.ts.map +1 -0
- package/esm/federation/middleware.js +626 -0
- package/esm/federation/middleware.test.d.ts.map +1 -0
- package/esm/federation/mod.d.ts +14 -0
- package/esm/federation/mod.d.ts.map +1 -0
- package/esm/federation/mod.js +13 -0
- package/esm/federation/mq.d.ts +42 -0
- package/esm/federation/mq.d.ts.map +1 -0
- package/esm/federation/mq.js +26 -0
- package/esm/federation/queue.d.ts +10 -0
- package/esm/federation/queue.d.ts.map +1 -0
- package/esm/federation/queue.js +1 -0
- package/esm/federation/router.d.ts +52 -0
- package/esm/federation/router.d.ts.map +1 -0
- package/esm/federation/router.js +80 -0
- package/esm/federation/router.test.d.ts.map +1 -0
- package/esm/federation/send.d.ts +60 -0
- package/esm/federation/send.d.ts.map +1 -0
- package/esm/federation/send.js +45 -0
- package/esm/federation/send.test.d.ts.map +1 -0
- package/esm/httpsig/key.d.ts +32 -0
- package/esm/httpsig/key.d.ts.map +1 -0
- package/esm/httpsig/key.js +62 -0
- package/esm/httpsig/key.test.d.ts.map +1 -0
- package/esm/httpsig/mod.d.ts +47 -0
- package/esm/httpsig/mod.d.ts.map +1 -0
- package/esm/httpsig/mod.js +193 -0
- package/esm/httpsig/mod.test.d.ts.map +1 -0
- package/esm/mod.d.ts +51 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +50 -0
- package/esm/nodeinfo/handler.d.ts +33 -0
- package/esm/nodeinfo/handler.d.ts.map +1 -0
- package/esm/nodeinfo/handler.js +49 -0
- package/esm/nodeinfo/handler.test.d.ts.map +1 -0
- package/esm/nodeinfo/mod.d.ts +8 -0
- package/esm/nodeinfo/mod.d.ts.map +1 -0
- package/esm/nodeinfo/mod.js +7 -0
- package/esm/nodeinfo/types.d.ts +133 -0
- package/esm/nodeinfo/types.d.ts.map +1 -0
- package/esm/nodeinfo/types.js +60 -0
- package/esm/nodeinfo/types.test.d.ts.map +1 -0
- package/esm/package.json +3 -0
- package/esm/runtime/docloader.d.ts +104 -0
- package/esm/runtime/docloader.d.ts.map +1 -0
- package/esm/runtime/docloader.js +124 -0
- package/esm/runtime/docloader.test.d.ts.map +1 -0
- package/esm/runtime/key.d.ts +14 -0
- package/esm/runtime/key.d.ts.map +1 -0
- package/esm/runtime/key.js +24 -0
- package/esm/runtime/key.test.d.ts.map +1 -0
- package/esm/runtime/langstr.d.ts +15 -0
- package/esm/runtime/langstr.d.ts.map +1 -0
- package/esm/runtime/langstr.js +25 -0
- package/esm/runtime/langstr.test.d.ts.map +1 -0
- package/esm/runtime/mod.d.ts +10 -0
- package/esm/runtime/mod.d.ts.map +1 -0
- package/esm/runtime/mod.js +9 -0
- package/esm/shim/event.d.ts.map +1 -0
- package/esm/testing/context.d.ts.map +1 -0
- package/esm/testing/docloader.d.ts.map +1 -0
- package/esm/testing/fixtures/example.com/hong-gildong +11 -0
- package/esm/testing/fixtures/example.com/key +7 -0
- package/esm/testing/fixtures/example.com/key2 +6 -0
- package/esm/testing/fixtures/example.com/object +6 -0
- package/esm/testing/fixtures/example.com/person +22 -0
- package/esm/testing/fixtures/example.com/test +5 -0
- package/esm/testing/fixtures/example.com/users/handle +16 -0
- package/esm/testing/fixtures/example.com/wrong-type +3 -0
- package/esm/testing/fixtures/w3id.org/security/v1 +50 -0
- package/esm/testing/fixtures/www.w3.org/ns/activitystreams +379 -0
- package/esm/testing/keys.d.ts.map +1 -0
- package/esm/vocab/accept.yaml +11 -0
- package/esm/vocab/activity.yaml +42 -0
- package/esm/vocab/actor.d.ts +52 -0
- package/esm/vocab/actor.d.ts.map +1 -0
- package/esm/vocab/actor.js +94 -0
- package/esm/vocab/actor.test.d.ts.map +1 -0
- package/esm/vocab/add.yaml +12 -0
- package/esm/vocab/announce.yaml +11 -0
- package/esm/vocab/application.yaml +179 -0
- package/esm/vocab/article.yaml +8 -0
- package/esm/vocab/audio.yaml +8 -0
- package/esm/vocab/block.yaml +12 -0
- package/esm/vocab/collection.yaml +63 -0
- package/esm/vocab/collectionpage.yaml +38 -0
- package/esm/vocab/create.yaml +8 -0
- package/esm/vocab/delete.yaml +10 -0
- package/esm/vocab/dislike.yaml +8 -0
- package/esm/vocab/document.yaml +8 -0
- package/esm/vocab/endpoints.yaml +78 -0
- package/esm/vocab/event.yaml +8 -0
- package/esm/vocab/flag.yaml +11 -0
- package/esm/vocab/follow.yaml +12 -0
- package/esm/vocab/group.yaml +179 -0
- package/esm/vocab/ignore.yaml +10 -0
- package/esm/vocab/image.yaml +8 -0
- package/esm/vocab/intransitiveactivity.yaml +11 -0
- package/esm/vocab/key.yaml +25 -0
- package/esm/vocab/like.yaml +10 -0
- package/esm/vocab/link.yaml +92 -0
- package/esm/vocab/lookup.d.ts +42 -0
- package/esm/vocab/lookup.d.ts.map +1 -0
- package/esm/vocab/lookup.js +82 -0
- package/esm/vocab/lookup.test.d.ts.map +1 -0
- package/esm/vocab/mention.yaml +8 -0
- package/esm/vocab/mod.d.ts +55 -0
- package/esm/vocab/mod.d.ts.map +1 -0
- package/esm/vocab/mod.js +54 -0
- package/esm/vocab/note.yaml +10 -0
- package/esm/vocab/object.yaml +301 -0
- package/esm/vocab/orderedcollection.yaml +11 -0
- package/esm/vocab/orderedcollectionpage.yaml +20 -0
- package/esm/vocab/organization.yaml +179 -0
- package/esm/vocab/page.yaml +8 -0
- package/esm/vocab/person.yaml +179 -0
- package/esm/vocab/place.yaml +66 -0
- package/esm/vocab/profile.yaml +22 -0
- package/esm/vocab/reject.yaml +10 -0
- package/esm/vocab/relationship.yaml +46 -0
- package/esm/vocab/remove.yaml +10 -0
- package/esm/vocab/service.yaml +179 -0
- package/esm/vocab/undo.yaml +15 -0
- package/esm/vocab/update.yaml +13 -0
- package/esm/vocab/video.yaml +8 -0
- package/esm/vocab/vocab.d.ts +7191 -0
- package/esm/vocab/vocab.d.ts.map +1 -0
- package/esm/vocab/vocab.js +14279 -0
- package/esm/vocab/vocab.test.d.ts.map +1 -0
- package/esm/webfinger/handler.d.ts +29 -0
- package/esm/webfinger/handler.d.ts.map +1 -0
- package/esm/webfinger/handler.js +76 -0
- package/esm/webfinger/handler.test.d.ts.map +1 -0
- package/esm/webfinger/jrd.d.ts +52 -0
- package/esm/webfinger/jrd.d.ts.map +1 -0
- package/esm/webfinger/jrd.js +1 -0
- package/esm/webfinger/lookup.d.ts +9 -0
- package/esm/webfinger/lookup.d.ts.map +1 -0
- package/esm/webfinger/lookup.js +44 -0
- package/esm/webfinger/lookup.test.d.ts.map +1 -0
- package/esm/webfinger/mod.d.ts +8 -0
- package/esm/webfinger/mod.d.ts.map +1 -0
- package/esm/webfinger/mod.js +7 -0
- package/esm/x/fresh.d.ts +58 -0
- package/esm/x/fresh.d.ts.map +1 -0
- package/esm/x/fresh.js +77 -0
- package/logo.svg +187 -0
- package/package.json +60 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
import type { DocumentLoader } from "../runtime/docloader.js";
|
4
|
+
import { Activity, type Link, type Object } from "../vocab/vocab.js";
|
5
|
+
import type { ActorDispatcher, CollectionCounter, CollectionCursor, CollectionDispatcher, InboxErrorHandler, InboxListener } from "./callback.js";
|
6
|
+
import type { RequestContext } from "./context.js";
|
7
|
+
import type { KvKey, KvStore } from "./kv.js";
|
8
|
+
export declare function acceptsJsonLd(request: Request): boolean;
|
9
|
+
export interface ActorHandlerParameters<TContextData> {
|
10
|
+
handle: string;
|
11
|
+
context: RequestContext<TContextData>;
|
12
|
+
actorDispatcher?: ActorDispatcher<TContextData>;
|
13
|
+
onNotFound(request: Request): Response | Promise<Response>;
|
14
|
+
onNotAcceptable(request: Request): Response | Promise<Response>;
|
15
|
+
}
|
16
|
+
export declare function handleActor<TContextData>(request: Request, { handle, context, actorDispatcher, onNotFound, onNotAcceptable, }: ActorHandlerParameters<TContextData>): Promise<Response>;
|
17
|
+
/**
|
18
|
+
* Callbacks for handling a collection.
|
19
|
+
*/
|
20
|
+
export interface CollectionCallbacks<TItem, TContextData> {
|
21
|
+
/**
|
22
|
+
* A callback that dispatches a collection.
|
23
|
+
*/
|
24
|
+
dispatcher: CollectionDispatcher<TItem, TContextData>;
|
25
|
+
/**
|
26
|
+
* A callback that counts the number of items in a collection.
|
27
|
+
*/
|
28
|
+
counter?: CollectionCounter<TContextData>;
|
29
|
+
/**
|
30
|
+
* A callback that returns the first cursor for a collection.
|
31
|
+
*/
|
32
|
+
firstCursor?: CollectionCursor<TContextData>;
|
33
|
+
/**
|
34
|
+
* A callback that returns the last cursor for a collection.
|
35
|
+
*/
|
36
|
+
lastCursor?: CollectionCursor<TContextData>;
|
37
|
+
}
|
38
|
+
export interface CollectionHandlerParameters<TItem, TContextData> {
|
39
|
+
handle: string;
|
40
|
+
context: RequestContext<TContextData>;
|
41
|
+
collectionCallbacks?: CollectionCallbacks<TItem, TContextData>;
|
42
|
+
onNotFound(request: Request): Response | Promise<Response>;
|
43
|
+
onNotAcceptable(request: Request): Response | Promise<Response>;
|
44
|
+
}
|
45
|
+
export declare function handleCollection<TItem extends URL | Object | Link, TContextData>(request: Request, { handle, context, collectionCallbacks, onNotFound, onNotAcceptable, }: CollectionHandlerParameters<TItem, TContextData>): Promise<Response>;
|
46
|
+
export interface InboxHandlerParameters<TContextData> {
|
47
|
+
handle: string | null;
|
48
|
+
context: RequestContext<TContextData>;
|
49
|
+
kv: KvStore;
|
50
|
+
kvPrefix: KvKey;
|
51
|
+
actorDispatcher?: ActorDispatcher<TContextData>;
|
52
|
+
inboxListeners: Map<new (...args: unknown[]) => Activity, InboxListener<TContextData, Activity>>;
|
53
|
+
inboxErrorHandler?: InboxErrorHandler<TContextData>;
|
54
|
+
onNotFound(request: Request): Response | Promise<Response>;
|
55
|
+
}
|
56
|
+
export declare function handleInbox<TContextData>(request: Request, { handle, context, kv, kvPrefix, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, }: InboxHandlerParameters<TContextData>): Promise<Response>;
|
57
|
+
/**
|
58
|
+
* Options for the {@link respondWithObject} and
|
59
|
+
* {@link respondWithObjectIfAcceptable} functions.
|
60
|
+
*/
|
61
|
+
export interface RespondWithObjectOptions {
|
62
|
+
/**
|
63
|
+
* The document loader to use for compacting JSON-LD.
|
64
|
+
*/
|
65
|
+
documentLoader: DocumentLoader;
|
66
|
+
}
|
67
|
+
/**
|
68
|
+
* Responds with the given object in JSON-LD format.
|
69
|
+
*
|
70
|
+
* @param object The object to respond with.
|
71
|
+
* @param options Options.
|
72
|
+
*/
|
73
|
+
export declare function respondWithObject(object: Object, options?: RespondWithObjectOptions): Promise<Response>;
|
74
|
+
/**
|
75
|
+
* Responds with the given object in JSON-LD format if the request accepts
|
76
|
+
* JSON-LD.
|
77
|
+
*
|
78
|
+
* @param object The object to respond with.
|
79
|
+
* @param request The request to check for JSON-LD acceptability.
|
80
|
+
* @param options Options.
|
81
|
+
*/
|
82
|
+
export declare function respondWithObjectIfAcceptable(object: Object, request: Request, options?: RespondWithObjectOptions): Promise<Response | null>;
|
83
|
+
//# sourceMappingURL=handler.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/federation/handler.ts"],"names":[],"mappings":"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"}
|
@@ -0,0 +1,266 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
import { accepts } from "../deps/jsr.io/@std/http/0.220.1/negotiation.js";
|
3
|
+
import { doesActorOwnKey, verify } from "../httpsig/mod.js";
|
4
|
+
import { Activity, OrderedCollection, OrderedCollectionPage, } from "../vocab/vocab.js";
|
5
|
+
export function acceptsJsonLd(request) {
|
6
|
+
const types = accepts(request);
|
7
|
+
if (types == null)
|
8
|
+
return true;
|
9
|
+
if (types[0] === "text/html" || types[0] === "application/xhtml+xml") {
|
10
|
+
return false;
|
11
|
+
}
|
12
|
+
return types.includes("application/activity+json") ||
|
13
|
+
types.includes("application/ld+json") ||
|
14
|
+
types.includes("application/json");
|
15
|
+
}
|
16
|
+
export async function handleActor(request, { handle, context, actorDispatcher, onNotFound, onNotAcceptable, }) {
|
17
|
+
if (actorDispatcher == null) {
|
18
|
+
const response = onNotFound(request);
|
19
|
+
return response instanceof Promise ? await response : response;
|
20
|
+
}
|
21
|
+
if (!acceptsJsonLd(request)) {
|
22
|
+
const response = onNotAcceptable(request);
|
23
|
+
return response instanceof Promise ? await response : response;
|
24
|
+
}
|
25
|
+
const key = await context.getActorKey(handle);
|
26
|
+
const actor = await actorDispatcher(context, handle, key);
|
27
|
+
if (actor == null) {
|
28
|
+
const response = onNotFound(request);
|
29
|
+
return response instanceof Promise ? await response : response;
|
30
|
+
}
|
31
|
+
const jsonLd = await actor.toJsonLd(context);
|
32
|
+
return new Response(JSON.stringify(jsonLd), {
|
33
|
+
headers: {
|
34
|
+
"Content-Type": "application/activity+json",
|
35
|
+
Vary: "Accept",
|
36
|
+
},
|
37
|
+
});
|
38
|
+
}
|
39
|
+
export async function handleCollection(request, { handle, context, collectionCallbacks, onNotFound, onNotAcceptable, }) {
|
40
|
+
if (collectionCallbacks == null) {
|
41
|
+
const response = onNotFound(request);
|
42
|
+
return response instanceof Promise ? await response : response;
|
43
|
+
}
|
44
|
+
if (!acceptsJsonLd(request)) {
|
45
|
+
const response = onNotAcceptable(request);
|
46
|
+
return response instanceof Promise ? await response : response;
|
47
|
+
}
|
48
|
+
const url = new URL(request.url);
|
49
|
+
const cursor = url.searchParams.get("cursor");
|
50
|
+
let collection;
|
51
|
+
if (cursor == null) {
|
52
|
+
const firstCursorPromise = collectionCallbacks.firstCursor?.(context, handle);
|
53
|
+
const firstCursor = firstCursorPromise instanceof Promise
|
54
|
+
? await firstCursorPromise
|
55
|
+
: firstCursorPromise;
|
56
|
+
const totalItemsPromise = collectionCallbacks.counter?.(context, handle);
|
57
|
+
const totalItems = totalItemsPromise instanceof Promise
|
58
|
+
? await totalItemsPromise
|
59
|
+
: totalItemsPromise;
|
60
|
+
if (firstCursor == null) {
|
61
|
+
const pagePromise = collectionCallbacks.dispatcher(context, handle, null);
|
62
|
+
const page = pagePromise instanceof Promise
|
63
|
+
? await pagePromise
|
64
|
+
: pagePromise;
|
65
|
+
if (page == null) {
|
66
|
+
const response = onNotFound(request);
|
67
|
+
return response instanceof Promise ? await response : response;
|
68
|
+
}
|
69
|
+
const { items } = page;
|
70
|
+
collection = new OrderedCollection({
|
71
|
+
totalItems: totalItems == null ? null : Number(totalItems),
|
72
|
+
items,
|
73
|
+
});
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
const lastCursorPromise = collectionCallbacks.lastCursor?.(context, handle);
|
77
|
+
const lastCursor = lastCursorPromise instanceof Promise
|
78
|
+
? await lastCursorPromise
|
79
|
+
: lastCursorPromise;
|
80
|
+
const first = new URL(context.url);
|
81
|
+
first.searchParams.set("cursor", firstCursor);
|
82
|
+
let last = null;
|
83
|
+
if (lastCursor != null) {
|
84
|
+
last = new URL(context.url);
|
85
|
+
last.searchParams.set("cursor", lastCursor);
|
86
|
+
}
|
87
|
+
collection = new OrderedCollection({
|
88
|
+
totalItems: Number(totalItems),
|
89
|
+
first,
|
90
|
+
last,
|
91
|
+
});
|
92
|
+
}
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
const pagePromise = collectionCallbacks.dispatcher(context, handle, cursor);
|
96
|
+
const page = pagePromise instanceof Promise
|
97
|
+
? await pagePromise
|
98
|
+
: pagePromise;
|
99
|
+
if (page == null) {
|
100
|
+
const response = onNotFound(request);
|
101
|
+
return response instanceof Promise ? await response : response;
|
102
|
+
}
|
103
|
+
const { items, prevCursor, nextCursor } = page;
|
104
|
+
let prev = null;
|
105
|
+
if (prevCursor != null) {
|
106
|
+
prev = new URL(context.url);
|
107
|
+
prev.searchParams.set("cursor", prevCursor);
|
108
|
+
}
|
109
|
+
let next = null;
|
110
|
+
if (nextCursor != null) {
|
111
|
+
next = new URL(context.url);
|
112
|
+
next.searchParams.set("cursor", nextCursor);
|
113
|
+
}
|
114
|
+
const partOf = new URL(context.url);
|
115
|
+
partOf.searchParams.delete("cursor");
|
116
|
+
collection = new OrderedCollectionPage({ prev, next, items, partOf });
|
117
|
+
}
|
118
|
+
const jsonLd = await collection.toJsonLd(context);
|
119
|
+
return new Response(JSON.stringify(jsonLd), {
|
120
|
+
headers: {
|
121
|
+
"Content-Type": "application/activity+json",
|
122
|
+
Vary: "Accept",
|
123
|
+
},
|
124
|
+
});
|
125
|
+
}
|
126
|
+
export async function handleInbox(request, { handle, context, kv, kvPrefix, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, }) {
|
127
|
+
if (actorDispatcher == null) {
|
128
|
+
const response = onNotFound(request);
|
129
|
+
return response instanceof Promise ? await response : response;
|
130
|
+
}
|
131
|
+
else if (handle != null) {
|
132
|
+
const key = await context.getActorKey(handle);
|
133
|
+
const promise = actorDispatcher(context, handle, key);
|
134
|
+
const actor = promise instanceof Promise ? await promise : promise;
|
135
|
+
if (actor == null) {
|
136
|
+
const response = onNotFound(request);
|
137
|
+
return response instanceof Promise ? await response : response;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
const key = await verify(request, context.documentLoader);
|
141
|
+
if (key == null) {
|
142
|
+
const response = new Response("Failed to verify the request signature.", {
|
143
|
+
status: 401,
|
144
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
145
|
+
});
|
146
|
+
return response;
|
147
|
+
}
|
148
|
+
let json;
|
149
|
+
try {
|
150
|
+
json = await request.json();
|
151
|
+
}
|
152
|
+
catch (e) {
|
153
|
+
const promise = inboxErrorHandler?.(context, e);
|
154
|
+
if (promise instanceof Promise)
|
155
|
+
await promise;
|
156
|
+
return new Response("Invalid JSON.", {
|
157
|
+
status: 400,
|
158
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
159
|
+
});
|
160
|
+
}
|
161
|
+
let activity;
|
162
|
+
try {
|
163
|
+
activity = await Activity.fromJsonLd(json, context);
|
164
|
+
}
|
165
|
+
catch (e) {
|
166
|
+
const promise = inboxErrorHandler?.(context, e);
|
167
|
+
if (promise instanceof Promise)
|
168
|
+
await promise;
|
169
|
+
return new Response("Invalid activity.", {
|
170
|
+
status: 400,
|
171
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
172
|
+
});
|
173
|
+
}
|
174
|
+
const cacheKey = activity.id == null
|
175
|
+
? null
|
176
|
+
: [...kvPrefix, activity.id.href];
|
177
|
+
if (cacheKey != null) {
|
178
|
+
const cached = await kv.get(cacheKey);
|
179
|
+
if (cached === true) {
|
180
|
+
return new Response(`Activity <${activity.id}> has already been processed.`, {
|
181
|
+
status: 202,
|
182
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
183
|
+
});
|
184
|
+
}
|
185
|
+
}
|
186
|
+
if (activity.actorId == null) {
|
187
|
+
const response = new Response("Missing actor.", {
|
188
|
+
status: 400,
|
189
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
190
|
+
});
|
191
|
+
return response;
|
192
|
+
}
|
193
|
+
if (!await doesActorOwnKey(activity, key, context.documentLoader)) {
|
194
|
+
const response = new Response("The signer and the actor do not match.", {
|
195
|
+
status: 401,
|
196
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
197
|
+
});
|
198
|
+
return response;
|
199
|
+
}
|
200
|
+
// deno-lint-ignore no-explicit-any
|
201
|
+
let cls = activity
|
202
|
+
// deno-lint-ignore no-explicit-any
|
203
|
+
.constructor;
|
204
|
+
while (true) {
|
205
|
+
if (inboxListeners.has(cls))
|
206
|
+
break;
|
207
|
+
if (cls === Activity) {
|
208
|
+
return new Response("", {
|
209
|
+
status: 202,
|
210
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
211
|
+
});
|
212
|
+
}
|
213
|
+
cls = globalThis.Object.getPrototypeOf(cls);
|
214
|
+
}
|
215
|
+
const listener = inboxListeners.get(cls);
|
216
|
+
try {
|
217
|
+
const promise = listener(context, activity);
|
218
|
+
if (promise instanceof Promise)
|
219
|
+
await promise;
|
220
|
+
}
|
221
|
+
catch (e) {
|
222
|
+
const promise = inboxErrorHandler?.(context, e);
|
223
|
+
if (promise instanceof Promise)
|
224
|
+
await promise;
|
225
|
+
return new Response("Internal server error.", {
|
226
|
+
status: 500,
|
227
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
228
|
+
});
|
229
|
+
}
|
230
|
+
if (cacheKey != null) {
|
231
|
+
await kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
|
232
|
+
}
|
233
|
+
return new Response("", {
|
234
|
+
status: 202,
|
235
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
236
|
+
});
|
237
|
+
}
|
238
|
+
/**
|
239
|
+
* Responds with the given object in JSON-LD format.
|
240
|
+
*
|
241
|
+
* @param object The object to respond with.
|
242
|
+
* @param options Options.
|
243
|
+
*/
|
244
|
+
export async function respondWithObject(object, options) {
|
245
|
+
const jsonLd = await object.toJsonLd(options);
|
246
|
+
return new Response(JSON.stringify(jsonLd), {
|
247
|
+
headers: {
|
248
|
+
"Content-Type": "application/activity+json",
|
249
|
+
},
|
250
|
+
});
|
251
|
+
}
|
252
|
+
/**
|
253
|
+
* Responds with the given object in JSON-LD format if the request accepts
|
254
|
+
* JSON-LD.
|
255
|
+
*
|
256
|
+
* @param object The object to respond with.
|
257
|
+
* @param request The request to check for JSON-LD acceptability.
|
258
|
+
* @param options Options.
|
259
|
+
*/
|
260
|
+
export async function respondWithObjectIfAcceptable(object, request, options) {
|
261
|
+
if (!acceptsJsonLd(request))
|
262
|
+
return null;
|
263
|
+
const response = await respondWithObject(object, options);
|
264
|
+
response.headers.set("Vary", "Accept");
|
265
|
+
return response;
|
266
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"handler.test.d.ts","sourceRoot":"","sources":["../../src/federation/handler.test.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
/**
|
3
|
+
* A key for a key-value store. An array of one or more strings.
|
4
|
+
*/
|
5
|
+
export type KvKey = readonly [string] | readonly [string, ...string[]];
|
6
|
+
/**
|
7
|
+
* Additional options for setting a value in a key-value store.
|
8
|
+
*/
|
9
|
+
export interface KvStoreSetOptions {
|
10
|
+
/**
|
11
|
+
* The time-to-live (TTL) for the value.
|
12
|
+
*/
|
13
|
+
ttl?: Temporal.Duration;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* An abstract interface for a key-value store.
|
17
|
+
*/
|
18
|
+
export interface KvStore {
|
19
|
+
/**
|
20
|
+
* Gets the value for the given key.
|
21
|
+
* @param key The key to get the value for.
|
22
|
+
* @returns The value for the key, or `undefined` if the key does not exist.
|
23
|
+
* @typeParam T The type of the value to get.
|
24
|
+
*/
|
25
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
26
|
+
/**
|
27
|
+
* Sets the value for the given key.
|
28
|
+
* @param key The key to set the value for.
|
29
|
+
* @param value The value to set.
|
30
|
+
* @param options Additional options for setting the value.
|
31
|
+
*/
|
32
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
33
|
+
/**
|
34
|
+
* Deletes the value for the given key.
|
35
|
+
* @param key The key to delete.
|
36
|
+
*/
|
37
|
+
delete(key: KvKey): Promise<void>;
|
38
|
+
}
|
39
|
+
/**
|
40
|
+
* A key-value store that stores values in memory.
|
41
|
+
* Do not use this in production as it does not persist values.
|
42
|
+
*/
|
43
|
+
export declare class MemoryKvStore implements KvStore {
|
44
|
+
#private;
|
45
|
+
/**
|
46
|
+
* {@inheritDoc KvStore.get}
|
47
|
+
*/
|
48
|
+
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
49
|
+
/**
|
50
|
+
* {@inheritDoc KvStore.set}
|
51
|
+
*/
|
52
|
+
set(key: KvKey, value: unknown, options?: KvStoreSetOptions): Promise<void>;
|
53
|
+
/**
|
54
|
+
* {@inheritDoc KvStore.delete}
|
55
|
+
*/
|
56
|
+
delete(key: KvKey): Promise<void>;
|
57
|
+
}
|
58
|
+
//# sourceMappingURL=kv.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"kv.d.ts","sourceRoot":"","sources":["../../src/federation/kv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;OAKG;IACH,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAErD;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,qBAAa,aAAc,YAAW,OAAO;;IAO3C;;OAEG;IACH,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAcpD;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAS3E;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;CAKlC"}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
2
|
+
/**
|
3
|
+
* A key-value store that stores values in memory.
|
4
|
+
* Do not use this in production as it does not persist values.
|
5
|
+
*/
|
6
|
+
export class MemoryKvStore {
|
7
|
+
#values = {};
|
8
|
+
#encodeKey(key) {
|
9
|
+
return JSON.stringify(key);
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* {@inheritDoc KvStore.get}
|
13
|
+
*/
|
14
|
+
get(key) {
|
15
|
+
const encodedKey = this.#encodeKey(key);
|
16
|
+
const entry = this.#values[encodedKey];
|
17
|
+
if (entry == null)
|
18
|
+
return Promise.resolve(undefined);
|
19
|
+
const [value, expiration] = entry;
|
20
|
+
if (expiration != null && Temporal.Now.instant().until(expiration).sign < 0) {
|
21
|
+
delete this.#values[encodedKey];
|
22
|
+
return Promise.resolve(undefined);
|
23
|
+
}
|
24
|
+
return Promise.resolve(value);
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* {@inheritDoc KvStore.set}
|
28
|
+
*/
|
29
|
+
set(key, value, options) {
|
30
|
+
const encodedKey = this.#encodeKey(key);
|
31
|
+
const expiration = options?.ttl == null
|
32
|
+
? null
|
33
|
+
: Temporal.Now.instant().add(options.ttl.round({ largestUnit: "hour" }));
|
34
|
+
this.#values[encodedKey] = [value, expiration];
|
35
|
+
return Promise.resolve();
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* {@inheritDoc KvStore.delete}
|
39
|
+
*/
|
40
|
+
delete(key) {
|
41
|
+
const encodedKey = this.#encodeKey(key);
|
42
|
+
delete this.#values[encodedKey];
|
43
|
+
return Promise.resolve();
|
44
|
+
}
|
45
|
+
}
|