@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
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
5
|
import { getDefaultActivityTransformers } from "./transformers-ghwJuzGY.js";
|
|
6
|
-
import { deno_default, getDocumentLoader, kvCache } from "./docloader-
|
|
7
|
-
import { Activity,
|
|
8
|
-
import { lookupWebFinger } from "./lookup-
|
|
9
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
10
|
-
import { doubleKnock, verifyRequest } from "./http-
|
|
11
|
-
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-
|
|
12
|
-
import { getNodeInfo, nodeInfoToJson } from "./types-
|
|
13
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
14
|
-
import { lookupObject, traverseCollection } from "./vocab-
|
|
6
|
+
import { deno_default, getDocumentLoader, kvCache } from "./docloader-BU0Mbf3M.js";
|
|
7
|
+
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-BxYrc06V.js";
|
|
8
|
+
import { lookupWebFinger } from "./lookup-rBByGTyy.js";
|
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-BBZcKCrH.js";
|
|
10
|
+
import { doubleKnock, verifyRequest } from "./http-CYR3mIVn.js";
|
|
11
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-CUsFh6B-.js";
|
|
12
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-DZdBK266.js";
|
|
13
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-mGQvrIQ2.js";
|
|
14
|
+
import { lookupObject, traverseCollection } from "./vocab-BLQ-_oLb.js";
|
|
15
15
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
16
16
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
17
17
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -306,17 +306,13 @@ var FederationBuilderImpl = class {
|
|
|
306
306
|
inboxListeners;
|
|
307
307
|
inboxErrorHandler;
|
|
308
308
|
sharedInboxKeyDispatcher;
|
|
309
|
-
collectionTypeIds;
|
|
310
|
-
collectionCallbacks;
|
|
311
309
|
constructor() {
|
|
312
310
|
this.router = new Router$1();
|
|
313
311
|
this.objectCallbacks = {};
|
|
314
312
|
this.objectTypeIds = {};
|
|
315
|
-
this.collectionCallbacks = {};
|
|
316
|
-
this.collectionTypeIds = {};
|
|
317
313
|
}
|
|
318
314
|
async build(options) {
|
|
319
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
|
315
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-DbDzHrt7.js");
|
|
320
316
|
const f = new FederationImpl$1(options);
|
|
321
317
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
322
318
|
f.router = this.router.clone();
|
|
@@ -760,41 +756,6 @@ var FederationBuilderImpl = class {
|
|
|
760
756
|
};
|
|
761
757
|
return setters;
|
|
762
758
|
}
|
|
763
|
-
setCollectionDispatcher(name, ...args) {
|
|
764
|
-
return this.#setCustomCollectionDispatcher(name, "collection", ...args);
|
|
765
|
-
}
|
|
766
|
-
setOrderedCollectionDispatcher(name, ...args) {
|
|
767
|
-
return this.#setCustomCollectionDispatcher(name, "orderedCollection", ...args);
|
|
768
|
-
}
|
|
769
|
-
#setCustomCollectionDispatcher(name, collectionType, itemType, path, dispatcher) {
|
|
770
|
-
const routeName = `${collectionType}:${String(name)}`;
|
|
771
|
-
if (this.router.has(routeName)) throw new RouterError(`Collection dispatcher for ${String(name)} already set.`);
|
|
772
|
-
if (this.collectionCallbacks[name] != null) throw new RouterError(`Collection dispatcher for ${String(name)} already set.`);
|
|
773
|
-
const variables = this.router.add(path, routeName);
|
|
774
|
-
if (variables.size < 1) throw new RouterError("Path for collection dispatcher must have at least one variable.");
|
|
775
|
-
const callbacks = { dispatcher };
|
|
776
|
-
this.collectionCallbacks[name] = callbacks;
|
|
777
|
-
this.collectionTypeIds[name] = itemType;
|
|
778
|
-
const setters = {
|
|
779
|
-
setCounter(counter) {
|
|
780
|
-
callbacks.counter = counter;
|
|
781
|
-
return setters;
|
|
782
|
-
},
|
|
783
|
-
setFirstCursor(cursor) {
|
|
784
|
-
callbacks.firstCursor = cursor;
|
|
785
|
-
return setters;
|
|
786
|
-
},
|
|
787
|
-
setLastCursor(cursor) {
|
|
788
|
-
callbacks.lastCursor = cursor;
|
|
789
|
-
return setters;
|
|
790
|
-
},
|
|
791
|
-
authorize(predicate) {
|
|
792
|
-
callbacks.authorizePredicate = predicate;
|
|
793
|
-
return setters;
|
|
794
|
-
}
|
|
795
|
-
};
|
|
796
|
-
return setters;
|
|
797
|
-
}
|
|
798
759
|
};
|
|
799
760
|
/**
|
|
800
761
|
* Creates a new {@link FederationBuilder} instance.
|
|
@@ -953,13 +914,6 @@ function acceptsJsonLd(request) {
|
|
|
953
914
|
if (types[0] === "text/html" || types[0] === "application/xhtml+xml") return false;
|
|
954
915
|
return types.includes("application/activity+json") || types.includes("application/ld+json") || types.includes("application/json");
|
|
955
916
|
}
|
|
956
|
-
/**
|
|
957
|
-
* Handles an actor request.
|
|
958
|
-
* @typeParam TContextData The context data to pass to the context.
|
|
959
|
-
* @param request The HTTP request.
|
|
960
|
-
* @param parameters The parameters for handling the actor.
|
|
961
|
-
* @returns A promise that resolves to an HTTP response.
|
|
962
|
-
*/
|
|
963
917
|
async function handleActor(request, { identifier, context: context$1, actorDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
|
|
964
918
|
const logger$1 = getLogger([
|
|
965
919
|
"fedify",
|
|
@@ -1003,13 +957,6 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
|
|
|
1003
957
|
Vary: "Accept"
|
|
1004
958
|
} });
|
|
1005
959
|
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Handles an object request.
|
|
1008
|
-
* @typeParam TContextData The context data to pass to the context.
|
|
1009
|
-
* @param request The HTTP request.
|
|
1010
|
-
* @param parameters The parameters for handling the object.
|
|
1011
|
-
* @returns A promise that resolves to an HTTP response.
|
|
1012
|
-
*/
|
|
1013
960
|
async function handleObject(request, { values, context: context$1, objectDispatcher, authorizePredicate, onNotFound, onNotAcceptable, onUnauthorized }) {
|
|
1014
961
|
if (objectDispatcher == null) return await onNotFound(request);
|
|
1015
962
|
const object = await objectDispatcher(context$1, values);
|
|
@@ -1042,16 +989,6 @@ async function handleObject(request, { values, context: context$1, objectDispatc
|
|
|
1042
989
|
Vary: "Accept"
|
|
1043
990
|
} });
|
|
1044
991
|
}
|
|
1045
|
-
/**
|
|
1046
|
-
* Handles a collection request.
|
|
1047
|
-
* @typeParam TItem The type of items in the collection.
|
|
1048
|
-
* @typeParam TContext The type of the context, extending {@link RequestContext}.
|
|
1049
|
-
* @typeParam TContextData The context data to pass to the `TContext`.
|
|
1050
|
-
* @typeParam TFilter The type of the filter.
|
|
1051
|
-
* @param request The HTTP request.
|
|
1052
|
-
* @param parameters The parameters for handling the collection.
|
|
1053
|
-
* @returns A promise that resolves to an HTTP response.
|
|
1054
|
-
*/
|
|
1055
992
|
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound, onNotAcceptable }) {
|
|
1056
993
|
const spanName = name.trim().replace(/\s+/g, "_");
|
|
1057
994
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
@@ -1193,14 +1130,6 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
1193
1130
|
Vary: "Accept"
|
|
1194
1131
|
} });
|
|
1195
1132
|
}
|
|
1196
|
-
/**
|
|
1197
|
-
* Filters collection items based on the provided predicate.
|
|
1198
|
-
* @typeParam TItem The type of items to filter.
|
|
1199
|
-
* @param items The items to filter.
|
|
1200
|
-
* @param collectionName The name of the collection for logging purposes.
|
|
1201
|
-
* @param filterPredicate Optional predicate function to filter items.
|
|
1202
|
-
* @returns The filtered items as Objects, Links, or URLs.
|
|
1203
|
-
*/
|
|
1204
1133
|
function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
1205
1134
|
const result = [];
|
|
1206
1135
|
let logged = false;
|
|
@@ -1224,13 +1153,6 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
1224
1153
|
}
|
|
1225
1154
|
return result;
|
|
1226
1155
|
}
|
|
1227
|
-
/**
|
|
1228
|
-
* Handles an inbox request for ActivityPub activities.
|
|
1229
|
-
* @typeParam TContextData The context data to pass to the context.
|
|
1230
|
-
* @param request The HTTP request.
|
|
1231
|
-
* @param options The parameters for handling the inbox.
|
|
1232
|
-
* @returns A promise that resolves to an HTTP response.
|
|
1233
|
-
*/
|
|
1234
1156
|
async function handleInbox(request, options) {
|
|
1235
1157
|
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
|
1236
1158
|
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
@@ -1252,14 +1174,6 @@ async function handleInbox(request, options) {
|
|
|
1252
1174
|
}
|
|
1253
1175
|
});
|
|
1254
1176
|
}
|
|
1255
|
-
/**
|
|
1256
|
-
* Internal function for handling inbox requests with detailed processing.
|
|
1257
|
-
* @typeParam TContextData The context data to pass to the context.
|
|
1258
|
-
* @param request The HTTP request.
|
|
1259
|
-
* @param options The parameters for handling the inbox.
|
|
1260
|
-
* @param span The OpenTelemetry span for tracing.
|
|
1261
|
-
* @returns A promise that resolves to an HTTP response.
|
|
1262
|
-
*/
|
|
1263
1177
|
async function handleInboxInternal(request, { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, tracerProvider }, span) {
|
|
1264
1178
|
const logger$1 = getLogger([
|
|
1265
1179
|
"fedify",
|
|
@@ -1490,447 +1404,6 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
1490
1404
|
});
|
|
1491
1405
|
}
|
|
1492
1406
|
/**
|
|
1493
|
-
* Handles a custom collection request.
|
|
1494
|
-
* @typeParam TItem The type of items in the collection.
|
|
1495
|
-
* @typeParam TParams The parameter names of the requested URL.
|
|
1496
|
-
* @typeParam TContext The type of the context, extending {@link RequestContext}.
|
|
1497
|
-
* @typeParam TContextData The context data to pass to the `TContext`.
|
|
1498
|
-
* @param request The HTTP request.
|
|
1499
|
-
* @param handleParams Parameters for handling the collection.
|
|
1500
|
-
* @returns A promise that resolves to an HTTP response.
|
|
1501
|
-
* @since 1.8.0
|
|
1502
|
-
*/
|
|
1503
|
-
const handleCustomCollection = exceptWrapper(_handleCustomCollection);
|
|
1504
|
-
async function _handleCustomCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
|
1505
|
-
verifyDefined(callbacks);
|
|
1506
|
-
verifyJsonLdRequest(request);
|
|
1507
|
-
await authIfNeeded(context$1, values, callbacks);
|
|
1508
|
-
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1509
|
-
return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, Collection, CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
1510
|
-
}
|
|
1511
|
-
/**
|
|
1512
|
-
* Handles an ordered collection request.
|
|
1513
|
-
* @typeParam TItem The type of items in the collection.
|
|
1514
|
-
* @typeParam TParams The parameter names of the requested URL.
|
|
1515
|
-
* @typeParam TContext The type of the context, extending {@link RequestContext}.
|
|
1516
|
-
* @typeParam TContextData The context data to pass to the `TContext`.
|
|
1517
|
-
* @param request The HTTP request.
|
|
1518
|
-
* @param handleParams Parameters for handling the collection.
|
|
1519
|
-
* @returns A promise that resolves to an HTTP response.
|
|
1520
|
-
* @since 1.8.0
|
|
1521
|
-
*/
|
|
1522
|
-
const handleOrderedCollection = exceptWrapper(_handleOrderedCollection);
|
|
1523
|
-
async function _handleOrderedCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
|
1524
|
-
verifyDefined(callbacks);
|
|
1525
|
-
verifyJsonLdRequest(request);
|
|
1526
|
-
await authIfNeeded(context$1, values, callbacks);
|
|
1527
|
-
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1528
|
-
return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, OrderedCollection, OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
|
1529
|
-
}
|
|
1530
|
-
/**
|
|
1531
|
-
* Handling custom collections with support for pagination and filtering.
|
|
1532
|
-
* The main flow is on `getCollection`, `dispatch`.
|
|
1533
|
-
*
|
|
1534
|
-
* @typeParam TItem The type of items in the collection.
|
|
1535
|
-
* @typeParam TParams The parameter names of the requested URL.
|
|
1536
|
-
* @typeParam TContext The type of the context. {@link Context} or {@link RequestContext}.
|
|
1537
|
-
* @typeParam TContextData The context data to pass to the `TContext`.
|
|
1538
|
-
* @typeParam TCollection The type of the collection, extending {@link Collection}.
|
|
1539
|
-
* @typeParam TCollectionPage The type of the collection page, extending {@link CollectionPage}.
|
|
1540
|
-
* @since 1.8.0
|
|
1541
|
-
*/
|
|
1542
|
-
var CustomCollectionHandler = class {
|
|
1543
|
-
/**
|
|
1544
|
-
* The tracer for telemetry.
|
|
1545
|
-
* @type {Tracer}
|
|
1546
|
-
*/
|
|
1547
|
-
#tracer;
|
|
1548
|
-
/**
|
|
1549
|
-
* The ID of the collection.
|
|
1550
|
-
* @type {URL}
|
|
1551
|
-
*/
|
|
1552
|
-
#id;
|
|
1553
|
-
/**
|
|
1554
|
-
* Store total count of items in the collection.
|
|
1555
|
-
* Use `this.totalItems` to access the total items count.
|
|
1556
|
-
* It is a promise because it may require an asynchronous operation to count items.
|
|
1557
|
-
* @type {Promise<number | null> | undefined}
|
|
1558
|
-
*/
|
|
1559
|
-
#totalItems = void 0;
|
|
1560
|
-
/**
|
|
1561
|
-
* The first cursor for pagination.
|
|
1562
|
-
* It is a promise because it may require an asynchronous operation to get the first cursor.
|
|
1563
|
-
* @type {Promise<string | null> | undefined}
|
|
1564
|
-
*/
|
|
1565
|
-
#dispatcher;
|
|
1566
|
-
#collection = null;
|
|
1567
|
-
/**
|
|
1568
|
-
* Creates a new CustomCollection instance.
|
|
1569
|
-
* @param {string} name The name of the collection.
|
|
1570
|
-
* @param {TParams} values The parameter values for the collection.
|
|
1571
|
-
* @param {TContext} context The request context.
|
|
1572
|
-
* @param {CustomCollectionCallbacks} callbacks The collection callbacks.
|
|
1573
|
-
* @param {TracerProvider} tracerProvider The tracer provider for telemetry.
|
|
1574
|
-
* @param {ConstructorWithTypeId<TCollection>} Collection The Collection constructor.
|
|
1575
|
-
* @param {ConstructorWithTypeId<TCollectionPage>} CollectionPage The CollectionPage constructor.
|
|
1576
|
-
* @param {(item: TItem) => boolean} filterPredicate Optional filter predicate for items.
|
|
1577
|
-
*/
|
|
1578
|
-
constructor(name, values, context$1, callbacks, tracerProvider = trace.getTracerProvider(), Collection$1, CollectionPage$1, filterPredicate) {
|
|
1579
|
-
this.name = name;
|
|
1580
|
-
this.values = values;
|
|
1581
|
-
this.context = context$1;
|
|
1582
|
-
this.callbacks = callbacks;
|
|
1583
|
-
this.tracerProvider = tracerProvider;
|
|
1584
|
-
this.Collection = Collection$1;
|
|
1585
|
-
this.CollectionPage = CollectionPage$1;
|
|
1586
|
-
this.filterPredicate = filterPredicate;
|
|
1587
|
-
this.name = this.name.trim().replace(/\s+/g, "_");
|
|
1588
|
-
this.#tracer = this.tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
1589
|
-
this.#id = new URL(this.context.url);
|
|
1590
|
-
this.#dispatcher = callbacks.dispatcher.bind(callbacks);
|
|
1591
|
-
}
|
|
1592
|
-
/**
|
|
1593
|
-
* Converts the collection to JSON-LD format.
|
|
1594
|
-
* @returns A promise that resolves to the JSON-LD representation.
|
|
1595
|
-
*/
|
|
1596
|
-
async toJsonLd() {
|
|
1597
|
-
return (await this.collection).toJsonLd(this.context);
|
|
1598
|
-
}
|
|
1599
|
-
/**
|
|
1600
|
-
* Fetches the collection with optional cursor for pagination.
|
|
1601
|
-
* This method is defined for method chaining and to show processing flow properly.
|
|
1602
|
-
* So it is no problem to call `toJsonLd` directly on the instance.
|
|
1603
|
-
* @param cursor The cursor for pagination, or null for the first page.
|
|
1604
|
-
* @returns The CustomCollection instance for method chaining.
|
|
1605
|
-
*/
|
|
1606
|
-
fetchCollection(cursor = null) {
|
|
1607
|
-
this.#collection = this.getCollection(cursor);
|
|
1608
|
-
return this;
|
|
1609
|
-
}
|
|
1610
|
-
/**
|
|
1611
|
-
* Gets the collection or collection page based on the cursor.
|
|
1612
|
-
* @param {string | null} cursor The cursor for pagination, or null for the main collection.
|
|
1613
|
-
* @returns {Promise<TCollection | TCollectionPage>} A promise that resolves to a Collection or CollectionPage.
|
|
1614
|
-
*/
|
|
1615
|
-
async getCollection(cursor = null) {
|
|
1616
|
-
if (cursor !== null) {
|
|
1617
|
-
const props$1 = await this.getPageProps(cursor);
|
|
1618
|
-
return new this.CollectionPage(props$1);
|
|
1619
|
-
}
|
|
1620
|
-
const firstCursor = await this.firstCursor;
|
|
1621
|
-
const props = typeof firstCursor === "string" ? await this.getProps(firstCursor) : await this.getPropsWithoutCursor();
|
|
1622
|
-
return new this.Collection(props);
|
|
1623
|
-
}
|
|
1624
|
-
/**
|
|
1625
|
-
* Gets the properties for a collection page.
|
|
1626
|
-
* Returns the page properties including items, previous and next cursors.
|
|
1627
|
-
* @param {string} cursor The cursor for the page.
|
|
1628
|
-
* @returns A promise that resolves to the page properties.
|
|
1629
|
-
*/
|
|
1630
|
-
async getPageProps(cursor) {
|
|
1631
|
-
const id = this.#id;
|
|
1632
|
-
const pages = await this.getPages({ cursor });
|
|
1633
|
-
const { prevCursor, nextCursor } = pages;
|
|
1634
|
-
const partOf = new URL(id);
|
|
1635
|
-
partOf.searchParams.delete("cursor");
|
|
1636
|
-
return {
|
|
1637
|
-
id,
|
|
1638
|
-
partOf,
|
|
1639
|
-
items: this.filterItems(pages.items),
|
|
1640
|
-
prev: this.appendToUrl(prevCursor),
|
|
1641
|
-
next: this.appendToUrl(nextCursor)
|
|
1642
|
-
};
|
|
1643
|
-
}
|
|
1644
|
-
/**
|
|
1645
|
-
* Gets the properties for a collection with cursors.
|
|
1646
|
-
* Returns the first cursor and last cursor as URL, along with total items count.
|
|
1647
|
-
* @param {string} firstCursor The first cursor for pagination.
|
|
1648
|
-
* @returns A promise that resolves to the collection properties.
|
|
1649
|
-
*/
|
|
1650
|
-
async getProps(firstCursor) {
|
|
1651
|
-
const lastCursor = await this.callbacks.lastCursor?.(this.context, this.values);
|
|
1652
|
-
return {
|
|
1653
|
-
id: this.#id,
|
|
1654
|
-
first: this.appendToUrl(firstCursor),
|
|
1655
|
-
last: this.appendToUrl(lastCursor),
|
|
1656
|
-
totalItems: await this.totalItems
|
|
1657
|
-
};
|
|
1658
|
-
}
|
|
1659
|
-
/**
|
|
1660
|
-
* Gets the properties for a collection of all items and the count.
|
|
1661
|
-
* @returns A promise that resolves to the collection properties.
|
|
1662
|
-
*/
|
|
1663
|
-
async getPropsWithoutCursor() {
|
|
1664
|
-
const totalItems = await this.totalItems;
|
|
1665
|
-
const pages = await this.getPages({ totalItems });
|
|
1666
|
-
return {
|
|
1667
|
-
id: this.#id,
|
|
1668
|
-
totalItems,
|
|
1669
|
-
items: this.filterItems(pages.items)
|
|
1670
|
-
};
|
|
1671
|
-
}
|
|
1672
|
-
/**
|
|
1673
|
-
* Gets a page of items from the collection.
|
|
1674
|
-
* Wraps the dispatcher in a span for telemetry.
|
|
1675
|
-
* @param options Options for getting the page, including cursor and total items.
|
|
1676
|
-
* @returns A promise that resolves to the page items.
|
|
1677
|
-
*/
|
|
1678
|
-
async getPages({ cursor = null, totalItems = null }) {
|
|
1679
|
-
return await this.#tracer.startActiveSpan(`${this.ATTRS.DISPATCH_COLLECTION} ${this.name}`, this.spanOptions(SpanKind.SERVER, cursor), this.spanPages({
|
|
1680
|
-
cursor,
|
|
1681
|
-
totalItems
|
|
1682
|
-
}));
|
|
1683
|
-
}
|
|
1684
|
-
/**
|
|
1685
|
-
* Creates span options for telemetry.
|
|
1686
|
-
* @param {SpanKind} kind The span kind.
|
|
1687
|
-
* @param {string | null} cursor The optional cursor value.
|
|
1688
|
-
* @returns {SpanOptions}The span options.
|
|
1689
|
-
*/
|
|
1690
|
-
spanOptions = (kind, cursor) => ({
|
|
1691
|
-
kind,
|
|
1692
|
-
attributes: {
|
|
1693
|
-
[this.ATTRS.ID]: this.#id.href,
|
|
1694
|
-
[this.ATTRS.TYPE]: this.Collection.typeId.href,
|
|
1695
|
-
...cursor ? { [this.ATTRS.CURSOR]: cursor } : {}
|
|
1696
|
-
}
|
|
1697
|
-
});
|
|
1698
|
-
/**
|
|
1699
|
-
* Creates a function to wrap the dispatcher so tracing can be applied.
|
|
1700
|
-
* @param params Parameters including cursor and total items.
|
|
1701
|
-
* @returns {(span: Span) => Promise<PageItems<TItem>>} A function that handles the span operation.
|
|
1702
|
-
*/
|
|
1703
|
-
spanPages = ({ totalItems = null, cursor = null }) => async (span) => {
|
|
1704
|
-
try {
|
|
1705
|
-
if (totalItems !== null) span.setAttribute(this.ATTRS.TOTAL_ITEMS, totalItems);
|
|
1706
|
-
const page = await this.dispatch(cursor);
|
|
1707
|
-
span.setAttribute(this.ATTRS.ITEMS, page.items.length);
|
|
1708
|
-
return page;
|
|
1709
|
-
} catch (e) {
|
|
1710
|
-
const message = e instanceof Error ? e.message : String(e);
|
|
1711
|
-
span.setStatus({
|
|
1712
|
-
code: SpanStatusCode.ERROR,
|
|
1713
|
-
message
|
|
1714
|
-
});
|
|
1715
|
-
throw e;
|
|
1716
|
-
} finally {
|
|
1717
|
-
span.end();
|
|
1718
|
-
}
|
|
1719
|
-
};
|
|
1720
|
-
/**
|
|
1721
|
-
* Dispatches the collection request to get items.
|
|
1722
|
-
* @param {string | null} cursor The cursor for pagination, or null for the first page.
|
|
1723
|
-
* @returns {Promise<PageItems<TItem>>} A promise that resolves to the page items.
|
|
1724
|
-
*/
|
|
1725
|
-
async dispatch(cursor = null) {
|
|
1726
|
-
return await this.#dispatcher(this.context, this.values, cursor) ?? new ItemsNotFoundError().throw();
|
|
1727
|
-
}
|
|
1728
|
-
/**
|
|
1729
|
-
* Filters the items in the collection.
|
|
1730
|
-
* @param {TItem[]} items The items to filter.
|
|
1731
|
-
* @returns {(Object | Link | URL)[]} The filtered items.
|
|
1732
|
-
*/
|
|
1733
|
-
filterItems(items) {
|
|
1734
|
-
return filterCollectionItems(items, this.name, this.filterPredicate);
|
|
1735
|
-
}
|
|
1736
|
-
/**
|
|
1737
|
-
* Appends a cursor to the URL if it exists.
|
|
1738
|
-
* @param {string | null | undefined} cursor The cursor to append, or null/undefined.
|
|
1739
|
-
* @returns The URL with cursor appended, or null if cursor is null/undefined.
|
|
1740
|
-
*/
|
|
1741
|
-
appendToUrl(cursor) {
|
|
1742
|
-
return appendCursorIfExists(this.context.url, cursor);
|
|
1743
|
-
}
|
|
1744
|
-
/**
|
|
1745
|
-
* Gets the stored collection or collection page.
|
|
1746
|
-
* @returns {Promise<TCollection | TCollectionPage>} A promise that resolves to
|
|
1747
|
-
the collection or collection page.
|
|
1748
|
-
*/
|
|
1749
|
-
get collection() {
|
|
1750
|
-
if (this.#collection === null) this.#collection = this.getCollection();
|
|
1751
|
-
return this.#collection;
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* Gets the total number of items in the collection.
|
|
1755
|
-
* @returns {Promise<number | null>} A promise that
|
|
1756
|
-
resolves to the total items count, or null if not available.
|
|
1757
|
-
*/
|
|
1758
|
-
get totalItems() {
|
|
1759
|
-
if (this.#totalItems === void 0) this.totalItems = this.callbacks.counter?.(this.context, this.values);
|
|
1760
|
-
return this.#totalItems;
|
|
1761
|
-
}
|
|
1762
|
-
/**
|
|
1763
|
-
* Sets the total number of items in the collection.
|
|
1764
|
-
* @param value The total items count or a promise that resolves to it.
|
|
1765
|
-
*/
|
|
1766
|
-
set totalItems(value) {
|
|
1767
|
-
const toNumber = (value$1) => value$1 == null ? null : Number(value$1);
|
|
1768
|
-
this.#totalItems = value instanceof Promise ? value.then(toNumber) : Promise.resolve(toNumber(value));
|
|
1769
|
-
}
|
|
1770
|
-
/**
|
|
1771
|
-
* Gets the first cursor for pagination.
|
|
1772
|
-
* @returns {Promise<string | null>} A promise that resolves to the first cursor,
|
|
1773
|
-
or null if not available.
|
|
1774
|
-
*/
|
|
1775
|
-
get firstCursor() {
|
|
1776
|
-
const cursor = this.callbacks.firstCursor?.(this.context, this.values);
|
|
1777
|
-
return Promise.resolve(cursor ?? null);
|
|
1778
|
-
}
|
|
1779
|
-
/**
|
|
1780
|
-
* Attribute constants for telemetry spans.
|
|
1781
|
-
*/
|
|
1782
|
-
ATTRS = {
|
|
1783
|
-
DISPATCH_COLLECTION: "activitypub.dispatch_collection",
|
|
1784
|
-
CURSOR: "fedify.collection.cursor",
|
|
1785
|
-
ID: "activitypub.collection.id",
|
|
1786
|
-
ITEMS: "fedify.collection.items",
|
|
1787
|
-
TOTAL_ITEMS: "activitypub.collection.total_items",
|
|
1788
|
-
TYPE: "activitypub.collection.type"
|
|
1789
|
-
};
|
|
1790
|
-
};
|
|
1791
|
-
/**
|
|
1792
|
-
* A wrapper function that catches specific errors and handles them appropriately.
|
|
1793
|
-
* @typeParam TParams The type of parameters that extend ErrorHandlers.
|
|
1794
|
-
* @param handler The handler function to wrap.
|
|
1795
|
-
* @returns A wrapped handler function that catches and handles specific errors.
|
|
1796
|
-
* @since 1.8.0
|
|
1797
|
-
*/
|
|
1798
|
-
function exceptWrapper(handler) {
|
|
1799
|
-
return async (request, handlerParams) => {
|
|
1800
|
-
try {
|
|
1801
|
-
return await handler(request, handlerParams);
|
|
1802
|
-
} catch (error) {
|
|
1803
|
-
const { onNotFound, onNotAcceptable, onUnauthorized } = handlerParams;
|
|
1804
|
-
switch (error?.constructor) {
|
|
1805
|
-
case ItemsNotFoundError: return await onNotFound(request);
|
|
1806
|
-
case NotAcceptableError: return await onNotAcceptable(request);
|
|
1807
|
-
case UnauthorizedError: return await onUnauthorized(request);
|
|
1808
|
-
default: throw error;
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
};
|
|
1812
|
-
}
|
|
1813
|
-
/**
|
|
1814
|
-
* Verifies that a value is defined (not undefined).
|
|
1815
|
-
* @typeParam T The type of the value, excluding undefined.
|
|
1816
|
-
* @param callbacks The value to verify.
|
|
1817
|
-
* @throws {ItemsNotFoundError} If the value is undefined.
|
|
1818
|
-
* @since 1.8.0
|
|
1819
|
-
*/
|
|
1820
|
-
const verifyDefined = (callbacks) => {
|
|
1821
|
-
if (callbacks === void 0) throw new ItemsNotFoundError();
|
|
1822
|
-
};
|
|
1823
|
-
/**
|
|
1824
|
-
* Verifies that a request accepts JSON-LD content type.
|
|
1825
|
-
* @param request The HTTP request to verify.
|
|
1826
|
-
* @throws {NotAcceptableError} If the request doesn't accept JSON-LD.
|
|
1827
|
-
* @since 1.8.0
|
|
1828
|
-
*/
|
|
1829
|
-
const verifyJsonLdRequest = (request) => {
|
|
1830
|
-
if (!acceptsJsonLd(request)) throw new NotAcceptableError();
|
|
1831
|
-
};
|
|
1832
|
-
/**
|
|
1833
|
-
* Performs authorization if needed based on the authorization predicate.
|
|
1834
|
-
* @typeParam TContextData The context data type.
|
|
1835
|
-
* @param {RequestContext<TContextData>} context The request context.
|
|
1836
|
-
* @param {Record<string, string>} values The parameter values.
|
|
1837
|
-
* @param options Options containing the authorization predicate.
|
|
1838
|
-
* @throws {UnauthorizedError} If authorization fails.
|
|
1839
|
-
* @since 1.8.0
|
|
1840
|
-
*/
|
|
1841
|
-
const authIfNeeded = async (context$1, values, { authorizePredicate: authorize = void 0 }) => {
|
|
1842
|
-
if (authorize === void 0) return;
|
|
1843
|
-
const key = (await context$1.getSignedKey())?.clone({}, warning.key) ?? null;
|
|
1844
|
-
const keyOwner = (await context$1.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
|
|
1845
|
-
if (!await authorize(context$1, values, key, keyOwner)) throw new UnauthorizedError();
|
|
1846
|
-
};
|
|
1847
|
-
/** Warning messages for `authIfNeeded`. */
|
|
1848
|
-
const warning = {
|
|
1849
|
-
key: { $warning: {
|
|
1850
|
-
category: [
|
|
1851
|
-
"fedify",
|
|
1852
|
-
"federation",
|
|
1853
|
-
"collection"
|
|
1854
|
-
],
|
|
1855
|
-
message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
|
|
1856
|
-
} },
|
|
1857
|
-
keyOwner: { $warning: {
|
|
1858
|
-
category: [
|
|
1859
|
-
"fedify",
|
|
1860
|
-
"federation",
|
|
1861
|
-
"collection"
|
|
1862
|
-
],
|
|
1863
|
-
message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
|
|
1864
|
-
} }
|
|
1865
|
-
};
|
|
1866
|
-
/**
|
|
1867
|
-
* Appends a cursor parameter to a URL if the cursor exists.
|
|
1868
|
-
* @typeParam Cursor The type of the cursor (string, null, or undefined).
|
|
1869
|
-
* @param {URL} url The base URL to append the cursor to.
|
|
1870
|
-
* @param {string | null | undefined} cursor The cursor value to append.
|
|
1871
|
-
* @returns The URL with cursor appended if cursor is a string, null otherwise.
|
|
1872
|
-
* @since 1.8.0
|
|
1873
|
-
*/
|
|
1874
|
-
const appendCursorIfExists = (url, cursor) => {
|
|
1875
|
-
if (cursor === null || cursor === void 0) return null;
|
|
1876
|
-
const copied = new URL(url);
|
|
1877
|
-
copied.searchParams.set("cursor", cursor);
|
|
1878
|
-
return copied;
|
|
1879
|
-
};
|
|
1880
|
-
/**
|
|
1881
|
-
* Creates an HTTP response for ActivityPub data.
|
|
1882
|
-
* @param {unknown} data The data to serialize as JSON-LD.
|
|
1883
|
-
* @returns {Response} An HTTP response with the data as ActivityPub JSON.
|
|
1884
|
-
* @since 1.8.0
|
|
1885
|
-
*/
|
|
1886
|
-
const respondAsActivity = (data) => new Response(JSON.stringify(data), { headers: {
|
|
1887
|
-
"Content-Type": "application/activity+json",
|
|
1888
|
-
Vary: "Accept"
|
|
1889
|
-
} });
|
|
1890
|
-
/**
|
|
1891
|
-
* Base class for handler errors.
|
|
1892
|
-
* @since 1.8.0
|
|
1893
|
-
*/
|
|
1894
|
-
var HandlerError = class extends Error {
|
|
1895
|
-
constructor(message) {
|
|
1896
|
-
super(message);
|
|
1897
|
-
}
|
|
1898
|
-
/**
|
|
1899
|
-
* Throws this error.
|
|
1900
|
-
* @returns Never returns, always throws.
|
|
1901
|
-
*/
|
|
1902
|
-
throw() {
|
|
1903
|
-
throw this;
|
|
1904
|
-
}
|
|
1905
|
-
};
|
|
1906
|
-
/**
|
|
1907
|
-
* Error thrown when items are not found in a collection.
|
|
1908
|
-
* @since 1.8.0
|
|
1909
|
-
*/
|
|
1910
|
-
var ItemsNotFoundError = class extends HandlerError {
|
|
1911
|
-
constructor() {
|
|
1912
|
-
super("Items not found in the collection.");
|
|
1913
|
-
}
|
|
1914
|
-
};
|
|
1915
|
-
/**
|
|
1916
|
-
* Error thrown when the request is not acceptable (e.g., wrong content type).
|
|
1917
|
-
* @since 1.8.0
|
|
1918
|
-
*/
|
|
1919
|
-
var NotAcceptableError = class extends HandlerError {
|
|
1920
|
-
constructor() {
|
|
1921
|
-
super("The request is not acceptable.");
|
|
1922
|
-
}
|
|
1923
|
-
};
|
|
1924
|
-
/**
|
|
1925
|
-
* Error thrown when access to a collection is unauthorized.
|
|
1926
|
-
* @since 1.8.0
|
|
1927
|
-
*/
|
|
1928
|
-
var UnauthorizedError = class extends HandlerError {
|
|
1929
|
-
constructor() {
|
|
1930
|
-
super("Unauthorized access to the collection.");
|
|
1931
|
-
}
|
|
1932
|
-
};
|
|
1933
|
-
/**
|
|
1934
1407
|
* Responds with the given object in JSON-LD format.
|
|
1935
1408
|
*
|
|
1936
1409
|
* @param object The object to respond with.
|
|
@@ -3126,34 +2599,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3126
2599
|
onNotFound,
|
|
3127
2600
|
onNotAcceptable
|
|
3128
2601
|
});
|
|
3129
|
-
case "collection": {
|
|
3130
|
-
const name = route.name.replace(/^collection:/, "");
|
|
3131
|
-
const callbacks = this.collectionCallbacks[name];
|
|
3132
|
-
return await handleCustomCollection(request, {
|
|
3133
|
-
name,
|
|
3134
|
-
context: context$1,
|
|
3135
|
-
values: route.values,
|
|
3136
|
-
collectionCallbacks: callbacks,
|
|
3137
|
-
tracerProvider: this.tracerProvider,
|
|
3138
|
-
onUnauthorized,
|
|
3139
|
-
onNotFound,
|
|
3140
|
-
onNotAcceptable
|
|
3141
|
-
});
|
|
3142
|
-
}
|
|
3143
|
-
case "orderedCollection": {
|
|
3144
|
-
const name = route.name.replace(/^orderedCollection:/, "");
|
|
3145
|
-
const callbacks = this.collectionCallbacks[name];
|
|
3146
|
-
return await handleOrderedCollection(request, {
|
|
3147
|
-
name,
|
|
3148
|
-
context: context$1,
|
|
3149
|
-
values: route.values,
|
|
3150
|
-
collectionCallbacks: callbacks,
|
|
3151
|
-
tracerProvider: this.tracerProvider,
|
|
3152
|
-
onUnauthorized,
|
|
3153
|
-
onNotFound,
|
|
3154
|
-
onNotAcceptable
|
|
3155
|
-
});
|
|
3156
|
-
}
|
|
3157
2602
|
default: {
|
|
3158
2603
|
const response = onNotFound(request);
|
|
3159
2604
|
return response instanceof Promise ? await response : response;
|
|
@@ -3294,18 +2739,6 @@ var ContextImpl = class ContextImpl {
|
|
|
3294
2739
|
if (path == null) throw new RouterError("No featured tags collection path registered.");
|
|
3295
2740
|
return new URL(path, this.canonicalOrigin);
|
|
3296
2741
|
}
|
|
3297
|
-
getCollectionUri(name, values) {
|
|
3298
|
-
const customCallbacks = this.federation.collectionCallbacks[name];
|
|
3299
|
-
if (customCallbacks != null) {
|
|
3300
|
-
const collectionRouteName = `collection:${String(name)}`;
|
|
3301
|
-
const orderedCollectionRouteName = `orderedCollection:${String(name)}`;
|
|
3302
|
-
let path = this.federation.router.build(collectionRouteName, values);
|
|
3303
|
-
if (path == null) path = this.federation.router.build(orderedCollectionRouteName, values);
|
|
3304
|
-
if (path == null) throw new RouterError(`No collection dispatcher registered for ${String(name)}.`);
|
|
3305
|
-
return new URL(path, this.canonicalOrigin);
|
|
3306
|
-
}
|
|
3307
|
-
throw new RouterError(`No collection dispatcher registered for ${String(name)}.`);
|
|
3308
|
-
}
|
|
3309
2742
|
parseUri(uri) {
|
|
3310
2743
|
if (uri == null) return null;
|
|
3311
2744
|
if (uri.origin !== this.origin && uri.origin !== this.canonicalOrigin) return null;
|
|
@@ -3393,20 +2826,6 @@ var ContextImpl = class ContextImpl {
|
|
|
3393
2826
|
return identifier;
|
|
3394
2827
|
}
|
|
3395
2828
|
};
|
|
3396
|
-
const collectionTypes = ["collection", "orderedCollection"];
|
|
3397
|
-
const collectionRegex = /* @__PURE__ */ new RegExp(`^(${collectionTypes.join("|")}):(.*)$`);
|
|
3398
|
-
const match = route.name.match(collectionRegex);
|
|
3399
|
-
if (match !== null) {
|
|
3400
|
-
const [, type, name] = match;
|
|
3401
|
-
const cls = this.federation.collectionTypeIds[name];
|
|
3402
|
-
return {
|
|
3403
|
-
type,
|
|
3404
|
-
name,
|
|
3405
|
-
class: cls,
|
|
3406
|
-
typeId: cls.typeId,
|
|
3407
|
-
values: route.values
|
|
3408
|
-
};
|
|
3409
|
-
}
|
|
3410
2829
|
return null;
|
|
3411
2830
|
}
|
|
3412
2831
|
async getActorKeyPairs(identifier) {
|