@fedify/fedify 2.0.0-pr.445.1694 → 2.0.0-pr.451.1730
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/dist/{actor-T6RyhRgk.d.ts → actor-Cd2CREO0.d.ts} +2 -2
- package/dist/{actor-D8gCwLzv.js → actor-Cg8ZhoVF.js} +1 -1
- package/dist/{actor-CwZ2m5rG.cjs → actor-D020hlx3.cjs} +922 -1451
- package/dist/{actor-D6K058Tb.d.cts → actor-DDhZuMGl.d.cts} +2 -2
- package/dist/{actor-DoMcqXsW.js → actor-DPD6Gbdn.js} +190 -677
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
- package/dist/{builder-1_skw-d2.js → builder-Dn87hy75.js} +7 -8
- package/dist/{client-bgSdkFa2.d.ts → client-Bkaw0_PR.d.ts} +1 -1
- package/dist/{client-CegPX0Rn.d.cts → client-Cle5j1T1.d.cts} +1 -1
- package/dist/{client-D5CBsPrc.js → client-D6-5okV1.js} +1 -1
- package/dist/compat/mod.d.cts +11 -11
- package/dist/compat/mod.d.ts +12 -12
- package/dist/compat/transformers.test.js +20 -20
- package/dist/{context-DiqjMRef.d.cts → context-BOYzcFSe.d.cts} +130 -97
- package/dist/{context-DBKpNBnc.d.ts → context-DqFifMwj.d.ts} +131 -98
- package/dist/{authdocloader-DYTNpaMA.js → docloader-B2BFBGqv.js} +18 -8
- package/dist/{esm-Dl5T1RNE.js → esm-CU0Dnk7T.js} +11 -11
- package/dist/federation/builder.test.js +8 -10
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +25 -26
- package/dist/federation/idempotency.test.js +25 -26
- package/dist/federation/inbox.test.js +4 -6
- package/dist/federation/keycache.test.js +3 -4
- package/dist/federation/kv.test.js +6 -8
- package/dist/federation/middleware.test.js +26 -27
- package/dist/federation/mod.cjs +10 -11
- package/dist/federation/mod.d.cts +11 -11
- package/dist/federation/mod.d.ts +13 -13
- package/dist/federation/mod.js +10 -11
- package/dist/federation/mq.test.js +8 -10
- package/dist/federation/negotiation.test.js +7 -9
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +13 -15
- package/dist/{http-D-e6AFwR.d.cts → http-B6SKO6NJ.d.cts} +2 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-BE7aFuqn.d.ts} +2 -2
- package/dist/{http-CAusBl_3.cjs → http-DMsjudj8.cjs} +289 -9
- package/dist/{http-CuS-d4U0.js → http-DN0v2zoF.js} +2 -2
- package/dist/{http-C_Qc2neP.js → http-DcDb8r1W.js} +256 -6
- package/dist/{inbox-IETv_Qez.js → inbox-CgGy7Hzc.js} +1 -1
- package/dist/{key-DnqhSgAv.js → key-jSvnymAk.js} +3 -2
- package/dist/{keycache-CSBkusP8.js → keycache-IVLjlAK9.js} +1 -1
- package/dist/{keys-D3_MDK7n.js → keys-BKM2Mqu2.js} +2 -1
- package/dist/{docloader-CYnQRIXv.cjs → kv-cache-BHIupktM.cjs} +69 -651
- package/dist/kv-cache-DNvS-egZ.js +4236 -0
- package/dist/{docloader-Czl3xV10.js → kv-cache-ydIs4Ul6.js} +68 -596
- package/dist/{ld-Isot0tiW.js → ld-CcsryBo0.js} +3 -2
- package/dist/{lookup-Dhm78GlK.js → lookup-BV3A9Zbc.js} +63 -2
- package/dist/{type-DaUr3Il7.js → lookup-BbEekiru.js} +588 -5303
- package/dist/{lookup-D6dro5Au.cjs → lookup-CMAGfQ1Q.cjs} +78 -5
- package/dist/{middleware-BuHr2fzh.js → middleware-D-vPitR-.js} +37 -38
- package/dist/{middleware-DQYscW90.js → middleware-Dm8sXYUr.js} +40 -40
- package/dist/middleware-DzA970CF.js +16 -0
- package/dist/middleware-VpoC5jyA.js +26 -0
- package/dist/middleware-W_-inBoE.cjs +16 -0
- package/dist/{middleware-Dgmdgrvb.cjs → middleware-ekn2KaOw.cjs} +57 -58
- package/dist/{mod-CxkWO3Mg.d.cts → mod--K7l84wp.d.cts} +3 -2
- package/dist/{mod-DBzN0aCM.d.ts → mod-CB80AlIA.d.ts} +1 -1
- package/dist/mod-CLKu6Uo_.d.cts +107 -0
- package/dist/{mod-Djzcw2ry.d.cts → mod-COlOrmr9.d.cts} +3 -3
- package/dist/{mod-DlU8ISoa.d.ts → mod-CRENK2dd.d.ts} +3 -2
- package/dist/{mod-D_y2y32N.d.ts → mod-CaWbCg0N.d.ts} +2 -2
- package/dist/mod-Cm97bAiT.d.ts +109 -0
- package/dist/{mod-Bpb5QLaZ.d.cts → mod-D9XZsft2.d.cts} +2 -2
- package/dist/{mod-BhUKmBJD.d.ts → mod-DLIidI_j.d.ts} +3 -3
- package/dist/{mod-jQ4OODsl.d.cts → mod-DuclhZjh.d.cts} +1 -1
- package/dist/mod.cjs +21 -32
- package/dist/mod.d.cts +14 -14
- package/dist/mod.d.ts +17 -17
- package/dist/mod.js +15 -16
- package/dist/nodeinfo/client.test.js +8 -10
- package/dist/nodeinfo/handler.test.js +24 -25
- package/dist/nodeinfo/mod.cjs +3 -3
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +3 -4
- package/dist/nodeinfo/mod.js +3 -3
- package/dist/nodeinfo/types.test.js +7 -9
- package/dist/{owner-hd9lvQcP.d.ts → owner-CktUdA0h.d.ts} +3 -3
- package/dist/{owner-BN_tO3cY.d.cts → owner-dkg5OpSC.d.cts} +3 -3
- package/dist/{owner-ChSL4aJ7.js → owner-n5c_oZ_M.js} +3 -2
- package/dist/{proof-BiSCuwyA.js → proof-CLwByIT1.js} +5 -4
- package/dist/{proof-ONNmhInb.cjs → proof-CZfrp13P.cjs} +17 -16
- package/dist/{proof-x3IBewan.js → proof-CsFR7fiS.js} +2 -2
- package/dist/request-BbHkedIU.d.cts +35 -0
- package/dist/request-DKGQaofB.js +184 -0
- package/dist/request-U1t6zZtk.d.ts +39 -0
- package/dist/request-XHWUW2bi.cjs +208 -0
- package/dist/{send-D5fjmUEj.js → send-eW9JIzQV.js} +2 -2
- package/dist/sig/http.test.js +12 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +10 -11
- package/dist/sig/mod.d.cts +6 -7
- package/dist/sig/mod.d.ts +6 -7
- package/dist/sig/mod.js +6 -7
- package/dist/sig/owner.test.js +10 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/testing/docloader.test.js +6 -8
- package/dist/testing/mod.d.ts +122 -148
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-tWr1VQxx.js → testing-ClYSmXdi.js} +1 -2
- package/dist/{types-D2Nyz0tR.cjs → types-BT0xc4-R.cjs} +3 -3
- package/dist/{types-DQuSDtDg.js → types-DaPoJTSc.js} +1 -1
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +13 -15
- package/dist/utils/kv-cache.test.js +208 -0
- package/dist/utils/mod.cjs +14 -0
- package/dist/utils/mod.d.cts +6 -0
- package/dist/utils/mod.d.ts +8 -0
- package/dist/utils/mod.js +12 -0
- package/dist/utils/request.test.js +48 -0
- package/dist/utils/url.test.js +41 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +7 -9
- package/dist/vocab/mod.cjs +4 -4
- package/dist/vocab/mod.d.cts +4 -5
- package/dist/vocab/mod.d.ts +4 -5
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +9 -10
- package/dist/{vocab-Dd4VMrr0.cjs → vocab-CxTuoEVd.cjs} +6 -5
- package/dist/{vocab-Dw1-yVGg.d.cts → vocab-DCBw44JZ.d.cts} +2 -21
- package/dist/{vocab-BI0Ak5lL.d.ts → vocab-ivDKb439.d.ts} +2 -21
- package/dist/{vocab-w--qk7HF.js → vocab-yFT-fQBj.js} +4 -3
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +3 -3
- package/dist/webfinger/mod.d.cts +2 -3
- package/dist/webfinger/mod.d.ts +2 -3
- package/dist/webfinger/mod.js +3 -3
- package/dist/x/cfworkers.d.cts +1 -1
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.d.cts +10 -10
- package/dist/x/hono.d.ts +11 -11
- package/dist/x/sveltekit.d.cts +10 -10
- package/dist/x/sveltekit.d.ts +11 -11
- package/package.json +16 -14
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-Cv_qEn1G.js +0 -52
- package/dist/authdocloader-bsmVF6eO.cjs +0 -58
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/key-BNJQQm3h.js +0 -260
- package/dist/key-C_ruQbbl.js +0 -10
- package/dist/key-DIMJMxf4.cjs +0 -10
- package/dist/key-DpFjiItf.js +0 -10
- package/dist/key-DuXv64tg.cjs +0 -290
- package/dist/lookup-CbtuFbtg.js +0 -331
- package/dist/middleware-BpR6186a.js +0 -26
- package/dist/middleware-DDMxdtWM.cjs +0 -17
- package/dist/middleware-T-knSMwl.js +0 -17
- package/dist/mod-CerN_Sza.d.ts +0 -104
- package/dist/mod-Cj1tHXBR.d.cts +0 -102
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/link.test.js +0 -61
- package/dist/runtime/mod.cjs +0 -25
- package/dist/runtime/mod.d.cts +0 -6
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.js +0 -45
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{collection-CcnIw1qY.js → collection-BzWsN9pB.js} +0 -0
- /package/dist/{denokv-Bv33Xxea.js → denokv-CCssOzMJ.js} +0 -0
- /package/dist/{federation-H2_En3j5.cjs → federation-DOuZpcAw.cjs} +0 -0
- /package/dist/{federation-D1U8YY9t.js → federation-pZJsapBn.js} +0 -0
- /package/dist/{kv-63Cil1MD.d.cts → kv-BMKIFXNW.d.cts} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-Dt06smFt.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-B-ZQqbGe.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-CjsiSl7_.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CPRJk4mZ.d.ts} +0 -0
- /package/dist/{negotiation-5NPJL6zp.js → negotiation-C4nFufNk.js} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-B0UefMXO.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-ByTd7HpT.cjs} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-DE_NC_VQ.cjs} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-Dx59zAgn.js} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{types-BSuWJsOm.js → types-C2XVl6gj.js} +0 -0
- /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/request.test.d.ts} +0 -0
- /package/dist/{runtime → utils}/url.test.d.ts +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-B6yXfxAQ.cjs} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-BXMGcmqK.js} +0 -0
- /package/dist/{webfinger-BjOEdFPs.cjs → webfinger-C949bxcD.cjs} +0 -0
- /package/dist/{webfinger-De_bU0iE.js → webfinger-qG8R5jc3.js} +0 -0
@@ -4,7 +4,7 @@
|
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
6
|
import { AssertionError } from "./assert_equals-DSbWqCm3.js";
|
7
|
-
import { assertIsError } from "./
|
7
|
+
import { assertIsError } from "./assert_throws-BNXdRGWP.js";
|
8
8
|
|
9
9
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_false.js
|
10
10
|
/**
|
@@ -45,4 +45,34 @@ import { AssertionError, stripAnsiCode } from "./assert_equals-DSbWqCm3.js";
|
|
45
45
|
}
|
46
46
|
|
47
47
|
//#endregion
|
48
|
-
|
48
|
+
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_throws.js
|
49
|
+
function assertThrows(fn, errorClassOrMsg, msgIncludesOrMsg, msg) {
|
50
|
+
let ErrorClass = void 0;
|
51
|
+
let msgIncludes = void 0;
|
52
|
+
let err;
|
53
|
+
if (typeof errorClassOrMsg !== "string") if (errorClassOrMsg === void 0 || errorClassOrMsg?.prototype instanceof Error || errorClassOrMsg?.prototype === Error.prototype) {
|
54
|
+
ErrorClass = errorClassOrMsg;
|
55
|
+
msgIncludes = msgIncludesOrMsg;
|
56
|
+
} else msg = msgIncludesOrMsg;
|
57
|
+
else msg = errorClassOrMsg;
|
58
|
+
let doesThrow = false;
|
59
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
60
|
+
try {
|
61
|
+
fn();
|
62
|
+
} catch (error) {
|
63
|
+
if (ErrorClass) {
|
64
|
+
if (error instanceof Error === false) throw new AssertionError(`A non-Error object was thrown${msgSuffix}`);
|
65
|
+
assertIsError(error, ErrorClass, msgIncludes, msg);
|
66
|
+
}
|
67
|
+
err = error;
|
68
|
+
doesThrow = true;
|
69
|
+
}
|
70
|
+
if (!doesThrow) {
|
71
|
+
msg = `Expected function to throw${msgSuffix}`;
|
72
|
+
throw new AssertionError(msg);
|
73
|
+
}
|
74
|
+
return err;
|
75
|
+
}
|
76
|
+
|
77
|
+
//#endregion
|
78
|
+
export { assertIsError, assertThrows };
|
@@ -3,9 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default, getTypeId } from "./
|
7
|
-
import {
|
8
|
-
import { InboxListenerSet } from "./inbox-IETv_Qez.js";
|
6
|
+
import { Router, RouterError, deno_default, getTypeId } from "./lookup-BbEekiru.js";
|
7
|
+
import { InboxListenerSet } from "./inbox-CgGy7Hzc.js";
|
9
8
|
import { getLogger } from "@logtape/logtape";
|
10
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
11
10
|
|
@@ -43,7 +42,7 @@ var FederationBuilderImpl = class {
|
|
43
42
|
this.collectionTypeIds = {};
|
44
43
|
}
|
45
44
|
async build(options) {
|
46
|
-
const { FederationImpl } = await import("./middleware-
|
45
|
+
const { FederationImpl } = await import("./middleware-VpoC5jyA.js");
|
47
46
|
const f = new FederationImpl(options);
|
48
47
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
49
48
|
f.router = this.router.clone();
|
@@ -496,11 +495,11 @@ var FederationBuilderImpl = class {
|
|
496
495
|
};
|
497
496
|
return setters;
|
498
497
|
}
|
499
|
-
setCollectionDispatcher(name,
|
500
|
-
return this.#setCustomCollectionDispatcher(name, "collection",
|
498
|
+
setCollectionDispatcher(name, itemType, path, dispatcher) {
|
499
|
+
return this.#setCustomCollectionDispatcher(name, "collection", itemType, path, dispatcher);
|
501
500
|
}
|
502
|
-
setOrderedCollectionDispatcher(name,
|
503
|
-
return this.#setCustomCollectionDispatcher(name, "orderedCollection",
|
501
|
+
setOrderedCollectionDispatcher(name, itemType, path, dispatcher) {
|
502
|
+
return this.#setCustomCollectionDispatcher(name, "orderedCollection", itemType, path, dispatcher);
|
504
503
|
}
|
505
504
|
#setCustomCollectionDispatcher(name, collectionType, itemType, path, dispatcher) {
|
506
505
|
const strName = String(name);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { GetUserAgentOptions } from "./
|
3
|
+
import { GetUserAgentOptions } from "./request-U1t6zZtk.js";
|
4
4
|
|
5
5
|
//#region src/nodeinfo/types.d.ts
|
6
6
|
/**
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { getUserAgent } from "./
|
6
|
+
import { getUserAgent } from "./lookup-BbEekiru.js";
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
8
8
|
|
9
9
|
//#region src/nodeinfo/client.ts
|
package/dist/compat/mod.d.cts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
import "../
|
2
|
-
import "../
|
3
|
-
import "../
|
4
|
-
import "../
|
5
|
-
import "../
|
6
|
-
import "../
|
7
|
-
import "../
|
8
|
-
import "../mod-
|
9
|
-
import "../
|
10
|
-
import
|
1
|
+
import "../request-BbHkedIU.cjs";
|
2
|
+
import "../client-Cle5j1T1.cjs";
|
3
|
+
import "../vocab-DCBw44JZ.cjs";
|
4
|
+
import "../actor-DDhZuMGl.cjs";
|
5
|
+
import "../http-B6SKO6NJ.cjs";
|
6
|
+
import "../owner-dkg5OpSC.cjs";
|
7
|
+
import "../mod--K7l84wp.cjs";
|
8
|
+
import "../mod-DuclhZjh.cjs";
|
9
|
+
import { ActivityTransformer } from "../context-BOYzcFSe.cjs";
|
10
|
+
import "../kv-BMKIFXNW.cjs";
|
11
11
|
import "../mq-B7R1Q-M5.cjs";
|
12
|
-
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-
|
12
|
+
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-D9XZsft2.cjs";
|
13
13
|
export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
|
package/dist/compat/mod.d.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import "../
|
4
|
-
import "../
|
5
|
-
import "../
|
6
|
-
import "../
|
7
|
-
import "../
|
8
|
-
import "../
|
9
|
-
import "../
|
10
|
-
import "../mod-
|
11
|
-
import "../
|
12
|
-
import
|
13
|
-
import "../mq-
|
14
|
-
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-
|
3
|
+
import "../request-U1t6zZtk.js";
|
4
|
+
import "../client-Bkaw0_PR.js";
|
5
|
+
import "../vocab-ivDKb439.js";
|
6
|
+
import "../actor-Cd2CREO0.js";
|
7
|
+
import "../http-BE7aFuqn.js";
|
8
|
+
import "../owner-CktUdA0h.js";
|
9
|
+
import "../mod-CRENK2dd.js";
|
10
|
+
import "../mod-CB80AlIA.js";
|
11
|
+
import { ActivityTransformer } from "../context-DqFifMwj.js";
|
12
|
+
import "../kv-Dt06smFt.js";
|
13
|
+
import "../mq-CPRJk4mZ.js";
|
14
|
+
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "../mod-CaWbCg0N.js";
|
15
15
|
export { ActivityTransformer, actorDehydrator, autoIdAssigner, getDefaultActivityTransformers };
|
@@ -3,30 +3,30 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { Follow, Person } from "../
|
6
|
+
import { Follow, Person } from "../lookup-BbEekiru.js";
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
9
9
|
import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
11
|
-
import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-
|
12
|
-
import "../client-
|
13
|
-
import "../
|
14
|
-
import "../
|
15
|
-
import "../
|
16
|
-
import "../
|
17
|
-
import "../
|
18
|
-
import "../
|
19
|
-
import "../
|
20
|
-
import "../
|
21
|
-
import "../
|
22
|
-
import "../inbox-
|
23
|
-
import "../builder-
|
24
|
-
import "../collection-
|
25
|
-
import "../keycache-
|
26
|
-
import "../negotiation-
|
27
|
-
import "../retry-
|
28
|
-
import "../send-
|
29
|
-
import { test } from "../testing-
|
11
|
+
import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-Dm8sXYUr.js";
|
12
|
+
import "../client-D6-5okV1.js";
|
13
|
+
import "../types-C2XVl6gj.js";
|
14
|
+
import "../actor-Cg8ZhoVF.js";
|
15
|
+
import "../key-jSvnymAk.js";
|
16
|
+
import "../http-DN0v2zoF.js";
|
17
|
+
import "../ld-CcsryBo0.js";
|
18
|
+
import "../owner-n5c_oZ_M.js";
|
19
|
+
import "../proof-CsFR7fiS.js";
|
20
|
+
import "../docloader-B2BFBGqv.js";
|
21
|
+
import "../kv-cache-DNvS-egZ.js";
|
22
|
+
import "../inbox-CgGy7Hzc.js";
|
23
|
+
import "../builder-Dn87hy75.js";
|
24
|
+
import "../collection-BzWsN9pB.js";
|
25
|
+
import "../keycache-IVLjlAK9.js";
|
26
|
+
import "../negotiation-C4nFufNk.js";
|
27
|
+
import "../retry-CfF8Gn4d.js";
|
28
|
+
import "../send-eW9JIzQV.js";
|
29
|
+
import { test } from "../testing-ClYSmXdi.js";
|
30
30
|
|
31
31
|
//#region src/compat/transformers.test.ts
|
32
32
|
const federation = new FederationImpl({ kv: new MemoryKvStore() });
|
@@ -1,13 +1,14 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
1
|
+
import { GetUserAgentOptions } from "./request-BbHkedIU.cjs";
|
2
|
+
import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-Cle5j1T1.cjs";
|
3
|
+
import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-DCBw44JZ.cjs";
|
4
|
+
import { Actor, Recipient } from "./actor-DDhZuMGl.cjs";
|
5
|
+
import { HttpMessageSignaturesSpec } from "./http-B6SKO6NJ.cjs";
|
6
|
+
import { GetKeyOwnerOptions } from "./owner-dkg5OpSC.cjs";
|
7
|
+
import { LookupObjectOptions, TraverseCollectionOptions } from "./mod--K7l84wp.cjs";
|
8
|
+
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-DuclhZjh.cjs";
|
9
|
+
import { KvKey, KvStore } from "./kv-BMKIFXNW.cjs";
|
10
10
|
import { MessageQueue } from "./mq-B7R1Q-M5.cjs";
|
11
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory } from "@fedify/vocab-runtime";
|
11
12
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
12
13
|
|
13
14
|
//#region src/compat/types.d.ts
|
@@ -281,7 +282,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
|
|
281
282
|
* the entire collection without pagination.
|
282
283
|
* @since 1.8.0
|
283
284
|
*/
|
284
|
-
type CustomCollectionDispatcher<TItem,
|
285
|
+
type CustomCollectionDispatcher<TItem, TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>, cursor: string | null) => PageItems<TItem> | null | Promise<PageItems<TItem> | null>;
|
285
286
|
/**
|
286
287
|
* A callback that counts the number of items in a custom collection.
|
287
288
|
*
|
@@ -291,7 +292,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
|
|
291
292
|
* @param values The parameters of the requested URL.
|
292
293
|
* @since 1.8.0
|
293
294
|
*/
|
294
|
-
type CustomCollectionCounter<
|
295
|
+
type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
|
295
296
|
/**
|
296
297
|
* A callback that returns a cursor for a custom collection.
|
297
298
|
*
|
@@ -304,10 +305,9 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
|
|
304
305
|
* @param values The parameters of the requested URL.
|
305
306
|
* @since 1.8.0
|
306
307
|
*/
|
307
|
-
type CustomCollectionCursor<
|
308
|
+
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
308
309
|
//#endregion
|
309
310
|
//#region src/federation/handler.d.ts
|
310
|
-
|
311
311
|
/**
|
312
312
|
* Options for the {@link respondWithObject} and
|
313
313
|
* {@link respondWithObjectIfAcceptable} functions.
|
@@ -702,7 +702,7 @@ interface Federatable<TContextData> {
|
|
702
702
|
* @returns An object with methods to set other actor dispatcher callbacks.
|
703
703
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
704
704
|
*/
|
705
|
-
setActorDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
705
|
+
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
706
706
|
/**
|
707
707
|
* Registers an object dispatcher.
|
708
708
|
*
|
@@ -766,7 +766,7 @@ interface Federatable<TContextData> {
|
|
766
766
|
*/
|
767
767
|
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
768
768
|
typeId: URL;
|
769
|
-
}, path: `${string}
|
769
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
770
770
|
/**
|
771
771
|
* Registers an object dispatcher.
|
772
772
|
*
|
@@ -782,7 +782,7 @@ interface Federatable<TContextData> {
|
|
782
782
|
*/
|
783
783
|
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
784
784
|
typeId: URL;
|
785
|
-
}, path: `${string}
|
785
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
786
786
|
/**
|
787
787
|
* Registers an object dispatcher.
|
788
788
|
*
|
@@ -798,7 +798,7 @@ interface Federatable<TContextData> {
|
|
798
798
|
*/
|
799
799
|
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: (new (...args: any[]) => TObject) & {
|
800
800
|
typeId: URL;
|
801
|
-
}, path: `${string}
|
801
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
802
802
|
/**
|
803
803
|
* Registers an inbox dispatcher.
|
804
804
|
*
|
@@ -810,7 +810,7 @@ interface Federatable<TContextData> {
|
|
810
810
|
* @param dispatcher An inbox dispatcher callback to register.
|
811
811
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
812
812
|
*/
|
813
|
-
setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
813
|
+
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
814
814
|
/**
|
815
815
|
* Registers an outbox dispatcher.
|
816
816
|
*
|
@@ -834,7 +834,7 @@ interface Federatable<TContextData> {
|
|
834
834
|
* @param dispatcher An outbox dispatcher callback to register.
|
835
835
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
836
836
|
*/
|
837
|
-
setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
837
|
+
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
838
838
|
/**
|
839
839
|
* Registers a following collection dispatcher.
|
840
840
|
* @param path The URI path pattern for the following collection. The syntax
|
@@ -846,7 +846,7 @@ interface Federatable<TContextData> {
|
|
846
846
|
* callbacks.
|
847
847
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
848
848
|
*/
|
849
|
-
setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
849
|
+
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
850
850
|
/**
|
851
851
|
* Registers a followers collection dispatcher.
|
852
852
|
* @param path The URI path pattern for the followers collection. The syntax
|
@@ -858,7 +858,7 @@ interface Federatable<TContextData> {
|
|
858
858
|
* callbacks.
|
859
859
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
860
860
|
*/
|
861
|
-
setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
861
|
+
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
862
862
|
/**
|
863
863
|
* Registers a liked collection dispatcher.
|
864
864
|
* @param path The URI path pattern for the liked collection. The syntax
|
@@ -870,7 +870,7 @@ interface Federatable<TContextData> {
|
|
870
870
|
* callbacks.
|
871
871
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
872
872
|
*/
|
873
|
-
setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
873
|
+
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
874
874
|
/**
|
875
875
|
* Registers a featured collection dispatcher.
|
876
876
|
* @param path The URI path pattern for the featured collection. The syntax
|
@@ -882,7 +882,7 @@ interface Federatable<TContextData> {
|
|
882
882
|
* callbacks.
|
883
883
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
884
884
|
*/
|
885
|
-
setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
885
|
+
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
886
886
|
/**
|
887
887
|
* Registers a featured tags collection dispatcher.
|
888
888
|
* @param path The URI path pattern for the featured tags collection.
|
@@ -894,7 +894,7 @@ interface Federatable<TContextData> {
|
|
894
894
|
* callbacks.
|
895
895
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
896
896
|
*/
|
897
|
-
setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
897
|
+
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
898
898
|
/**
|
899
899
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
900
900
|
*
|
@@ -924,7 +924,41 @@ interface Federatable<TContextData> {
|
|
924
924
|
* @returns An object to register inbox listeners.
|
925
925
|
* @throws {RouteError} Thrown if the path pattern is invalid.
|
926
926
|
*/
|
927
|
-
setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
927
|
+
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
928
|
+
/**
|
929
|
+
* Registers a collection of objects dispatcher.
|
930
|
+
*
|
931
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
932
|
+
* @template TObject The type of objects to dispatch.
|
933
|
+
* @template TParam The parameter names of the requested URL.
|
934
|
+
* @param name A unique name for the collection dispatcher.
|
935
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
936
|
+
* @param path The URI path pattern for the collection dispatcher.
|
937
|
+
* The syntax is based on URI Template
|
938
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
939
|
+
* The path must have one or more variables.
|
940
|
+
* @param dispatcher A collection dispatcher callback to register.
|
941
|
+
*/
|
942
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
943
|
+
typeId: URL;
|
944
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
945
|
+
/**
|
946
|
+
* Registers a collection of objects dispatcher.
|
947
|
+
*
|
948
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
949
|
+
* @template TObject The type of objects to dispatch.
|
950
|
+
* @template TParam The parameter names of the requested URL.
|
951
|
+
* @param name A unique name for the collection dispatcher.
|
952
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
953
|
+
* @param path The URI path pattern for the collection dispatcher.
|
954
|
+
* The syntax is based on URI Template
|
955
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
956
|
+
* The path must have one or more variables.
|
957
|
+
* @param dispatcher A collection dispatcher callback to register.
|
958
|
+
*/
|
959
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
960
|
+
typeId: URL;
|
961
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
928
962
|
/**
|
929
963
|
* Registers a collection of objects dispatcher.
|
930
964
|
*
|
@@ -939,7 +973,43 @@ interface Federatable<TContextData> {
|
|
939
973
|
* The path must have one or more variables.
|
940
974
|
* @param dispatcher A collection dispatcher callback to register.
|
941
975
|
*/
|
942
|
-
setCollectionDispatcher<TObject extends Object$1,
|
976
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
977
|
+
typeId: URL;
|
978
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
979
|
+
/**
|
980
|
+
* Registers an ordered collection of objects dispatcher.
|
981
|
+
*
|
982
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
983
|
+
* @template TObject The type of objects to dispatch.
|
984
|
+
* @template TParam The parameter names of the requested URL.
|
985
|
+
* @param name A unique name for the collection dispatcher.
|
986
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
987
|
+
* @param path The URI path pattern for the collection dispatcher.
|
988
|
+
* The syntax is based on URI Template
|
989
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
990
|
+
* The path must have one or more variables.
|
991
|
+
* @param dispatcher A collection dispatcher callback to register.
|
992
|
+
*/
|
993
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
994
|
+
typeId: URL;
|
995
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
996
|
+
/**
|
997
|
+
* Registers an ordered collection of objects dispatcher.
|
998
|
+
*
|
999
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
1000
|
+
* @template TObject The type of objects to dispatch.
|
1001
|
+
* @template TParam The parameter names of the requested URL.
|
1002
|
+
* @param name A unique name for the collection dispatcher.
|
1003
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
1004
|
+
* @param path The URI path pattern for the collection dispatcher.
|
1005
|
+
* The syntax is based on URI Template
|
1006
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
1007
|
+
* The path must have one or more variables.
|
1008
|
+
* @param dispatcher A collection dispatcher callback to register.
|
1009
|
+
*/
|
1010
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
1011
|
+
typeId: URL;
|
1012
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
943
1013
|
/**
|
944
1014
|
* Registers an ordered collection of objects dispatcher.
|
945
1015
|
*
|
@@ -954,7 +1024,9 @@ interface Federatable<TContextData> {
|
|
954
1024
|
* The path must have one or more variables.
|
955
1025
|
* @param dispatcher A collection dispatcher callback to register.
|
956
1026
|
*/
|
957
|
-
setOrderedCollectionDispatcher<TObject extends Object$1,
|
1027
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: (new (...args: any[]) => TObject) & {
|
1028
|
+
typeId: URL;
|
1029
|
+
}, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
958
1030
|
}
|
959
1031
|
/**
|
960
1032
|
* An object that registers federation-related business logic and dispatches
|
@@ -1426,38 +1498,38 @@ interface FederationFetchOptions<TContextData> {
|
|
1426
1498
|
/**
|
1427
1499
|
* Additional settings for a custom collection dispatcher.
|
1428
1500
|
*
|
1429
|
-
* @template
|
1501
|
+
* @template TParam The type of the parameters in the URL path.
|
1430
1502
|
* @template TContext The type of the context. {@link Context} or
|
1431
1503
|
* {@link RequestContext}.
|
1432
1504
|
* @template TContextData The context data to pass to the {@link Context}.
|
1433
1505
|
* @template TFilter The type of filter for the collection.
|
1434
1506
|
*/
|
1435
|
-
interface CustomCollectionCallbackSetters<
|
1507
|
+
interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
|
1436
1508
|
/**
|
1437
1509
|
* Sets the counter for the custom collection.
|
1438
1510
|
* @param counter A callback that returns the number of items in the custom collection.
|
1439
1511
|
* @returns The setters object so that settings can be chained.
|
1440
1512
|
*/
|
1441
|
-
setCounter(counter: CustomCollectionCounter<
|
1513
|
+
setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1442
1514
|
/**
|
1443
1515
|
* Sets the first cursor for the custom collection.
|
1444
1516
|
* @param cursor The cursor for the first item in the custom collection.
|
1445
1517
|
* @returns The setters object so that settings can be chained.
|
1446
1518
|
*/
|
1447
|
-
setFirstCursor(cursor: CustomCollectionCursor<
|
1519
|
+
setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1448
1520
|
/**
|
1449
1521
|
* Sets the last cursor for the custom collection.
|
1450
1522
|
* @param cursor The cursor for the last item in the custom collection.
|
1451
1523
|
* @returns The setters object so that settings can be chained.
|
1452
1524
|
*/
|
1453
|
-
setLastCursor(cursor: CustomCollectionCursor<
|
1525
|
+
setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1454
1526
|
/**
|
1455
1527
|
* Specifies the conditions under which requests are authorized.
|
1456
1528
|
* @param predicate A callback that returns whether a request is authorized.
|
1457
1529
|
* @returns The setters object so that settings can be chained.
|
1458
1530
|
* @since 0.7.0
|
1459
1531
|
*/
|
1460
|
-
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<
|
1532
|
+
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1461
1533
|
}
|
1462
1534
|
/**
|
1463
1535
|
* Represents an object with a type ID, which is either a constructor or an
|
@@ -1469,73 +1541,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
|
|
1469
1541
|
typeId: URL;
|
1470
1542
|
};
|
1471
1543
|
/**
|
1472
|
-
*
|
1473
|
-
*
|
1474
|
-
* values are their string representations.
|
1475
|
-
* @returns A string representing the path with all parameters.
|
1476
|
-
* @example
|
1477
|
-
* ```ts
|
1478
|
-
* type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
|
1479
|
-
* let userPostPath: UserPostPath;
|
1480
|
-
* // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
|
1481
|
-
* // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
|
1482
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // valid
|
1483
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // valid
|
1484
|
-
* ```
|
1485
|
-
*/
|
1486
|
-
type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
|
1487
|
-
/**
|
1488
|
-
* Represents a path with multiple parameters.
|
1489
|
-
* All permutations of the parameters are included in the union type.
|
1490
|
-
* The path must have all parameters in the form of `{paramName}`.
|
1491
|
-
* @param Params - A union of parameter names.
|
1492
|
-
* @returns A string representing the path with all parameters.
|
1493
|
-
* @example
|
1494
|
-
* ```ts
|
1495
|
-
* type UserPostPath = ParamsPath<"userId" | "postId">;
|
1496
|
-
* // = `${string}{userId}${string}` & `${string}{postId}${string}`
|
1497
|
-
* // =
|
1498
|
-
* // | `${string}{userId}${string}{postId}${string}`
|
1499
|
-
* // | `${string}{postId}${string}{userId}${string}`
|
1500
|
-
* let userPostPath: UserPostPath;
|
1501
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
1502
|
-
* userPostPath = "/users/{userId}"; // ❌ invalid
|
1503
|
-
* userPostPath = "/posts/{postId}"; // ❌ invalid
|
1504
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
1505
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
1506
|
-
*/
|
1507
|
-
type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
|
1508
|
-
/**
|
1509
|
-
* Represents a path with a single parameter.
|
1510
|
-
* The path must have at least one of the parameters in the form of `{paramName}`.
|
1511
|
-
* @param Param - The name of the parameter.
|
1512
|
-
* @returns A string representing the path with the parameter.
|
1513
|
-
* @example
|
1514
|
-
* ```ts
|
1515
|
-
* type UserPostPath = ParamPath<"userId" | "postId">;
|
1516
|
-
* // = `${string}{userId}${string}` | `${string}{postId}${string}`
|
1517
|
-
* let userPostPath: UserPostPath;
|
1518
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
1519
|
-
* userPostPath = "/users/{userId}"; // ✅ valid
|
1520
|
-
* userPostPath = "/posts/{postId}"; // ✅ valid
|
1521
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
1522
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
1523
|
-
*/
|
1524
|
-
type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
|
1525
|
-
/**
|
1526
|
-
* Converts union types to intersection types.
|
1544
|
+
* Defines a union of all valid RFC 6570 URI Template expressions for a given
|
1545
|
+
* parameter name.
|
1527
1546
|
*
|
1528
|
-
*
|
1529
|
-
*
|
1547
|
+
* RFC 6570 specifies a syntax for URI templates, allowing for variable
|
1548
|
+
* expansion. This type captures all Level 1-4 operator expressions for a
|
1549
|
+
* single, named variable.
|
1550
|
+
*
|
1551
|
+
* The supported expression types are:
|
1552
|
+
* - `{Param}`: Simple string expansion
|
1553
|
+
* - `+{Param}`: Reserved string expansion
|
1554
|
+
* - `#{Param}`: Fragment expansion
|
1555
|
+
* - `{.Param}`: Label expansion with a dot-prefix
|
1556
|
+
* - `{/Param}`: Path segment expansion
|
1557
|
+
* - `{;Param}`: Path-style parameter expansion
|
1558
|
+
* - `{?Param}`: Query component expansion
|
1559
|
+
* - `{&Param}`: Query continuation expansion
|
1560
|
+
*
|
1561
|
+
* @template Param The name of the parameter to be used in the expressions.
|
1530
1562
|
* @example
|
1531
1563
|
* ```ts
|
1532
|
-
* type
|
1533
|
-
*
|
1534
|
-
*
|
1535
|
-
*
|
1536
|
-
*
|
1564
|
+
* type UserIdExpression = Rfc6570Expression<"userId">;
|
1565
|
+
*
|
1566
|
+
* // The variable `userPath` can be assigned any of the valid expressions.
|
1567
|
+
* const userPath: UserIdExpression = "{/userId}";
|
1568
|
+
* ```
|
1569
|
+
* @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
|
1537
1570
|
*/
|
1538
|
-
type
|
1571
|
+
type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
|
1539
1572
|
//#endregion
|
1540
1573
|
//#region src/federation/context.d.ts
|
1541
1574
|
/**
|
@@ -2306,4 +2339,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
2306
2339
|
multikey: Multikey;
|
2307
2340
|
}
|
2308
2341
|
//#endregion
|
2309
|
-
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems,
|
2342
|
+
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|