@fedify/fedify 2.0.0-pr.412.1692 → 2.0.0-pr.412.1794
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 +3 -0
- package/dist/{actor-D5S46edz.js → actor-BXHc5r-q.js} +1 -1
- package/dist/{actor-CrTGiTZd.cjs → actor-Ba9Z1eNJ.cjs} +921 -1451
- package/dist/{actor-T6RyhRgk.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-G2S5sPEA.js → actor-DzhunPC_.js} +189 -677
- package/dist/{actor-D6K058Tb.d.cts → actor-f2NtjyCg.d.cts} +2 -2
- 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-OA47XRft.js → builder-u7usRsT3.js} +7 -8
- package/dist/{client-CegPX0Rn.d.cts → client-94iWEfQa.d.cts} +1 -1
- package/dist/{client-bgSdkFa2.d.ts → client-BsGzbnV-.d.ts} +1 -1
- package/dist/{client-Bmd-i8x8.js → client-pY7-3icS.js} +1 -1
- package/dist/compat/mod.d.cts +11 -12
- package/dist/compat/mod.d.ts +11 -12
- package/dist/compat/transformers.test.js +20 -20
- package/dist/{context-ByZprN0S.d.ts → context-DG0huGW-.d.ts} +124 -127
- package/dist/{context-C5BsZkDr.d.cts → context-DJ8aSy2Q.d.cts} +124 -127
- package/dist/{authdocloader-SjwloJUA.js → docloader-CrbAy9Oc.js} +17 -8
- package/dist/{esm-CwHz8Y8t.js → esm-C-Qa1zEM.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 +32 -33
- package/dist/federation/mod.cjs +9 -11
- package/dist/federation/mod.d.cts +12 -13
- package/dist/federation/mod.d.ts +12 -13
- package/dist/federation/mod.js +9 -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-D6Uj2x2y.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/{http-C5tC93Hn.js → http-CUVx-vzb.js} +256 -6
- package/dist/{http-DGjdMiLc.js → http-D2kIm9la.js} +2 -2
- package/dist/{http-BiBofurJ.cjs → http-Dofes42e.cjs} +289 -9
- package/dist/{http-D-e6AFwR.d.cts → http-M8k5mKc0.d.cts} +2 -2
- package/dist/{inbox-BoDY3z8G.js → inbox-HjG5peXY.js} +1 -1
- package/dist/{key-IxRhZpOF.js → key-CxdLUFS6.js} +3 -2
- package/dist/{keycache-TEniXNel.js → keycache-bU7COwsh.js} +1 -1
- package/dist/{keys-bZxcrZ9Z.js → keys-DMHs8XNn.js} +2 -1
- package/dist/kv-cache-CGXcDejL.js +122 -0
- package/dist/kv-cache-DN9pfMBe.js +94 -0
- package/dist/kv-cache-Dkvbn6rg.cjs +134 -0
- package/dist/{ld-DW7A0uIc.js → ld-CIhvSCCr.js} +3 -2
- package/dist/{lookup-cVRa2QM-.js → lookup-CHkCVZTU.js} +131 -2
- package/dist/lookup-CfFkONZD.cjs +272 -0
- package/dist/{type-NEA09tSC.js → lookup-DQRtjvb1.js} +503 -5328
- package/dist/middleware-Bot7EEwV.js +26 -0
- package/dist/middleware-CFJgmUMW.cjs +15 -0
- package/dist/{middleware-Cgr3PtaJ.js → middleware-CJlj5Olw.js} +44 -48
- package/dist/middleware-CjHl2NHA.js +15 -0
- package/dist/{middleware-TfuVoceY.cjs → middleware-D74TgW2E.cjs} +60 -66
- package/dist/{middleware-DvvYAIsd.js → middleware-DMk2Mdn9.js} +40 -46
- package/dist/mod-0noXw66R.d.cts +107 -0
- package/dist/{mod-BhUKmBJD.d.ts → mod-B2iOw50L.d.ts} +3 -3
- package/dist/mod-B9M-8jm2.d.ts +109 -0
- package/dist/{mod-DlU8ISoa.d.ts → mod-BlVovdcy.d.ts} +2 -2
- package/dist/{mod-D6hQoxC5.d.ts → mod-BoHnwOCs.d.ts} +2 -2
- package/dist/{mod-CxkWO3Mg.d.cts → mod-BxRCHTz-.d.cts} +2 -2
- package/dist/{mod-jQ4OODsl.d.cts → mod-C58MZ7Wx.d.cts} +1 -1
- package/dist/{mod-8DMWKtQE.d.cts → mod-DJcZDvjA.d.cts} +2 -2
- package/dist/{mod-Djzcw2ry.d.cts → mod-DgdBYYa0.d.cts} +3 -3
- package/dist/{mod-DBzN0aCM.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
- package/dist/mod.cjs +19 -32
- package/dist/mod.d.cts +15 -16
- package/dist/mod.d.ts +16 -17
- package/dist/mod.js +14 -16
- package/dist/nodeinfo/client.test.js +8 -10
- package/dist/nodeinfo/handler.test.js +24 -25
- package/dist/nodeinfo/mod.cjs +2 -3
- package/dist/nodeinfo/mod.d.cts +2 -4
- package/dist/nodeinfo/mod.d.ts +2 -4
- package/dist/nodeinfo/mod.js +2 -3
- package/dist/nodeinfo/types.test.js +7 -9
- package/dist/{owner-BN_tO3cY.d.cts → owner-B4HbyP8s.d.cts} +3 -3
- package/dist/{owner-6Vc3UXXE.js → owner-Dvh7mBvr.js} +3 -2
- package/dist/{owner-hd9lvQcP.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/{proof-CRJWXFfT.cjs → proof-D0uThUvD.cjs} +17 -16
- package/dist/{proof-C1jhbeNv.js → proof-Dgy35fzc.js} +2 -2
- package/dist/{proof-Chi90OXv.js → proof-fqzaMJ4g.js} +5 -4
- package/dist/{send-DjATl6i3.js → send-Drp20VO9.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 +9 -11
- package/dist/sig/mod.d.cts +5 -7
- package/dist/sig/mod.d.ts +5 -7
- package/dist/sig/mod.js +5 -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 +114 -196
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-BnfPB5T-.js → testing-g4UC4liW.js} +1 -2
- package/dist/{types-dLXLjVLf.js → types-BtUjyi5y.js} +1 -1
- package/dist/{types-CmmUQisS.cjs → types-CWgzGaqk.cjs} +3 -3
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +14 -15
- package/dist/utils/kv-cache.test.js +209 -0
- package/dist/utils/mod.cjs +12 -0
- package/dist/utils/mod.d.cts +5 -0
- package/dist/utils/mod.d.ts +7 -0
- package/dist/utils/mod.js +11 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +7 -9
- package/dist/vocab/mod.cjs +3 -4
- package/dist/vocab/mod.d.cts +3 -5
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +3 -4
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +9 -10
- package/dist/{vocab-BI0Ak5lL.d.ts → vocab-BCWe1Ih5.d.ts} +2 -21
- package/dist/{vocab-rWbHpc2J.js → vocab-BnR3nIU9.js} +3 -3
- package/dist/{vocab-Dw1-yVGg.d.cts → vocab-CeDBzu-f.d.cts} +2 -21
- package/dist/{vocab-C5Y-0fGj.cjs → vocab-DFaWWYDn.cjs} +5 -5
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +2 -3
- package/dist/webfinger/mod.d.cts +1 -3
- package/dist/webfinger/mod.d.ts +1 -3
- package/dist/webfinger/mod.js +2 -3
- package/dist/x/cfworkers.d.cts +2 -2
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.d.cts +10 -11
- package/dist/x/hono.d.ts +10 -11
- package/dist/x/sveltekit.d.cts +10 -11
- package/dist/x/sveltekit.d.ts +10 -11
- package/package.json +18 -17
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-C5AvdCCi.js +0 -52
- package/dist/authdocloader-CQMPmpaO.cjs +0 -58
- package/dist/docloader-7Ey7wNHx.cjs +0 -4861
- package/dist/docloader-CkweNhUH.js +0 -4795
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/key-CZR7QraT.cjs +0 -290
- package/dist/key-Cf8MffVe.cjs +0 -10
- package/dist/key-CkxrAIyp.js +0 -260
- package/dist/key-Dk0j88Jo.js +0 -10
- package/dist/key-Epcl5jpz.js +0 -10
- package/dist/lookup-DhQCVVja.js +0 -331
- package/dist/lookup-DiV4LFBg.cjs +0 -137
- package/dist/middleware-Be1JStOx.js +0 -17
- package/dist/middleware-CDOK7WOb.js +0 -26
- package/dist/middleware-EjIW2mZB.cjs +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.d.ts +0 -3
- 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.d.ts +0 -3
- 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-CRpdnOMS.cjs} +0 -0
- /package/dist/{federation-D1U8YY9t.js → federation-jcR8-ZxP.js} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-BKNZ-Tb-.d.ts} +0 -0
- /package/dist/{kv-63Cil1MD.d.cts → kv-Bxr0Q87_.d.cts} +0 -0
- /package/dist/{mod-FZd39qVq.d.cts → mod-B-hUPT2N.d.cts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-xIj-IT58.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CUKlBw08.d.ts} +0 -0
- /package/dist/{mq-B7R1Q-M5.d.cts → mq-DcJPkXD5.d.cts} +0 -0
- /package/dist/{negotiation-5NPJL6zp.js → negotiation-C4nFufNk.js} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-BnthBobC.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-CdN0rEnZ.cjs} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-C34-oHBl.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-YYj5tCnr.cjs} +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/{sig-Cj3tk-ig.js → utils-D-Va7aXC.js} +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-DyRU1gdZ.cjs} +0 -0
- /package/dist/{webfinger-De_bU0iE.js → webfinger-C72Y8lrh.js} +0 -0
- /package/dist/{webfinger-BjOEdFPs.cjs → webfinger-vAtLmxOF.cjs} +0 -0
@@ -1,16 +1,16 @@
|
|
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 {
|
11
|
-
import {
|
12
|
-
import { MessageQueue } from "./mq-CRGm1e_F.js";
|
3
|
+
import { GetNodeInfoOptions, JsonValue, NodeInfo } from "./client-BsGzbnV-.js";
|
4
|
+
import { Activity, Collection, CryptographicKey, Hashtag, Link, Multikey, Object as Object$1 } from "./vocab-BCWe1Ih5.js";
|
5
|
+
import { Actor, Recipient } from "./actor-DqFajh9s.js";
|
6
|
+
import { HttpMessageSignaturesSpec } from "./http-BbO0ejuk.js";
|
7
|
+
import { GetKeyOwnerOptions } from "./owner-kQRGVXG1.js";
|
8
|
+
import { LookupObjectOptions, TraverseCollectionOptions } from "./mod-BlVovdcy.js";
|
9
|
+
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "./mod-Ds0mpFZU.js";
|
10
|
+
import { KvKey, KvStore } from "./kv-BKNZ-Tb-.js";
|
11
|
+
import { MessageQueue } from "./mq-CUKlBw08.js";
|
13
12
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
13
|
+
import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
14
14
|
|
15
15
|
//#region src/compat/types.d.ts
|
16
16
|
/**
|
@@ -283,7 +283,7 @@ type ObjectAuthorizePredicate<TContextData, TParam extends string> = (context: R
|
|
283
283
|
* the entire collection without pagination.
|
284
284
|
* @since 1.8.0
|
285
285
|
*/
|
286
|
-
type CustomCollectionDispatcher<TItem,
|
286
|
+
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>;
|
287
287
|
/**
|
288
288
|
* A callback that counts the number of items in a custom collection.
|
289
289
|
*
|
@@ -293,7 +293,7 @@ type CustomCollectionDispatcher<TItem, TParams extends Record<string, string>, T
|
|
293
293
|
* @param values The parameters of the requested URL.
|
294
294
|
* @since 1.8.0
|
295
295
|
*/
|
296
|
-
type CustomCollectionCounter<
|
296
|
+
type CustomCollectionCounter<TParam extends string, TContextData> = (context: RequestContext<TContextData>, values: Record<TParam, string>) => number | bigint | null | Promise<number | bigint | null>;
|
297
297
|
/**
|
298
298
|
* A callback that returns a cursor for a custom collection.
|
299
299
|
*
|
@@ -306,7 +306,7 @@ type CustomCollectionCounter<TParams extends Record<string, string>, TContextDat
|
|
306
306
|
* @param values The parameters of the requested URL.
|
307
307
|
* @since 1.8.0
|
308
308
|
*/
|
309
|
-
type CustomCollectionCursor<
|
309
|
+
type CustomCollectionCursor<TParam extends string, TContext extends Context<TContextData>, TContextData> = (context: TContext, values: Record<TParam, string>) => string | null | Promise<string | null>;
|
310
310
|
//#endregion
|
311
311
|
//#region src/federation/handler.d.ts
|
312
312
|
|
@@ -704,7 +704,7 @@ interface Federatable<TContextData> {
|
|
704
704
|
* @returns An object with methods to set other actor dispatcher callbacks.
|
705
705
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
706
706
|
*/
|
707
|
-
setActorDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
707
|
+
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
708
708
|
/**
|
709
709
|
* Registers an object dispatcher.
|
710
710
|
*
|
@@ -718,9 +718,7 @@ interface Federatable<TContextData> {
|
|
718
718
|
* must have one or more variables.
|
719
719
|
* @param dispatcher An object dispatcher callback to register.
|
720
720
|
*/
|
721
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
722
|
-
typeId: URL;
|
723
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
721
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
724
722
|
/**
|
725
723
|
* Registers an object dispatcher.
|
726
724
|
*
|
@@ -734,9 +732,7 @@ interface Federatable<TContextData> {
|
|
734
732
|
* must have one or more variables.
|
735
733
|
* @param dispatcher An object dispatcher callback to register.
|
736
734
|
*/
|
737
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
738
|
-
typeId: URL;
|
739
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
735
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
740
736
|
/**
|
741
737
|
* Registers an object dispatcher.
|
742
738
|
*
|
@@ -750,9 +746,7 @@ interface Federatable<TContextData> {
|
|
750
746
|
* must have one or more variables.
|
751
747
|
* @param dispatcher An object dispatcher callback to register.
|
752
748
|
*/
|
753
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
754
|
-
typeId: URL;
|
755
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
749
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
756
750
|
/**
|
757
751
|
* Registers an object dispatcher.
|
758
752
|
*
|
@@ -766,9 +760,7 @@ interface Federatable<TContextData> {
|
|
766
760
|
* must have one or more variables.
|
767
761
|
* @param dispatcher An object dispatcher callback to register.
|
768
762
|
*/
|
769
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
770
|
-
typeId: URL;
|
771
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
763
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
772
764
|
/**
|
773
765
|
* Registers an object dispatcher.
|
774
766
|
*
|
@@ -782,9 +774,7 @@ interface Federatable<TContextData> {
|
|
782
774
|
* must have one or more variables.
|
783
775
|
* @param dispatcher An object dispatcher callback to register.
|
784
776
|
*/
|
785
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
786
|
-
typeId: URL;
|
787
|
-
}, path: `${string}{${TParam}}${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
777
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
788
778
|
/**
|
789
779
|
* Registers an object dispatcher.
|
790
780
|
*
|
@@ -798,9 +788,7 @@ interface Federatable<TContextData> {
|
|
798
788
|
* must have one or more variables.
|
799
789
|
* @param dispatcher An object dispatcher callback to register.
|
800
790
|
*/
|
801
|
-
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls:
|
802
|
-
typeId: URL;
|
803
|
-
}, path: `${string}{${TParam}}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
791
|
+
setObjectDispatcher<TObject extends Object$1, TParam extends string>(cls: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: ObjectDispatcher<TContextData, TObject, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>;
|
804
792
|
/**
|
805
793
|
* Registers an inbox dispatcher.
|
806
794
|
*
|
@@ -812,7 +800,7 @@ interface Federatable<TContextData> {
|
|
812
800
|
* @param dispatcher An inbox dispatcher callback to register.
|
813
801
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
814
802
|
*/
|
815
|
-
setInboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
803
|
+
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
816
804
|
/**
|
817
805
|
* Registers an outbox dispatcher.
|
818
806
|
*
|
@@ -836,7 +824,7 @@ interface Federatable<TContextData> {
|
|
836
824
|
* @param dispatcher An outbox dispatcher callback to register.
|
837
825
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
838
826
|
*/
|
839
|
-
setOutboxDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
827
|
+
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
840
828
|
/**
|
841
829
|
* Registers a following collection dispatcher.
|
842
830
|
* @param path The URI path pattern for the following collection. The syntax
|
@@ -848,7 +836,7 @@ interface Federatable<TContextData> {
|
|
848
836
|
* callbacks.
|
849
837
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
850
838
|
*/
|
851
|
-
setFollowingDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
839
|
+
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
852
840
|
/**
|
853
841
|
* Registers a followers collection dispatcher.
|
854
842
|
* @param path The URI path pattern for the followers collection. The syntax
|
@@ -860,7 +848,7 @@ interface Federatable<TContextData> {
|
|
860
848
|
* callbacks.
|
861
849
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
862
850
|
*/
|
863
|
-
setFollowersDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
851
|
+
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
864
852
|
/**
|
865
853
|
* Registers a liked collection dispatcher.
|
866
854
|
* @param path The URI path pattern for the liked collection. The syntax
|
@@ -872,7 +860,7 @@ interface Federatable<TContextData> {
|
|
872
860
|
* callbacks.
|
873
861
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
874
862
|
*/
|
875
|
-
setLikedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
863
|
+
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
876
864
|
/**
|
877
865
|
* Registers a featured collection dispatcher.
|
878
866
|
* @param path The URI path pattern for the featured collection. The syntax
|
@@ -884,7 +872,7 @@ interface Federatable<TContextData> {
|
|
884
872
|
* callbacks.
|
885
873
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
886
874
|
*/
|
887
|
-
setFeaturedDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
875
|
+
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
888
876
|
/**
|
889
877
|
* Registers a featured tags collection dispatcher.
|
890
878
|
* @param path The URI path pattern for the featured tags collection.
|
@@ -896,7 +884,7 @@ interface Federatable<TContextData> {
|
|
896
884
|
* callbacks.
|
897
885
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
898
886
|
*/
|
899
|
-
setFeaturedTagsDispatcher(path: `${string}{identifier}${string}` | `${string}{handle}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
887
|
+
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
900
888
|
/**
|
901
889
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
902
890
|
*
|
@@ -926,7 +914,7 @@ interface Federatable<TContextData> {
|
|
926
914
|
* @returns An object to register inbox listeners.
|
927
915
|
* @throws {RouteError} Thrown if the path pattern is invalid.
|
928
916
|
*/
|
929
|
-
setInboxListeners(inboxPath: `${string}{identifier}${string}` | `${string}{handle}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
917
|
+
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}` | `${string}${Rfc6570Expression<"handle">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
930
918
|
/**
|
931
919
|
* Registers a collection of objects dispatcher.
|
932
920
|
*
|
@@ -941,7 +929,37 @@ interface Federatable<TContextData> {
|
|
941
929
|
* The path must have one or more variables.
|
942
930
|
* @param dispatcher A collection dispatcher callback to register.
|
943
931
|
*/
|
944
|
-
setCollectionDispatcher<TObject extends Object$1,
|
932
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
933
|
+
/**
|
934
|
+
* Registers a collection of objects dispatcher.
|
935
|
+
*
|
936
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
937
|
+
* @template TObject The type of objects to dispatch.
|
938
|
+
* @template TParam The parameter names of the requested URL.
|
939
|
+
* @param name A unique name for the collection dispatcher.
|
940
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
941
|
+
* @param path The URI path pattern for the collection dispatcher.
|
942
|
+
* The syntax is based on URI Template
|
943
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
944
|
+
* The path must have one or more variables.
|
945
|
+
* @param dispatcher A collection dispatcher callback to register.
|
946
|
+
*/
|
947
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
948
|
+
/**
|
949
|
+
* Registers a collection of objects dispatcher.
|
950
|
+
*
|
951
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
952
|
+
* @template TObject The type of objects to dispatch.
|
953
|
+
* @template TParam The parameter names of the requested URL.
|
954
|
+
* @param name A unique name for the collection dispatcher.
|
955
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
956
|
+
* @param path The URI path pattern for the collection dispatcher.
|
957
|
+
* The syntax is based on URI Template
|
958
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
959
|
+
* The path must have one or more variables.
|
960
|
+
* @param dispatcher A collection dispatcher callback to register.
|
961
|
+
*/
|
962
|
+
setCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
945
963
|
/**
|
946
964
|
* Registers an ordered collection of objects dispatcher.
|
947
965
|
*
|
@@ -956,7 +974,37 @@ interface Federatable<TContextData> {
|
|
956
974
|
* The path must have one or more variables.
|
957
975
|
* @param dispatcher A collection dispatcher callback to register.
|
958
976
|
*/
|
959
|
-
setOrderedCollectionDispatcher<TObject extends Object$1,
|
977
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
978
|
+
/**
|
979
|
+
* Registers an ordered collection of objects dispatcher.
|
980
|
+
*
|
981
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
982
|
+
* @template TObject The type of objects to dispatch.
|
983
|
+
* @template TParam The parameter names of the requested URL.
|
984
|
+
* @param name A unique name for the collection dispatcher.
|
985
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
986
|
+
* @param path The URI path pattern for the collection dispatcher.
|
987
|
+
* The syntax is based on URI Template
|
988
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
989
|
+
* The path must have one or more variables.
|
990
|
+
* @param dispatcher A collection dispatcher callback to register.
|
991
|
+
*/
|
992
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
993
|
+
/**
|
994
|
+
* Registers an ordered collection of objects dispatcher.
|
995
|
+
*
|
996
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
997
|
+
* @template TObject The type of objects to dispatch.
|
998
|
+
* @template TParam The parameter names of the requested URL.
|
999
|
+
* @param name A unique name for the collection dispatcher.
|
1000
|
+
* @param itemType The Activity Vocabulary class of the object to dispatch.
|
1001
|
+
* @param path The URI path pattern for the collection dispatcher.
|
1002
|
+
* The syntax is based on URI Template
|
1003
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
1004
|
+
* The path must have one or more variables.
|
1005
|
+
* @param dispatcher A collection dispatcher callback to register.
|
1006
|
+
*/
|
1007
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParam extends string>(name: string | symbol, itemType: ConstructorWithTypeId<TObject>, path: `${string}${Rfc6570Expression<TParam>}${string}`, dispatcher: CustomCollectionDispatcher<TObject, TParam, RequestContext<TContextData>, TContextData>): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>;
|
960
1008
|
}
|
961
1009
|
/**
|
962
1010
|
* An object that registers federation-related business logic and dispatches
|
@@ -1092,12 +1140,6 @@ interface FederationOptions<TContextData> {
|
|
1092
1140
|
* @since 1.4.0
|
1093
1141
|
*/
|
1094
1142
|
contextLoaderFactory?: DocumentLoaderFactory;
|
1095
|
-
/**
|
1096
|
-
* A custom JSON-LD context loader. By default, this uses the same loader
|
1097
|
-
* as the document loader.
|
1098
|
-
* @deprecated Use {@link contextLoaderFactory} instead.
|
1099
|
-
*/
|
1100
|
-
contextLoader?: DocumentLoader;
|
1101
1143
|
/**
|
1102
1144
|
* A factory function that creates an authenticated document loader for a
|
1103
1145
|
* given identity. This is used for fetching documents that require
|
@@ -1434,38 +1476,38 @@ interface FederationFetchOptions<TContextData> {
|
|
1434
1476
|
/**
|
1435
1477
|
* Additional settings for a custom collection dispatcher.
|
1436
1478
|
*
|
1437
|
-
* @template
|
1479
|
+
* @template TParam The type of the parameters in the URL path.
|
1438
1480
|
* @template TContext The type of the context. {@link Context} or
|
1439
1481
|
* {@link RequestContext}.
|
1440
1482
|
* @template TContextData The context data to pass to the {@link Context}.
|
1441
1483
|
* @template TFilter The type of filter for the collection.
|
1442
1484
|
*/
|
1443
|
-
interface CustomCollectionCallbackSetters<
|
1485
|
+
interface CustomCollectionCallbackSetters<TParam extends string, TContext extends Context<TContextData>, TContextData> {
|
1444
1486
|
/**
|
1445
1487
|
* Sets the counter for the custom collection.
|
1446
1488
|
* @param counter A callback that returns the number of items in the custom collection.
|
1447
1489
|
* @returns The setters object so that settings can be chained.
|
1448
1490
|
*/
|
1449
|
-
setCounter(counter: CustomCollectionCounter<
|
1491
|
+
setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1450
1492
|
/**
|
1451
1493
|
* Sets the first cursor for the custom collection.
|
1452
1494
|
* @param cursor The cursor for the first item in the custom collection.
|
1453
1495
|
* @returns The setters object so that settings can be chained.
|
1454
1496
|
*/
|
1455
|
-
setFirstCursor(cursor: CustomCollectionCursor<
|
1497
|
+
setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1456
1498
|
/**
|
1457
1499
|
* Sets the last cursor for the custom collection.
|
1458
1500
|
* @param cursor The cursor for the last item in the custom collection.
|
1459
1501
|
* @returns The setters object so that settings can be chained.
|
1460
1502
|
*/
|
1461
|
-
setLastCursor(cursor: CustomCollectionCursor<
|
1503
|
+
setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1462
1504
|
/**
|
1463
1505
|
* Specifies the conditions under which requests are authorized.
|
1464
1506
|
* @param predicate A callback that returns whether a request is authorized.
|
1465
1507
|
* @returns The setters object so that settings can be chained.
|
1466
1508
|
* @since 0.7.0
|
1467
1509
|
*/
|
1468
|
-
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<
|
1510
|
+
authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>;
|
1469
1511
|
}
|
1470
1512
|
/**
|
1471
1513
|
* Represents an object with a type ID, which is either a constructor or an
|
@@ -1477,73 +1519,34 @@ type ConstructorWithTypeId<TObject extends Object$1> = (new (...args: any[]) =>
|
|
1477
1519
|
typeId: URL;
|
1478
1520
|
};
|
1479
1521
|
/**
|
1480
|
-
*
|
1481
|
-
*
|
1482
|
-
*
|
1483
|
-
*
|
1484
|
-
*
|
1485
|
-
*
|
1486
|
-
* type UserPostPath = ParamsKeyPath<{ userId: string; postId: string }>;
|
1487
|
-
* let userPostPath: UserPostPath;
|
1488
|
-
* // userPostPath = "/posts/{postId}"; // invalid - does not contain `{userId}`
|
1489
|
-
* // userPostPath = "/users/{userId}"; // invalid - does not contain `{postId}`
|
1490
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // valid
|
1491
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // valid
|
1492
|
-
* ```
|
1493
|
-
*/
|
1494
|
-
type ParamsKeyPath<Params extends Record<string, string>> = ParamsPath<Extract<keyof Params, string>> & string;
|
1495
|
-
/**
|
1496
|
-
* Represents a path with multiple parameters.
|
1497
|
-
* All permutations of the parameters are included in the union type.
|
1498
|
-
* The path must have all parameters in the form of `{paramName}`.
|
1499
|
-
* @param Params - A union of parameter names.
|
1500
|
-
* @returns A string representing the path with all parameters.
|
1501
|
-
* @example
|
1502
|
-
* ```ts
|
1503
|
-
* type UserPostPath = ParamsPath<"userId" | "postId">;
|
1504
|
-
* // = `${string}{userId}${string}` & `${string}{postId}${string}`
|
1505
|
-
* // =
|
1506
|
-
* // | `${string}{userId}${string}{postId}${string}`
|
1507
|
-
* // | `${string}{postId}${string}{userId}${string}`
|
1508
|
-
* let userPostPath: UserPostPath;
|
1509
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
1510
|
-
* userPostPath = "/users/{userId}"; // ❌ invalid
|
1511
|
-
* userPostPath = "/posts/{postId}"; // ❌ invalid
|
1512
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
1513
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
1514
|
-
*/
|
1515
|
-
type ParamsPath<Params extends string> = UnionToIntersection<ParamPath<Params>>;
|
1516
|
-
/**
|
1517
|
-
* Represents a path with a single parameter.
|
1518
|
-
* The path must have at least one of the parameters in the form of `{paramName}`.
|
1519
|
-
* @param Param - The name of the parameter.
|
1520
|
-
* @returns A string representing the path with the parameter.
|
1521
|
-
* @example
|
1522
|
-
* ```ts
|
1523
|
-
* type UserPostPath = ParamPath<"userId" | "postId">;
|
1524
|
-
* // = `${string}{userId}${string}` | `${string}{postId}${string}`
|
1525
|
-
* let userPostPath: UserPostPath;
|
1526
|
-
* userPostPath = "/users/posts"; // ❌ invalid
|
1527
|
-
* userPostPath = "/users/{userId}"; // ✅ valid
|
1528
|
-
* userPostPath = "/posts/{postId}"; // ✅ valid
|
1529
|
-
* userPostPath = "/users/{userId}/posts/{postId}"; // ✅ valid
|
1530
|
-
* userPostPath = "/posts/{postId}/users/{userId}"; // ✅ valid
|
1531
|
-
*/
|
1532
|
-
type ParamPath<Param extends string> = `${string}{${Param}}${string}`;
|
1533
|
-
/**
|
1534
|
-
* Converts union types to intersection types.
|
1522
|
+
* Defines a union of all valid RFC 6570 URI Template expressions for a given
|
1523
|
+
* parameter name.
|
1524
|
+
*
|
1525
|
+
* RFC 6570 specifies a syntax for URI templates, allowing for variable
|
1526
|
+
* expansion. This type captures all Level 1-4 operator expressions for a
|
1527
|
+
* single, named variable.
|
1535
1528
|
*
|
1536
|
-
*
|
1537
|
-
*
|
1529
|
+
* The supported expression types are:
|
1530
|
+
* - `{Param}`: Simple string expansion
|
1531
|
+
* - `+{Param}`: Reserved string expansion
|
1532
|
+
* - `#{Param}`: Fragment expansion
|
1533
|
+
* - `{.Param}`: Label expansion with a dot-prefix
|
1534
|
+
* - `{/Param}`: Path segment expansion
|
1535
|
+
* - `{;Param}`: Path-style parameter expansion
|
1536
|
+
* - `{?Param}`: Query component expansion
|
1537
|
+
* - `{&Param}`: Query continuation expansion
|
1538
|
+
*
|
1539
|
+
* @template Param The name of the parameter to be used in the expressions.
|
1538
1540
|
* @example
|
1539
1541
|
* ```ts
|
1540
|
-
* type
|
1541
|
-
*
|
1542
|
-
*
|
1543
|
-
*
|
1544
|
-
*
|
1542
|
+
* type UserIdExpression = Rfc6570Expression<"userId">;
|
1543
|
+
*
|
1544
|
+
* // The variable `userPath` can be assigned any of the valid expressions.
|
1545
|
+
* const userPath: UserIdExpression = "{/userId}";
|
1546
|
+
* ```
|
1547
|
+
* @see {@link https://tools.ietf.org/html/rfc6570} for the full specification.
|
1545
1548
|
*/
|
1546
|
-
type
|
1549
|
+
type Rfc6570Expression<Param extends string> = `{${Param}}` | `{+${Param}}` | `{#${Param}}` | `{.${Param}}` | `{/${Param}}` | `{;${Param}}` | `{?${Param}}` | `{&${Param}}`;
|
1547
1550
|
//#endregion
|
1548
1551
|
//#region src/federation/context.d.ts
|
1549
1552
|
/**
|
@@ -1632,9 +1635,7 @@ interface Context<TContextData> {
|
|
1632
1635
|
* @throws {TypeError} If values are invalid.
|
1633
1636
|
* @since 0.7.0
|
1634
1637
|
*/
|
1635
|
-
getObjectUri<TObject extends Object$1>(cls:
|
1636
|
-
typeId: URL;
|
1637
|
-
}, values: Record<string, string>): URL;
|
1638
|
+
getObjectUri<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): URL;
|
1638
1639
|
/**
|
1639
1640
|
* Builds the URI of an actor's outbox with the given identifier.
|
1640
1641
|
* @param identifier The actor's identifier.
|
@@ -1948,9 +1949,7 @@ interface RequestContext<TContextData> extends Context<TContextData> {
|
|
1948
1949
|
* @throws {TypeError} If values are invalid.
|
1949
1950
|
* @since 0.7.0
|
1950
1951
|
*/
|
1951
|
-
getObject<TObject extends Object$1>(cls:
|
1952
|
-
typeId: URL;
|
1953
|
-
}, values: Record<string, string>): Promise<TObject | null>;
|
1952
|
+
getObject<TObject extends Object$1>(cls: ConstructorWithTypeId<TObject>, values: Record<string, string>): Promise<TObject | null>;
|
1954
1953
|
/**
|
1955
1954
|
* Gets the public key of the sender, if any exists and it is verified.
|
1956
1955
|
* Otherwise, `null` is returned.
|
@@ -2094,9 +2093,7 @@ type ParseUriResult =
|
|
2094
2093
|
* The case of an object URI.
|
2095
2094
|
*/ | {
|
2096
2095
|
readonly type: "object";
|
2097
|
-
readonly class:
|
2098
|
-
typeId: URL;
|
2099
|
-
};
|
2096
|
+
readonly class: ConstructorWithTypeId<Object$1>;
|
2100
2097
|
readonly typeId: URL;
|
2101
2098
|
readonly values: Record<string, string>;
|
2102
2099
|
}
|
@@ -2314,4 +2311,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
2314
2311
|
multikey: Multikey;
|
2315
2312
|
}
|
2316
2313
|
//#endregion
|
2317
|
-
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,
|
2314
|
+
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 };
|