@fedify/fedify 1.8.1-pr.332.1182 → 1.8.1-pr.334.1193
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-CEOpqw2j.js → actor-BxYrc06V.js} +179 -179
- package/dist/{actor-DGhGviFF.js → actor-CeBMq8qR.js} +1 -1
- package/dist/{authdocloader-F5CEYzSX.js → authdocloader-D64rqKxU.js} +3 -3
- package/dist/{authdocloader-5puN-Y5K.js → authdocloader-mGQvrIQ2.js} +3 -3
- package/dist/{builder-UdluIvUy.js → builder-BMWyrhEH.js} +4 -43
- package/dist/{client-DIWtwDpq.js → client-CTC5x_Sz.js} +1 -1
- package/dist/compat/mod.d.ts +2 -2
- package/dist/compat/transformers.test.js +16 -16
- package/dist/{context-72aRESIE.d.ts → context-B6mUZhs_.d.ts} +1 -214
- package/dist/{docloader-BZVERUXw.js → docloader-BU0Mbf3M.js} +1 -1
- package/dist/{esm-CAt2YHNr.js → esm-LMB9p-G5.js} +1 -1
- package/dist/federation/builder.test.js +5 -5
- package/dist/federation/collection.test.js +3 -3
- package/dist/federation/handler.test.js +17 -327
- package/dist/federation/inbox.test.js +4 -4
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +3 -3
- package/dist/federation/middleware.test.js +18 -19
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +10 -10
- package/dist/federation/mq.test.js +3 -3
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +3 -3
- package/dist/federation/send.test.js +10 -10
- package/dist/{http-DwWuBdiS.js → http-CYR3mIVn.js} +3 -3
- package/dist/{http-L8nGt-kU.js → http-D3g0NXG1.js} +2 -2
- package/dist/{inbox-Bww5_4f3.js → inbox-CKssCQNk.js} +1 -1
- package/dist/{key-DmlNusxB.js → key-BBZcKCrH.js} +2 -2
- package/dist/{key-Dvvr8w0R.js → key-CmOXs0Mq.js} +3 -3
- package/dist/{key-AxtPEhyf.js → key-CuNvhgVd.js} +4 -4
- package/dist/{key-D7eESjT8.js → key-YOEsvep6.js} +2 -2
- package/dist/{keycache-CCfh6JzL.js → keycache-DGObidvq.js} +1 -1
- package/dist/{keys-Cojpplg7.js → keys-CPhbsrsX.js} +1 -1
- package/dist/{ld-BM_q92Md.js → ld-D8ugSU-x.js} +2 -2
- package/dist/{lookup-BqO_EQ7t.js → lookup-B0_qPExk.js} +1 -1
- package/dist/{lookup-N-vUaeU-.js → lookup-rBByGTyy.js} +1 -1
- package/dist/{middleware-D6oTvqvo.js → middleware-B_To0NZ3.js} +10 -591
- package/dist/middleware-DbDzHrt7.js +17 -0
- package/dist/middleware-JUbAKlS5.js +26 -0
- package/dist/{middleware-Dt7enCqI.js → middleware-u2WBeCjB.js} +14 -556
- package/dist/{mod-OU0GgfW6.d.ts → mod-D9qE4iHP.d.ts} +1 -1
- package/dist/mod.d.ts +3 -3
- package/dist/mod.js +10 -10
- package/dist/nodeinfo/client.test.js +5 -5
- package/dist/nodeinfo/handler.test.js +16 -16
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +3 -3
- package/dist/nodeinfo/types.test.js +3 -3
- package/dist/{owner-BHm6Slll.js → owner-D1TBvEbO.js} +2 -2
- package/dist/{proof-Ret5s-pN.js → proof-CUsFh6B-.js} +3 -3
- package/dist/{proof-qZ9pvD4f.js → proof-CyWfFsKS.js} +2 -2
- package/dist/runtime/authdocloader.test.js +9 -9
- package/dist/runtime/docloader.test.js +4 -4
- package/dist/runtime/key.test.js +5 -5
- package/dist/runtime/langstr.test.js +3 -3
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +3 -3
- package/dist/runtime/url.test.js +3 -3
- package/dist/{send-lJvGpeln.js → send-CrjrTnXW.js} +2 -2
- package/dist/sig/http.test.js +8 -8
- package/dist/sig/key.test.js +6 -6
- package/dist/sig/ld.test.js +7 -7
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +7 -7
- package/dist/sig/proof.test.js +7 -7
- package/dist/testing/docloader.test.js +3 -3
- package/dist/testing/mod.d.ts +0 -212
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-dvdFh8m2.js → testing-CROcCUCq.js} +3 -4
- package/dist/{type-C81IXTZo.js → type-DGlR8Urb.js} +179 -179
- package/dist/{types-CCgeAzKU.js → types-DZdBK266.js} +1 -1
- package/dist/vocab/actor.test.js +5 -5
- package/dist/vocab/lookup.test.js +4 -4
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +4 -4
- package/dist/{vocab-DWd0TzMK.js → vocab-BLQ-_oLb.js} +3 -3
- package/dist/webfinger/handler.test.js +16 -16
- package/dist/webfinger/lookup.test.js +4 -4
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.test.js +3 -3
- package/dist/x/hono.d.ts +1 -1
- package/dist/x/sveltekit.d.ts +1 -1
- package/package.json +1 -1
- package/dist/middleware-CivPioYC.js +0 -26
- package/dist/middleware-v2B43-x2.js +0 -17
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
|
|
5
|
+
import "./transformers-ghwJuzGY.js";
|
|
6
|
+
import "./docloader-BU0Mbf3M.js";
|
|
7
|
+
import "./actor-BxYrc06V.js";
|
|
8
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-B_To0NZ3.js";
|
|
9
|
+
import "./lookup-rBByGTyy.js";
|
|
10
|
+
import "./key-BBZcKCrH.js";
|
|
11
|
+
import "./http-CYR3mIVn.js";
|
|
12
|
+
import "./proof-CUsFh6B-.js";
|
|
13
|
+
import "./types-DZdBK266.js";
|
|
14
|
+
import "./authdocloader-mGQvrIQ2.js";
|
|
15
|
+
import "./vocab-BLQ-_oLb.js";
|
|
16
|
+
|
|
17
|
+
export { FederationImpl };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import "./type-DGlR8Urb.js";
|
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-u2WBeCjB.js";
|
|
8
|
+
import "./semver-DCqorrj5.js";
|
|
9
|
+
import "./client-CTC5x_Sz.js";
|
|
10
|
+
import "./lookup-B0_qPExk.js";
|
|
11
|
+
import "./types-n7HI7VFr.js";
|
|
12
|
+
import "./actor-CeBMq8qR.js";
|
|
13
|
+
import "./key-YOEsvep6.js";
|
|
14
|
+
import "./http-D3g0NXG1.js";
|
|
15
|
+
import "./authdocloader-D64rqKxU.js";
|
|
16
|
+
import "./ld-D8ugSU-x.js";
|
|
17
|
+
import "./owner-D1TBvEbO.js";
|
|
18
|
+
import "./proof-CyWfFsKS.js";
|
|
19
|
+
import "./inbox-CKssCQNk.js";
|
|
20
|
+
import "./builder-BMWyrhEH.js";
|
|
21
|
+
import "./collection-D5V3UzU3.js";
|
|
22
|
+
import "./keycache-DGObidvq.js";
|
|
23
|
+
import "./retry-BnpVRGFC.js";
|
|
24
|
+
import "./send-CrjrTnXW.js";
|
|
25
|
+
|
|
26
|
+
export { FederationImpl };
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Activity,
|
|
7
|
-
import { getNodeInfo } from "./client-
|
|
8
|
-
import { RouterError, lookupObject, traverseCollection } from "./lookup-
|
|
6
|
+
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, deno_default, getDocumentLoader, getTypeId, kvCache, lookupWebFinger } from "./type-DGlR8Urb.js";
|
|
7
|
+
import { getNodeInfo } from "./client-CTC5x_Sz.js";
|
|
8
|
+
import { RouterError, lookupObject, traverseCollection } from "./lookup-B0_qPExk.js";
|
|
9
9
|
import { nodeInfoToJson } from "./types-n7HI7VFr.js";
|
|
10
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
11
|
-
import { verifyRequest } from "./http-
|
|
12
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
13
|
-
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-
|
|
14
|
-
import { doesActorOwnKey, getKeyOwner } from "./owner-
|
|
15
|
-
import { signObject, verifyObject } from "./proof-
|
|
16
|
-
import { routeActivity } from "./inbox-
|
|
17
|
-
import { FederationBuilderImpl } from "./builder-
|
|
10
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-YOEsvep6.js";
|
|
11
|
+
import { verifyRequest } from "./http-D3g0NXG1.js";
|
|
12
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-D64rqKxU.js";
|
|
13
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-D8ugSU-x.js";
|
|
14
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-D1TBvEbO.js";
|
|
15
|
+
import { signObject, verifyObject } from "./proof-CyWfFsKS.js";
|
|
16
|
+
import { routeActivity } from "./inbox-CKssCQNk.js";
|
|
17
|
+
import { FederationBuilderImpl } from "./builder-BMWyrhEH.js";
|
|
18
18
|
import { buildCollectionSynchronizationHeader } from "./collection-D5V3UzU3.js";
|
|
19
|
-
import { KvKeyCache } from "./keycache-
|
|
19
|
+
import { KvKeyCache } from "./keycache-DGObidvq.js";
|
|
20
20
|
import { createExponentialBackoffPolicy } from "./retry-BnpVRGFC.js";
|
|
21
|
-
import { extractInboxes, sendActivity } from "./send-
|
|
21
|
+
import { extractInboxes, sendActivity } from "./send-CrjrTnXW.js";
|
|
22
22
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
23
23
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
24
24
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
@@ -361,13 +361,6 @@ function acceptsJsonLd(request) {
|
|
|
361
361
|
if (types[0] === "text/html" || types[0] === "application/xhtml+xml") return false;
|
|
362
362
|
return types.includes("application/activity+json") || types.includes("application/ld+json") || types.includes("application/json");
|
|
363
363
|
}
|
|
364
|
-
/**
|
|
365
|
-
* Handles an actor request.
|
|
366
|
-
* @typeParam TContextData The context data to pass to the context.
|
|
367
|
-
* @param request The HTTP request.
|
|
368
|
-
* @param parameters The parameters for handling the actor.
|
|
369
|
-
* @returns A promise that resolves to an HTTP response.
|
|
370
|
-
*/
|
|
371
364
|
async function handleActor(request, { identifier, context: context$1, actorDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
|
|
372
365
|
const logger$2 = getLogger([
|
|
373
366
|
"fedify",
|
|
@@ -411,13 +404,6 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
|
|
|
411
404
|
Vary: "Accept"
|
|
412
405
|
} });
|
|
413
406
|
}
|
|
414
|
-
/**
|
|
415
|
-
* Handles an object request.
|
|
416
|
-
* @typeParam TContextData The context data to pass to the context.
|
|
417
|
-
* @param request The HTTP request.
|
|
418
|
-
* @param parameters The parameters for handling the object.
|
|
419
|
-
* @returns A promise that resolves to an HTTP response.
|
|
420
|
-
*/
|
|
421
407
|
async function handleObject(request, { values, context: context$1, objectDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
|
|
422
408
|
if (objectDispatcher == null) return await onNotFound(request);
|
|
423
409
|
const object = await objectDispatcher(context$1, values);
|
|
@@ -450,16 +436,6 @@ async function handleObject(request, { values, context: context$1, objectDispatc
|
|
|
450
436
|
Vary: "Accept"
|
|
451
437
|
} });
|
|
452
438
|
}
|
|
453
|
-
/**
|
|
454
|
-
* Handles a collection request.
|
|
455
|
-
* @typeParam TItem The type of items in the collection.
|
|
456
|
-
* @typeParam TContext The type of the context, extending {@link RequestContext}.
|
|
457
|
-
* @typeParam TContextData The context data to pass to the `TContext`.
|
|
458
|
-
* @typeParam TFilter The type of the filter.
|
|
459
|
-
* @param request The HTTP request.
|
|
460
|
-
* @param parameters The parameters for handling the collection.
|
|
461
|
-
* @returns A promise that resolves to an HTTP response.
|
|
462
|
-
*/
|
|
463
439
|
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound, onNotAcceptable }) {
|
|
464
440
|
const spanName = name.trim().replace(/\s+/g, "_");
|
|
465
441
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
@@ -601,14 +577,6 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
601
577
|
Vary: "Accept"
|
|
602
578
|
} });
|
|
603
579
|
}
|
|
604
|
-
/**
|
|
605
|
-
* Filters collection items based on the provided predicate.
|
|
606
|
-
* @typeParam TItem The type of items to filter.
|
|
607
|
-
* @param items The items to filter.
|
|
608
|
-
* @param collectionName The name of the collection for logging purposes.
|
|
609
|
-
* @param filterPredicate Optional predicate function to filter items.
|
|
610
|
-
* @returns The filtered items as Objects, Links, or URLs.
|
|
611
|
-
*/
|
|
612
580
|
function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
613
581
|
const result = [];
|
|
614
582
|
let logged = false;
|
|
@@ -632,13 +600,6 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
632
600
|
}
|
|
633
601
|
return result;
|
|
634
602
|
}
|
|
635
|
-
/**
|
|
636
|
-
* Handles an inbox request for ActivityPub activities.
|
|
637
|
-
* @typeParam TContextData The context data to pass to the context.
|
|
638
|
-
* @param request The HTTP request.
|
|
639
|
-
* @param options The parameters for handling the inbox.
|
|
640
|
-
* @returns A promise that resolves to an HTTP response.
|
|
641
|
-
*/
|
|
642
603
|
async function handleInbox(request, options) {
|
|
643
604
|
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
|
644
605
|
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
@@ -660,14 +621,6 @@ async function handleInbox(request, options) {
|
|
|
660
621
|
}
|
|
661
622
|
});
|
|
662
623
|
}
|
|
663
|
-
/**
|
|
664
|
-
* Internal function for handling inbox requests with detailed processing.
|
|
665
|
-
* @typeParam TContextData The context data to pass to the context.
|
|
666
|
-
* @param request The HTTP request.
|
|
667
|
-
* @param options The parameters for handling the inbox.
|
|
668
|
-
* @param span The OpenTelemetry span for tracing.
|
|
669
|
-
* @returns A promise that resolves to an HTTP response.
|
|
670
|
-
*/
|
|
671
624
|
async function handleInboxInternal(request, { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, tracerProvider }, span) {
|
|
672
625
|
const logger$2 = getLogger([
|
|
673
626
|
"fedify",
|
|
@@ -898,447 +851,6 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
898
851
|
});
|
|
899
852
|
}
|
|
900
853
|
/**
|
|
901
|
-
* Handles a custom collection request.
|
|
902
|
-
* @typeParam TItem The type of items in the collection.
|
|
903
|
-
* @typeParam TParams The parameter names of the requested URL.
|
|
904
|
-
* @typeParam TContext The type of the context, extending {@link RequestContext}.
|
|
905
|
-
* @typeParam TContextData The context data to pass to the `TContext`.
|
|
906
|
-
* @param request The HTTP request.
|
|
907
|
-
* @param handleParams Parameters for handling the collection.
|
|
908
|
-
* @returns A promise that resolves to an HTTP response.
|
|
909
|
-
* @since 1.8.0
|
|
910
|
-
*/
|
|
911
|
-
const handleCustomCollection = exceptWrapper(_handleCustomCollection);
|
|
912
|
-
async function _handleCustomCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
|
913
|
-
verifyDefined(callbacks);
|
|
914
|
-
verifyJsonLdRequest(request);
|
|
915
|
-
await authIfNeeded(context$1, values, callbacks);
|
|
916
|
-
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
917
|
-
return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, Collection, CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* Handles an ordered collection request.
|
|
921
|
-
* @typeParam TItem The type of items in the collection.
|
|
922
|
-
* @typeParam TParams The parameter names of the requested URL.
|
|
923
|
-
* @typeParam TContext The type of the context, extending {@link RequestContext}.
|
|
924
|
-
* @typeParam TContextData The context data to pass to the `TContext`.
|
|
925
|
-
* @param request The HTTP request.
|
|
926
|
-
* @param handleParams Parameters for handling the collection.
|
|
927
|
-
* @returns A promise that resolves to an HTTP response.
|
|
928
|
-
* @since 1.8.0
|
|
929
|
-
*/
|
|
930
|
-
const handleOrderedCollection = exceptWrapper(_handleOrderedCollection);
|
|
931
|
-
async function _handleOrderedCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
|
932
|
-
verifyDefined(callbacks);
|
|
933
|
-
verifyJsonLdRequest(request);
|
|
934
|
-
await authIfNeeded(context$1, values, callbacks);
|
|
935
|
-
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
936
|
-
return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, OrderedCollection, OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
937
|
-
}
|
|
938
|
-
/**
|
|
939
|
-
* Handling custom collections with support for pagination and filtering.
|
|
940
|
-
* The main flow is on `getCollection`, `dispatch`.
|
|
941
|
-
*
|
|
942
|
-
* @typeParam TItem The type of items in the collection.
|
|
943
|
-
* @typeParam TParams The parameter names of the requested URL.
|
|
944
|
-
* @typeParam TContext The type of the context. {@link Context} or {@link RequestContext}.
|
|
945
|
-
* @typeParam TContextData The context data to pass to the `TContext`.
|
|
946
|
-
* @typeParam TCollection The type of the collection, extending {@link Collection}.
|
|
947
|
-
* @typeParam TCollectionPage The type of the collection page, extending {@link CollectionPage}.
|
|
948
|
-
* @since 1.8.0
|
|
949
|
-
*/
|
|
950
|
-
var CustomCollectionHandler = class {
|
|
951
|
-
/**
|
|
952
|
-
* The tracer for telemetry.
|
|
953
|
-
* @type {Tracer}
|
|
954
|
-
*/
|
|
955
|
-
#tracer;
|
|
956
|
-
/**
|
|
957
|
-
* The ID of the collection.
|
|
958
|
-
* @type {URL}
|
|
959
|
-
*/
|
|
960
|
-
#id;
|
|
961
|
-
/**
|
|
962
|
-
* Store total count of items in the collection.
|
|
963
|
-
* Use `this.totalItems` to access the total items count.
|
|
964
|
-
* It is a promise because it may require an asynchronous operation to count items.
|
|
965
|
-
* @type {Promise<number | null> | undefined}
|
|
966
|
-
*/
|
|
967
|
-
#totalItems = void 0;
|
|
968
|
-
/**
|
|
969
|
-
* The first cursor for pagination.
|
|
970
|
-
* It is a promise because it may require an asynchronous operation to get the first cursor.
|
|
971
|
-
* @type {Promise<string | null> | undefined}
|
|
972
|
-
*/
|
|
973
|
-
#dispatcher;
|
|
974
|
-
#collection = null;
|
|
975
|
-
/**
|
|
976
|
-
* Creates a new CustomCollection instance.
|
|
977
|
-
* @param {string} name The name of the collection.
|
|
978
|
-
* @param {TParams} values The parameter values for the collection.
|
|
979
|
-
* @param {TContext} context The request context.
|
|
980
|
-
* @param {CustomCollectionCallbacks} callbacks The collection callbacks.
|
|
981
|
-
* @param {TracerProvider} tracerProvider The tracer provider for telemetry.
|
|
982
|
-
* @param {ConstructorWithTypeId<TCollection>} Collection The Collection constructor.
|
|
983
|
-
* @param {ConstructorWithTypeId<TCollectionPage>} CollectionPage The CollectionPage constructor.
|
|
984
|
-
* @param {(item: TItem) => boolean} filterPredicate Optional filter predicate for items.
|
|
985
|
-
*/
|
|
986
|
-
constructor(name, values, context$1, callbacks, tracerProvider = trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
|
|
987
|
-
this.name = name;
|
|
988
|
-
this.values = values;
|
|
989
|
-
this.context = context$1;
|
|
990
|
-
this.callbacks = callbacks;
|
|
991
|
-
this.tracerProvider = tracerProvider;
|
|
992
|
-
this.Collection = Collection$1;
|
|
993
|
-
this.CollectionPage = CollectionPage$1;
|
|
994
|
-
this.filterPredicate = filterPredicate;
|
|
995
|
-
this.name = this.name.trim().replace(/\s+/g, "_");
|
|
996
|
-
this.#tracer = this.tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
997
|
-
this.#id = new URL(this.context.url);
|
|
998
|
-
this.#dispatcher = callbacks.dispatcher.bind(callbacks);
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* Converts the collection to JSON-LD format.
|
|
1002
|
-
* @returns A promise that resolves to the JSON-LD representation.
|
|
1003
|
-
*/
|
|
1004
|
-
async toJsonLd() {
|
|
1005
|
-
return (await this.collection).toJsonLd(this.context);
|
|
1006
|
-
}
|
|
1007
|
-
/**
|
|
1008
|
-
* Fetches the collection with optional cursor for pagination.
|
|
1009
|
-
* This method is defined for method chaining and to show processing flow properly.
|
|
1010
|
-
* So it is no problem to call `toJsonLd` directly on the instance.
|
|
1011
|
-
* @param cursor The cursor for pagination, or null for the first page.
|
|
1012
|
-
* @returns The CustomCollection instance for method chaining.
|
|
1013
|
-
*/
|
|
1014
|
-
fetchCollection(cursor = null) {
|
|
1015
|
-
this.#collection = this.getCollection(cursor);
|
|
1016
|
-
return this;
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* Gets the collection or collection page based on the cursor.
|
|
1020
|
-
* @param {string | null} cursor The cursor for pagination, or null for the main collection.
|
|
1021
|
-
* @returns {Promise<TCollection | TCollectionPage>} A promise that resolves to a Collection or CollectionPage.
|
|
1022
|
-
*/
|
|
1023
|
-
async getCollection(cursor = null) {
|
|
1024
|
-
if (cursor !== null) {
|
|
1025
|
-
const props$1 = await this.getPageProps(cursor);
|
|
1026
|
-
return new this.CollectionPage(props$1);
|
|
1027
|
-
}
|
|
1028
|
-
const firstCursor = await this.firstCursor;
|
|
1029
|
-
const props = typeof firstCursor === "string" ? await this.getProps(firstCursor) : await this.getPropsWithoutCursor();
|
|
1030
|
-
return new this.Collection(props);
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Gets the properties for a collection page.
|
|
1034
|
-
* Returns the page properties including items, previous and next cursors.
|
|
1035
|
-
* @param {string} cursor The cursor for the page.
|
|
1036
|
-
* @returns A promise that resolves to the page properties.
|
|
1037
|
-
*/
|
|
1038
|
-
async getPageProps(cursor) {
|
|
1039
|
-
const id = this.#id;
|
|
1040
|
-
const pages = await this.getPages({ cursor });
|
|
1041
|
-
const { prevCursor, nextCursor } = pages;
|
|
1042
|
-
const partOf = new URL(id);
|
|
1043
|
-
partOf.searchParams.delete("cursor");
|
|
1044
|
-
return {
|
|
1045
|
-
id,
|
|
1046
|
-
partOf,
|
|
1047
|
-
items: this.filterItems(pages.items),
|
|
1048
|
-
prev: this.appendToUrl(prevCursor),
|
|
1049
|
-
next: this.appendToUrl(nextCursor)
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Gets the properties for a collection with cursors.
|
|
1054
|
-
* Returns the first cursor and last cursor as URL, along with total items count.
|
|
1055
|
-
* @param {string} firstCursor The first cursor for pagination.
|
|
1056
|
-
* @returns A promise that resolves to the collection properties.
|
|
1057
|
-
*/
|
|
1058
|
-
async getProps(firstCursor) {
|
|
1059
|
-
const lastCursor = await this.callbacks.lastCursor?.(this.context, this.values);
|
|
1060
|
-
return {
|
|
1061
|
-
id: this.#id,
|
|
1062
|
-
first: this.appendToUrl(firstCursor),
|
|
1063
|
-
last: this.appendToUrl(lastCursor),
|
|
1064
|
-
totalItems: await this.totalItems
|
|
1065
|
-
};
|
|
1066
|
-
}
|
|
1067
|
-
/**
|
|
1068
|
-
* Gets the properties for a collection of all items and the count.
|
|
1069
|
-
* @returns A promise that resolves to the collection properties.
|
|
1070
|
-
*/
|
|
1071
|
-
async getPropsWithoutCursor() {
|
|
1072
|
-
const totalItems = await this.totalItems;
|
|
1073
|
-
const pages = await this.getPages({ totalItems });
|
|
1074
|
-
return {
|
|
1075
|
-
id: this.#id,
|
|
1076
|
-
totalItems,
|
|
1077
|
-
items: this.filterItems(pages.items)
|
|
1078
|
-
};
|
|
1079
|
-
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Gets a page of items from the collection.
|
|
1082
|
-
* Wraps the dispatcher in a span for telemetry.
|
|
1083
|
-
* @param options Options for getting the page, including cursor and total items.
|
|
1084
|
-
* @returns A promise that resolves to the page items.
|
|
1085
|
-
*/
|
|
1086
|
-
async getPages({ cursor = null, totalItems = null }) {
|
|
1087
|
-
return await this.#tracer.startActiveSpan(`${this.ATTRS.DISPATCH_COLLECTION} ${this.name}`, this.spanOptions(SpanKind.SERVER, cursor), this.spanPages({
|
|
1088
|
-
cursor,
|
|
1089
|
-
totalItems
|
|
1090
|
-
}));
|
|
1091
|
-
}
|
|
1092
|
-
/**
|
|
1093
|
-
* Creates span options for telemetry.
|
|
1094
|
-
* @param {SpanKind} kind The span kind.
|
|
1095
|
-
* @param {string | null} cursor The optional cursor value.
|
|
1096
|
-
* @returns {SpanOptions}The span options.
|
|
1097
|
-
*/
|
|
1098
|
-
spanOptions = (kind, cursor) => ({
|
|
1099
|
-
kind,
|
|
1100
|
-
attributes: {
|
|
1101
|
-
[this.ATTRS.ID]: this.#id.href,
|
|
1102
|
-
[this.ATTRS.TYPE]: this.Collection.typeId.href,
|
|
1103
|
-
...cursor ? { [this.ATTRS.CURSOR]: cursor } : {}
|
|
1104
|
-
}
|
|
1105
|
-
});
|
|
1106
|
-
/**
|
|
1107
|
-
* Creates a function to wrap the dispatcher so tracing can be applied.
|
|
1108
|
-
* @param params Parameters including cursor and total items.
|
|
1109
|
-
* @returns {(span: Span) => Promise<PageItems<TItem>>} A function that handles the span operation.
|
|
1110
|
-
*/
|
|
1111
|
-
spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
|
|
1112
|
-
try {
|
|
1113
|
-
if (totalItems !== null) span.setAttribute(this.ATTRS.TOTAL_ITEMS, totalItems);
|
|
1114
|
-
const page = await this.dispatch(cursor);
|
|
1115
|
-
span.setAttribute(this.ATTRS.ITEMS, page.items.length);
|
|
1116
|
-
return page;
|
|
1117
|
-
} catch (e) {
|
|
1118
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
1119
|
-
span.setStatus({
|
|
1120
|
-
code: SpanStatusCode.ERROR,
|
|
1121
|
-
message
|
|
1122
|
-
});
|
|
1123
|
-
throw e;
|
|
1124
|
-
} finally {
|
|
1125
|
-
span.end();
|
|
1126
|
-
}
|
|
1127
|
-
};
|
|
1128
|
-
/**
|
|
1129
|
-
* Dispatches the collection request to get items.
|
|
1130
|
-
* @param {string | null} cursor The cursor for pagination, or null for the first page.
|
|
1131
|
-
* @returns {Promise<PageItems<TItem>>} A promise that resolves to the page items.
|
|
1132
|
-
*/
|
|
1133
|
-
async dispatch(cursor = null) {
|
|
1134
|
-
return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
|
|
1135
|
-
}
|
|
1136
|
-
/**
|
|
1137
|
-
* Filters the items in the collection.
|
|
1138
|
-
* @param {TItem[]} items The items to filter.
|
|
1139
|
-
* @returns {(Object | Link | URL)[]} The filtered items.
|
|
1140
|
-
*/
|
|
1141
|
-
filterItems(items) {
|
|
1142
|
-
return filterCollectionItems(items, this.name, this.filterPredicate);
|
|
1143
|
-
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Appends a cursor to the URL if it exists.
|
|
1146
|
-
* @param {string | null | undefined} cursor The cursor to append, or null/undefined.
|
|
1147
|
-
* @returns The URL with cursor appended, or null if cursor is null/undefined.
|
|
1148
|
-
*/
|
|
1149
|
-
appendToUrl(cursor) {
|
|
1150
|
-
return appendCursorIfExists(this.context.url, cursor);
|
|
1151
|
-
}
|
|
1152
|
-
/**
|
|
1153
|
-
* Gets the stored collection or collection page.
|
|
1154
|
-
* @returns {Promise<TCollection | TCollectionPage>} A promise that resolves to
|
|
1155
|
-
the collection or collection page.
|
|
1156
|
-
*/
|
|
1157
|
-
get collection() {
|
|
1158
|
-
if (this.#collection === null) this.#collection = this.getCollection();
|
|
1159
|
-
return this.#collection;
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Gets the total number of items in the collection.
|
|
1163
|
-
* @returns {Promise<number | null>} A promise that
|
|
1164
|
-
resolves to the total items count, or null if not available.
|
|
1165
|
-
*/
|
|
1166
|
-
get totalItems() {
|
|
1167
|
-
if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
|
|
1168
|
-
return this.#totalItems;
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Sets the total number of items in the collection.
|
|
1172
|
-
* @param value The total items count or a promise that resolves to it.
|
|
1173
|
-
*/
|
|
1174
|
-
set totalItems(value) {
|
|
1175
|
-
const toNumber = (value$1) => value$1 == null ? null : Number(value$1);
|
|
1176
|
-
this.#totalItems = value instanceof Promise ? value.then(toNumber) : Promise.resolve(toNumber(value));
|
|
1177
|
-
}
|
|
1178
|
-
/**
|
|
1179
|
-
* Gets the first cursor for pagination.
|
|
1180
|
-
* @returns {Promise<string | null>} A promise that resolves to the first cursor,
|
|
1181
|
-
or null if not available.
|
|
1182
|
-
*/
|
|
1183
|
-
get firstCursor() {
|
|
1184
|
-
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
|
|
1185
|
-
return Promise.resolve(cursor ?? null);
|
|
1186
|
-
}
|
|
1187
|
-
/**
|
|
1188
|
-
* Attribute constants for telemetry spans.
|
|
1189
|
-
*/
|
|
1190
|
-
ATTRS = {
|
|
1191
|
-
DISPATCH_COLLECTION: "activitypub.dispatch_collection",
|
|
1192
|
-
CURSOR: "fedify.collection.cursor",
|
|
1193
|
-
ID: "activitypub.collection.id",
|
|
1194
|
-
ITEMS: "fedify.collection.items",
|
|
1195
|
-
TOTAL_ITEMS: "activitypub.collection.total_items",
|
|
1196
|
-
TYPE: "activitypub.collection.type"
|
|
1197
|
-
};
|
|
1198
|
-
};
|
|
1199
|
-
/**
|
|
1200
|
-
* A wrapper function that catches specific errors and handles them appropriately.
|
|
1201
|
-
* @typeParam TParams The type of parameters that extend ErrorHandlers.
|
|
1202
|
-
* @param handler The handler function to wrap.
|
|
1203
|
-
* @returns A wrapped handler function that catches and handles specific errors.
|
|
1204
|
-
* @since 1.8.0
|
|
1205
|
-
*/
|
|
1206
|
-
function exceptWrapper(handler) {
|
|
1207
|
-
return async (request, handlerParams) => {
|
|
1208
|
-
try {
|
|
1209
|
-
return await handler(request, handlerParams);
|
|
1210
|
-
} catch (error) {
|
|
1211
|
-
const { onNotFound, onNotAcceptable, onUnauthorized } = handlerParams;
|
|
1212
|
-
switch (error?.constructor) {
|
|
1213
|
-
case ItemsNotFoundError: return await onNotFound(request);
|
|
1214
|
-
case NotAcceptableError: return await onNotAcceptable(request);
|
|
1215
|
-
case UnauthorizedError: return await onUnauthorized(request);
|
|
1216
|
-
default: throw error;
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* Verifies that a value is defined (not undefined).
|
|
1223
|
-
* @typeParam T The type of the value, excluding undefined.
|
|
1224
|
-
* @param callbacks The value to verify.
|
|
1225
|
-
* @throws {ItemsNotFoundError} If the value is undefined.
|
|
1226
|
-
* @since 1.8.0
|
|
1227
|
-
*/
|
|
1228
|
-
const verifyDefined = (callbacks) => {
|
|
1229
|
-
if (callbacks === void 0) throw new ItemsNotFoundError();
|
|
1230
|
-
};
|
|
1231
|
-
/**
|
|
1232
|
-
* Verifies that a request accepts JSON-LD content type.
|
|
1233
|
-
* @param request The HTTP request to verify.
|
|
1234
|
-
* @throws {NotAcceptableError} If the request doesn't accept JSON-LD.
|
|
1235
|
-
* @since 1.8.0
|
|
1236
|
-
*/
|
|
1237
|
-
const verifyJsonLdRequest = (request) => {
|
|
1238
|
-
if (!acceptsJsonLd(request)) throw new NotAcceptableError();
|
|
1239
|
-
};
|
|
1240
|
-
/**
|
|
1241
|
-
* Performs authorization if needed based on the authorization predicate.
|
|
1242
|
-
* @typeParam TContextData The context data type.
|
|
1243
|
-
* @param {RequestContext<TContextData>} context The request context.
|
|
1244
|
-
* @param {Record<string, string>} values The parameter values.
|
|
1245
|
-
* @param options Options containing the authorization predicate.
|
|
1246
|
-
* @throws {UnauthorizedError} If authorization fails.
|
|
1247
|
-
* @since 1.8.0
|
|
1248
|
-
*/
|
|
1249
|
-
const authIfNeeded = async (context$1, values, { authorizePredicate: authorize = void 0 }) => {
|
|
1250
|
-
if (authorize === void 0) return;
|
|
1251
|
-
const key = (await context$1.getSignedKey())?.clone({}, warning.key) ?? null;
|
|
1252
|
-
const keyOwner = (await context$1.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
|
|
1253
|
-
if (!await authorize(context$1, values, key, keyOwner)) throw new UnauthorizedError();
|
|
1254
|
-
};
|
|
1255
|
-
/** Warning messages for `authIfNeeded`. */
|
|
1256
|
-
const warning = {
|
|
1257
|
-
key: { $warning: {
|
|
1258
|
-
category: [
|
|
1259
|
-
"fedify",
|
|
1260
|
-
"federation",
|
|
1261
|
-
"collection"
|
|
1262
|
-
],
|
|
1263
|
-
message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
|
|
1264
|
-
} },
|
|
1265
|
-
keyOwner: { $warning: {
|
|
1266
|
-
category: [
|
|
1267
|
-
"fedify",
|
|
1268
|
-
"federation",
|
|
1269
|
-
"collection"
|
|
1270
|
-
],
|
|
1271
|
-
message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
|
|
1272
|
-
} }
|
|
1273
|
-
};
|
|
1274
|
-
/**
|
|
1275
|
-
* Appends a cursor parameter to a URL if the cursor exists.
|
|
1276
|
-
* @typeParam Cursor The type of the cursor (string, null, or undefined).
|
|
1277
|
-
* @param {URL} url The base URL to append the cursor to.
|
|
1278
|
-
* @param {string | null | undefined} cursor The cursor value to append.
|
|
1279
|
-
* @returns The URL with cursor appended if cursor is a string, null otherwise.
|
|
1280
|
-
* @since 1.8.0
|
|
1281
|
-
*/
|
|
1282
|
-
const appendCursorIfExists = (url, cursor) => {
|
|
1283
|
-
if (cursor === null || cursor === void 0) return null;
|
|
1284
|
-
const copied = new URL(url);
|
|
1285
|
-
copied.searchParams.set("cursor", cursor);
|
|
1286
|
-
return copied;
|
|
1287
|
-
};
|
|
1288
|
-
/**
|
|
1289
|
-
* Creates an HTTP response for ActivityPub data.
|
|
1290
|
-
* @param {unknown} data The data to serialize as JSON-LD.
|
|
1291
|
-
* @returns {Response} An HTTP response with the data as ActivityPub JSON.
|
|
1292
|
-
* @since 1.8.0
|
|
1293
|
-
*/
|
|
1294
|
-
const respondAsActivity = (data) => new Response(JSON.stringify(data), { headers: {
|
|
1295
|
-
"Content-Type": "application/activity+json",
|
|
1296
|
-
Vary: "Accept"
|
|
1297
|
-
} });
|
|
1298
|
-
/**
|
|
1299
|
-
* Base class for handler errors.
|
|
1300
|
-
* @since 1.8.0
|
|
1301
|
-
*/
|
|
1302
|
-
var HandlerError = class extends Error {
|
|
1303
|
-
constructor(message) {
|
|
1304
|
-
super(message);
|
|
1305
|
-
}
|
|
1306
|
-
/**
|
|
1307
|
-
* Throws this error.
|
|
1308
|
-
* @returns Never returns, always throws.
|
|
1309
|
-
*/
|
|
1310
|
-
throw() {
|
|
1311
|
-
throw this;
|
|
1312
|
-
}
|
|
1313
|
-
};
|
|
1314
|
-
/**
|
|
1315
|
-
* Error thrown when items are not found in a collection.
|
|
1316
|
-
* @since 1.8.0
|
|
1317
|
-
*/
|
|
1318
|
-
var ItemsNotFoundError = class extends HandlerError {
|
|
1319
|
-
constructor() {
|
|
1320
|
-
super("Items not found in the collection.");
|
|
1321
|
-
}
|
|
1322
|
-
};
|
|
1323
|
-
/**
|
|
1324
|
-
* Error thrown when the request is not acceptable (e.g., wrong content type).
|
|
1325
|
-
* @since 1.8.0
|
|
1326
|
-
*/
|
|
1327
|
-
var NotAcceptableError = class extends HandlerError {
|
|
1328
|
-
constructor() {
|
|
1329
|
-
super("The request is not acceptable.");
|
|
1330
|
-
}
|
|
1331
|
-
};
|
|
1332
|
-
/**
|
|
1333
|
-
* Error thrown when access to a collection is unauthorized.
|
|
1334
|
-
* @since 1.8.0
|
|
1335
|
-
*/
|
|
1336
|
-
var UnauthorizedError = class extends HandlerError {
|
|
1337
|
-
constructor() {
|
|
1338
|
-
super("Unauthorized access to the collection.");
|
|
1339
|
-
}
|
|
1340
|
-
};
|
|
1341
|
-
/**
|
|
1342
854
|
* Responds with the given object in JSON-LD format.
|
|
1343
855
|
*
|
|
1344
856
|
* @param object The object to respond with.
|
|
@@ -2218,34 +1730,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2218
1730
|
onNotFound,
|
|
2219
1731
|
onNotAcceptable
|
|
2220
1732
|
});
|
|
2221
|
-
case "collection": {
|
|
2222
|
-
const name = route.name.replace(/^collection:/, "");
|
|
2223
|
-
const callbacks = this.collectionCallbacks[name];
|
|
2224
|
-
return await handleCustomCollection(request, {
|
|
2225
|
-
name,
|
|
2226
|
-
context: context$1,
|
|
2227
|
-
values: route.values,
|
|
2228
|
-
collectionCallbacks: callbacks,
|
|
2229
|
-
tracerProvider: this.tracerProvider,
|
|
2230
|
-
onUnauthorized,
|
|
2231
|
-
onNotFound,
|
|
2232
|
-
onNotAcceptable
|
|
2233
|
-
});
|
|
2234
|
-
}
|
|
2235
|
-
case "orderedCollection": {
|
|
2236
|
-
const name = route.name.replace(/^orderedCollection:/, "");
|
|
2237
|
-
const callbacks = this.collectionCallbacks[name];
|
|
2238
|
-
return await handleOrderedCollection(request, {
|
|
2239
|
-
name,
|
|
2240
|
-
context: context$1,
|
|
2241
|
-
values: route.values,
|
|
2242
|
-
collectionCallbacks: callbacks,
|
|
2243
|
-
tracerProvider: this.tracerProvider,
|
|
2244
|
-
onUnauthorized,
|
|
2245
|
-
onNotFound,
|
|
2246
|
-
onNotAcceptable
|
|
2247
|
-
});
|
|
2248
|
-
}
|
|
2249
1733
|
default: {
|
|
2250
1734
|
const response = onNotFound(request);
|
|
2251
1735
|
return response instanceof Promise ? await response : response;
|
|
@@ -2386,18 +1870,6 @@ var ContextImpl = class ContextImpl {
|
|
|
2386
1870
|
if (path == null) throw new RouterError("No featured tags collection path registered.");
|
|
2387
1871
|
return new URL(path, this.canonicalOrigin);
|
|
2388
1872
|
}
|
|
2389
|
-
getCollectionUri(name, values) {
|
|
2390
|
-
const customCallbacks = this.federation.collectionCallbacks[name];
|
|
2391
|
-
if (customCallbacks != null) {
|
|
2392
|
-
const collectionRouteName = `collection:${String(name)}`;
|
|
2393
|
-
const orderedCollectionRouteName = `orderedCollection:${String(name)}`;
|
|
2394
|
-
let path = this.federation.router.build(collectionRouteName, values);
|
|
2395
|
-
if (path == null) path = this.federation.router.build(orderedCollectionRouteName, values);
|
|
2396
|
-
if (path == null) throw new RouterError(`No collection dispatcher registered for ${String(name)}.`);
|
|
2397
|
-
return new URL(path, this.canonicalOrigin);
|
|
2398
|
-
}
|
|
2399
|
-
throw new RouterError(`No collection dispatcher registered for ${String(name)}.`);
|
|
2400
|
-
}
|
|
2401
1873
|
parseUri(uri) {
|
|
2402
1874
|
if (uri == null) return null;
|
|
2403
1875
|
if (uri.origin !== this.origin && uri.origin !== this.canonicalOrigin) return null;
|
|
@@ -2485,20 +1957,6 @@ var ContextImpl = class ContextImpl {
|
|
|
2485
1957
|
return identifier;
|
|
2486
1958
|
}
|
|
2487
1959
|
};
|
|
2488
|
-
const collectionTypes = ["collection", "orderedCollection"];
|
|
2489
|
-
const collectionRegex = /* @__PURE__ */ new RegExp(`^(${collectionTypes.join("|")}):(.*)$`);
|
|
2490
|
-
const match = route.name.match(collectionRegex);
|
|
2491
|
-
if (match !== null) {
|
|
2492
|
-
const [, type, name] = match;
|
|
2493
|
-
const cls = this.federation.collectionTypeIds[name];
|
|
2494
|
-
return {
|
|
2495
|
-
type,
|
|
2496
|
-
name,
|
|
2497
|
-
class: cls,
|
|
2498
|
-
typeId: cls.typeId,
|
|
2499
|
-
values: route.values
|
|
2500
|
-
};
|
|
2501
|
-
}
|
|
2502
1960
|
return null;
|
|
2503
1961
|
}
|
|
2504
1962
|
async getActorKeyPairs(identifier) {
|
|
@@ -3218,4 +2676,4 @@ function getRequestId(request) {
|
|
|
3218
2676
|
}
|
|
3219
2677
|
|
|
3220
2678
|
//#endregion
|
|
3221
|
-
export { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, acceptsJsonLd, actorDehydrator, autoIdAssigner, createFederation, handleActor, handleCollection,
|
|
2679
|
+
export { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, acceptsJsonLd, actorDehydrator, autoIdAssigner, createFederation, handleActor, handleCollection, handleInbox, handleNodeInfo, handleNodeInfoJrd, handleObject, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|