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