@fedify/fedify 2.0.0-dev.377 → 2.0.0-dev.380
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/{builder-gzWbPXA1.js → builder-yo-Bb1YI.js} +12 -57
- package/dist/compat/mod.d.cts +2 -2
- package/dist/compat/mod.d.ts +2 -2
- package/dist/compat/transformers.test.js +11 -11
- package/dist/{context-Cf0-LmZC.d.cts → context-Bo8rHkgD.d.cts} +15 -45
- package/dist/{context-liIe6DFH.d.ts → context-CvI-m4eX.d.ts} +15 -45
- package/dist/{deno-C6PE0Mbz.js → deno-CtGMjqVA.js} +1 -1
- package/dist/{docloader-D3K5sxGg.js → docloader-DFtiZSjQ.js} +4 -12
- package/dist/federation/builder.test.js +3 -3
- package/dist/federation/handler.test.js +45 -45
- package/dist/federation/idempotency.test.js +11 -11
- package/dist/federation/inbox.test.js +2 -2
- package/dist/federation/middleware.test.js +43 -68
- package/dist/federation/mod.cjs +4 -4
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +4 -4
- package/dist/federation/send.test.js +5 -5
- package/dist/federation/webfinger.test.js +12 -15
- package/dist/{http--LccV8fH.cjs → http-DL7I-lJ1.cjs} +1 -1
- package/dist/{http-DLAyfXxs.js → http-MKkRvGCD.js} +2 -2
- package/dist/{http-CgEM3qCB.js → http-d87H9gTL.js} +1 -1
- package/dist/{inbox-B5o0DKdw.js → inbox-t2HfUOpK.js} +1 -1
- package/dist/{key-CY1j_I4p.js → key-BaU3dCbr.js} +1 -1
- package/dist/{kv-cache-CUAAgr40.js → kv-cache-BlAk9XRp.js} +2 -4
- package/dist/{kv-cache-C-fZXbD0.cjs → kv-cache-P81gWIMl.cjs} +1 -3
- package/dist/{ld-Cur4daC1.js → ld-Cl1Q2ID2.js} +2 -2
- package/dist/{middleware-DMrI5DbU.js → middleware-C8EKZVUa.js} +48 -128
- package/dist/{middleware-_k_Yi85X.js → middleware-CahwrUem.js} +4 -4
- package/dist/{middleware-BnPyW8eH.cjs → middleware-CeNadM06.cjs} +51 -176
- package/dist/middleware-DzqLMJf8.cjs +12 -0
- package/dist/{middleware-Cn7ge0Yf.js → middleware-QKMHl3jD.js} +11 -11
- package/dist/{middleware-ETb0GNSD.js → middleware-qCIC-vDz.js} +51 -176
- package/dist/{mod-CvhyLrjX.d.ts → mod-CevNbUol.d.ts} +0 -18
- package/dist/{mod-Do_sZWAA.d.cts → mod-DyzMRG8B.d.cts} +1 -1
- package/dist/{mod-DWaA45ef.d.cts → mod-ErTjUJs9.d.cts} +0 -18
- package/dist/{mod-B9_l3te3.d.ts → mod-PmuFg9QD.d.ts} +1 -1
- package/dist/{mod-Dquroqiv.d.ts → mod-hcb60sG1.d.ts} +1 -1
- package/dist/{mod-H3ScYaOb.d.cts → mod-jzy1r56s.d.cts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.js +11 -11
- package/dist/{owner-DEun_sgG.js → owner-CLtVml91.js} +1 -1
- package/dist/{proof-DwHX-_TR.js → proof-0NbL8saz.js} +2 -2
- package/dist/{proof-DC3LOHUm.js → proof-B7X2V-RL.js} +1 -1
- package/dist/{proof-M23tkRqK.cjs → proof-BYSTK-fO.cjs} +1 -1
- package/dist/{send-CwWPg8LE.js → send-yCNNrsU2.js} +2 -2
- package/dist/sig/http.test.js +3 -3
- package/dist/sig/key.test.js +2 -2
- package/dist/sig/ld.test.js +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.js +3 -3
- package/dist/sig/proof.test.js +3 -3
- package/dist/testing/mod.d.ts +9 -32
- package/dist/utils/docloader.test.js +4 -4
- package/dist/utils/mod.cjs +2 -2
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +2 -2
- package/package.json +5 -5
- package/dist/middleware-BmuJqg7S.cjs +0 -12
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-CGaQZ11T.cjs');
|
|
6
6
|
const require_transformers = require('./transformers-3g8GZwkZ.cjs');
|
|
7
|
-
const require_http = require('./http
|
|
8
|
-
const require_proof = require('./proof-
|
|
7
|
+
const require_http = require('./http-DL7I-lJ1.cjs');
|
|
8
|
+
const require_proof = require('./proof-BYSTK-fO.cjs');
|
|
9
9
|
const require_types = require('./types-Cd_hszr_.cjs');
|
|
10
|
-
const require_kv_cache = require('./kv-cache-
|
|
10
|
+
const require_kv_cache = require('./kv-cache-P81gWIMl.cjs');
|
|
11
11
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
12
12
|
const __fedify_vocab = require_chunk.__toESM(require("@fedify/vocab"));
|
|
13
13
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
@@ -339,7 +339,7 @@ var FederationBuilderImpl = class {
|
|
|
339
339
|
this.collectionTypeIds = {};
|
|
340
340
|
}
|
|
341
341
|
async build(options) {
|
|
342
|
-
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-
|
|
342
|
+
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-DzqLMJf8.cjs"));
|
|
343
343
|
const f = new FederationImpl$1(options);
|
|
344
344
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
345
345
|
f.router = this.router.clone();
|
|
@@ -371,12 +371,7 @@ var FederationBuilderImpl = class {
|
|
|
371
371
|
setActorDispatcher(path, dispatcher) {
|
|
372
372
|
if (this.router.has("actor")) throw new RouterError("Actor dispatcher already set.");
|
|
373
373
|
const variables = this.router.add(path, "actor");
|
|
374
|
-
if (variables.size !== 1 || !
|
|
375
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
376
|
-
"fedify",
|
|
377
|
-
"federation",
|
|
378
|
-
"actor"
|
|
379
|
-
]).warn("The {{handle}} variable in the actor dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
374
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for actor dispatcher must have one variable: {identifier}");
|
|
380
375
|
const callbacks = { dispatcher: async (context$2, identifier) => {
|
|
381
376
|
const actor = await this._getTracer().startActiveSpan("activitypub.dispatch_actor", {
|
|
382
377
|
kind: __opentelemetry_api.SpanKind.SERVER,
|
|
@@ -538,12 +533,7 @@ var FederationBuilderImpl = class {
|
|
|
538
533
|
if (this.inboxPath !== path) throw new RouterError("Inbox dispatcher path must match inbox listener path.");
|
|
539
534
|
} else {
|
|
540
535
|
const variables = this.router.add(path, "inbox");
|
|
541
|
-
if (variables.size !== 1 || !
|
|
542
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
543
|
-
"fedify",
|
|
544
|
-
"federation",
|
|
545
|
-
"inbox"
|
|
546
|
-
]).warn("The {{handle}} variable in the inbox dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
536
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for inbox dispatcher must have one variable: {identifier}");
|
|
547
537
|
this.inboxPath = path;
|
|
548
538
|
}
|
|
549
539
|
const callbacks = { dispatcher };
|
|
@@ -571,12 +561,7 @@ var FederationBuilderImpl = class {
|
|
|
571
561
|
setOutboxDispatcher(path, dispatcher) {
|
|
572
562
|
if (this.router.has("outbox")) throw new RouterError("Outbox dispatcher already set.");
|
|
573
563
|
const variables = this.router.add(path, "outbox");
|
|
574
|
-
if (variables.size !== 1 || !
|
|
575
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
576
|
-
"fedify",
|
|
577
|
-
"federation",
|
|
578
|
-
"outbox"
|
|
579
|
-
]).warn("The {{handle}} variable in the outbox dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
564
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for outbox dispatcher must have one variable: {identifier}");
|
|
580
565
|
const callbacks = { dispatcher };
|
|
581
566
|
this.outboxCallbacks = callbacks;
|
|
582
567
|
const setters = {
|
|
@@ -602,12 +587,7 @@ var FederationBuilderImpl = class {
|
|
|
602
587
|
setFollowingDispatcher(path, dispatcher) {
|
|
603
588
|
if (this.router.has("following")) throw new RouterError("Following collection dispatcher already set.");
|
|
604
589
|
const variables = this.router.add(path, "following");
|
|
605
|
-
if (variables.size !== 1 || !
|
|
606
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
607
|
-
"fedify",
|
|
608
|
-
"federation",
|
|
609
|
-
"collection"
|
|
610
|
-
]).warn("The {{handle}} variable in the following collection dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
590
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for following collection dispatcher must have one variable: {identifier}");
|
|
611
591
|
const callbacks = { dispatcher };
|
|
612
592
|
this.followingCallbacks = callbacks;
|
|
613
593
|
const setters = {
|
|
@@ -633,12 +613,7 @@ var FederationBuilderImpl = class {
|
|
|
633
613
|
setFollowersDispatcher(path, dispatcher) {
|
|
634
614
|
if (this.router.has("followers")) throw new RouterError("Followers collection dispatcher already set.");
|
|
635
615
|
const variables = this.router.add(path, "followers");
|
|
636
|
-
if (variables.size !== 1 || !
|
|
637
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
638
|
-
"fedify",
|
|
639
|
-
"federation",
|
|
640
|
-
"collection"
|
|
641
|
-
]).warn("The {{handle}} variable in the followers collection dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
616
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for followers collection dispatcher must have one variable: {identifier}");
|
|
642
617
|
const callbacks = { dispatcher };
|
|
643
618
|
this.followersCallbacks = callbacks;
|
|
644
619
|
const setters = {
|
|
@@ -664,12 +639,7 @@ var FederationBuilderImpl = class {
|
|
|
664
639
|
setLikedDispatcher(path, dispatcher) {
|
|
665
640
|
if (this.router.has("liked")) throw new RouterError("Liked collection dispatcher already set.");
|
|
666
641
|
const variables = this.router.add(path, "liked");
|
|
667
|
-
if (variables.size !== 1 || !
|
|
668
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
669
|
-
"fedify",
|
|
670
|
-
"federation",
|
|
671
|
-
"collection"
|
|
672
|
-
]).warn("The {{handle}} variable in the liked collection dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
642
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for liked collection dispatcher must have one variable: {identifier}");
|
|
673
643
|
const callbacks = { dispatcher };
|
|
674
644
|
this.likedCallbacks = callbacks;
|
|
675
645
|
const setters = {
|
|
@@ -695,12 +665,7 @@ var FederationBuilderImpl = class {
|
|
|
695
665
|
setFeaturedDispatcher(path, dispatcher) {
|
|
696
666
|
if (this.router.has("featured")) throw new RouterError("Featured collection dispatcher already set.");
|
|
697
667
|
const variables = this.router.add(path, "featured");
|
|
698
|
-
if (variables.size !== 1 || !
|
|
699
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
700
|
-
"fedify",
|
|
701
|
-
"federation",
|
|
702
|
-
"collection"
|
|
703
|
-
]).warn("The {{handle}} variable in the featured collection dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
668
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for featured collection dispatcher must have one variable: {identifier}");
|
|
704
669
|
const callbacks = { dispatcher };
|
|
705
670
|
this.featuredCallbacks = callbacks;
|
|
706
671
|
const setters = {
|
|
@@ -726,12 +691,7 @@ var FederationBuilderImpl = class {
|
|
|
726
691
|
setFeaturedTagsDispatcher(path, dispatcher) {
|
|
727
692
|
if (this.router.has("featuredTags")) throw new RouterError("Featured tags collection dispatcher already set.");
|
|
728
693
|
const variables = this.router.add(path, "featuredTags");
|
|
729
|
-
if (variables.size !== 1 || !
|
|
730
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
731
|
-
"fedify",
|
|
732
|
-
"federation",
|
|
733
|
-
"collection"
|
|
734
|
-
]).warn("The {{handle}} variable in the featured tags collection dispatcher path is deprecated. Use {{identifier}} instead.");
|
|
694
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for featured tags collection dispatcher must have one variable: {identifier}");
|
|
735
695
|
const callbacks = { dispatcher };
|
|
736
696
|
this.featuredTagsCallbacks = callbacks;
|
|
737
697
|
const setters = {
|
|
@@ -760,13 +720,8 @@ var FederationBuilderImpl = class {
|
|
|
760
720
|
if (this.inboxPath !== inboxPath) throw new RouterError("Inbox listener path must match inbox dispatcher path.");
|
|
761
721
|
} else {
|
|
762
722
|
const variables = this.router.add(inboxPath, "inbox");
|
|
763
|
-
if (variables.size !== 1 || !
|
|
723
|
+
if (variables.size !== 1 || !variables.has("identifier")) throw new RouterError("Path for inbox must have one variable: {identifier}");
|
|
764
724
|
this.inboxPath = inboxPath;
|
|
765
|
-
if (variables.has("handle")) (0, __logtape_logtape.getLogger)([
|
|
766
|
-
"fedify",
|
|
767
|
-
"federation",
|
|
768
|
-
"inbox"
|
|
769
|
-
]).warn("The {{handle}} variable in the inbox path is deprecated. Use {{identifier}} instead.");
|
|
770
725
|
}
|
|
771
726
|
if (sharedInboxPath != null) {
|
|
772
727
|
const siVars = this.router.add(sharedInboxPath, "sharedInbox");
|
|
@@ -2752,7 +2707,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2752
2707
|
if (message.identifier != null) context$2 = this.#createContext(baseUrl, ctxData, { documentLoader: await context$2.getDocumentLoader({ identifier: message.identifier }) });
|
|
2753
2708
|
else if (this.sharedInboxKeyDispatcher != null) {
|
|
2754
2709
|
const identity = await this.sharedInboxKeyDispatcher(context$2);
|
|
2755
|
-
if (identity != null) context$2 = this.#createContext(baseUrl, ctxData, { documentLoader: "identifier" in identity || "username" in identity
|
|
2710
|
+
if (identity != null) context$2 = this.#createContext(baseUrl, ctxData, { documentLoader: "identifier" in identity || "username" in identity ? await context$2.getDocumentLoader(identity) : context$2.getDocumentLoader(identity) });
|
|
2756
2711
|
}
|
|
2757
2712
|
const activity = await __fedify_vocab.Activity.fromJsonLd(message.activity, context$2);
|
|
2758
2713
|
span.setAttribute("activitypub.activity.type", (0, __fedify_vocab.getTypeId)(activity).href);
|
|
@@ -3148,9 +3103,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3148
3103
|
if (request.method !== "POST" && !acceptsJsonLd(request)) return await onNotAcceptable(request);
|
|
3149
3104
|
switch (routeName) {
|
|
3150
3105
|
case "actor":
|
|
3151
|
-
context$2 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier
|
|
3106
|
+
context$2 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier } });
|
|
3152
3107
|
return await handleActor(request, {
|
|
3153
|
-
identifier: route.values.identifier
|
|
3108
|
+
identifier: route.values.identifier,
|
|
3154
3109
|
context: context$2,
|
|
3155
3110
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
3156
3111
|
authorizePredicate: this.actorCallbacks?.authorizePredicate,
|
|
@@ -3176,7 +3131,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3176
3131
|
}
|
|
3177
3132
|
case "outbox": return await handleCollection(request, {
|
|
3178
3133
|
name: "outbox",
|
|
3179
|
-
identifier: route.values.identifier
|
|
3134
|
+
identifier: route.values.identifier,
|
|
3180
3135
|
uriGetter: context$2.getOutboxUri.bind(context$2),
|
|
3181
3136
|
context: context$2,
|
|
3182
3137
|
collectionCallbacks: this.outboxCallbacks,
|
|
@@ -3187,7 +3142,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3187
3142
|
case "inbox":
|
|
3188
3143
|
if (request.method !== "POST") return await handleCollection(request, {
|
|
3189
3144
|
name: "inbox",
|
|
3190
|
-
identifier: route.values.identifier
|
|
3145
|
+
identifier: route.values.identifier,
|
|
3191
3146
|
uriGetter: context$2.getInboxUri.bind(context$2),
|
|
3192
3147
|
context: context$2,
|
|
3193
3148
|
collectionCallbacks: this.inboxCallbacks,
|
|
@@ -3195,15 +3150,15 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3195
3150
|
onUnauthorized,
|
|
3196
3151
|
onNotFound
|
|
3197
3152
|
});
|
|
3198
|
-
context$2 = this.#createContext(request, contextData, { documentLoader: await context$2.getDocumentLoader({ identifier: route.values.identifier
|
|
3153
|
+
context$2 = this.#createContext(request, contextData, { documentLoader: await context$2.getDocumentLoader({ identifier: route.values.identifier }) });
|
|
3199
3154
|
case "sharedInbox":
|
|
3200
3155
|
if (routeName !== "inbox" && this.sharedInboxKeyDispatcher != null) {
|
|
3201
3156
|
const identity = await this.sharedInboxKeyDispatcher(context$2);
|
|
3202
|
-
if (identity != null) context$2 = this.#createContext(request, contextData, { documentLoader: "identifier" in identity || "username" in identity
|
|
3157
|
+
if (identity != null) context$2 = this.#createContext(request, contextData, { documentLoader: "identifier" in identity || "username" in identity ? await context$2.getDocumentLoader(identity) : context$2.getDocumentLoader(identity) });
|
|
3203
3158
|
}
|
|
3204
3159
|
if (!this.manuallyStartQueue) this._startQueueInternal(contextData);
|
|
3205
3160
|
return await handleInbox(request, {
|
|
3206
|
-
recipient: route.values.identifier ??
|
|
3161
|
+
recipient: route.values.identifier ?? null,
|
|
3207
3162
|
context: context$2,
|
|
3208
3163
|
inboxContextFactory: context$2.toInboxContext.bind(context$2),
|
|
3209
3164
|
kv: this.kv,
|
|
@@ -3220,7 +3175,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3220
3175
|
});
|
|
3221
3176
|
case "following": return await handleCollection(request, {
|
|
3222
3177
|
name: "following",
|
|
3223
|
-
identifier: route.values.identifier
|
|
3178
|
+
identifier: route.values.identifier,
|
|
3224
3179
|
uriGetter: context$2.getFollowingUri.bind(context$2),
|
|
3225
3180
|
context: context$2,
|
|
3226
3181
|
collectionCallbacks: this.followingCallbacks,
|
|
@@ -3237,7 +3192,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3237
3192
|
}
|
|
3238
3193
|
return await handleCollection(request, {
|
|
3239
3194
|
name: "followers",
|
|
3240
|
-
identifier: route.values.identifier
|
|
3195
|
+
identifier: route.values.identifier,
|
|
3241
3196
|
uriGetter: baseUrl == null ? context$2.getFollowersUri.bind(context$2) : (identifier) => {
|
|
3242
3197
|
const uri = context$2.getFollowersUri(identifier);
|
|
3243
3198
|
uri.searchParams.set("base-url", baseUrl);
|
|
@@ -3254,7 +3209,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3254
3209
|
}
|
|
3255
3210
|
case "liked": return await handleCollection(request, {
|
|
3256
3211
|
name: "liked",
|
|
3257
|
-
identifier: route.values.identifier
|
|
3212
|
+
identifier: route.values.identifier,
|
|
3258
3213
|
uriGetter: context$2.getLikedUri.bind(context$2),
|
|
3259
3214
|
context: context$2,
|
|
3260
3215
|
collectionCallbacks: this.likedCallbacks,
|
|
@@ -3264,7 +3219,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3264
3219
|
});
|
|
3265
3220
|
case "featured": return await handleCollection(request, {
|
|
3266
3221
|
name: "featured",
|
|
3267
|
-
identifier: route.values.identifier
|
|
3222
|
+
identifier: route.values.identifier,
|
|
3268
3223
|
uriGetter: context$2.getFeaturedUri.bind(context$2),
|
|
3269
3224
|
context: context$2,
|
|
3270
3225
|
collectionCallbacks: this.featuredCallbacks,
|
|
@@ -3274,7 +3229,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3274
3229
|
});
|
|
3275
3230
|
case "featuredTags": return await handleCollection(request, {
|
|
3276
3231
|
name: "featured tags",
|
|
3277
|
-
identifier: route.values.identifier
|
|
3232
|
+
identifier: route.values.identifier,
|
|
3278
3233
|
uriGetter: context$2.getFeaturedTagsUri.bind(context$2),
|
|
3279
3234
|
context: context$2,
|
|
3280
3235
|
collectionCallbacks: this.featuredTagsCallbacks,
|
|
@@ -3372,10 +3327,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3372
3327
|
return new URL(path, this.canonicalOrigin);
|
|
3373
3328
|
}
|
|
3374
3329
|
getActorUri(identifier) {
|
|
3375
|
-
const path = this.federation.router.build("actor", {
|
|
3376
|
-
identifier,
|
|
3377
|
-
handle: identifier
|
|
3378
|
-
});
|
|
3330
|
+
const path = this.federation.router.build("actor", { identifier });
|
|
3379
3331
|
if (path == null) throw new RouterError("No actor dispatcher registered.");
|
|
3380
3332
|
return new URL(path, this.canonicalOrigin);
|
|
3381
3333
|
}
|
|
@@ -3388,10 +3340,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3388
3340
|
return new URL(path, this.canonicalOrigin);
|
|
3389
3341
|
}
|
|
3390
3342
|
getOutboxUri(identifier) {
|
|
3391
|
-
const path = this.federation.router.build("outbox", {
|
|
3392
|
-
identifier,
|
|
3393
|
-
handle: identifier
|
|
3394
|
-
});
|
|
3343
|
+
const path = this.federation.router.build("outbox", { identifier });
|
|
3395
3344
|
if (path == null) throw new RouterError("No outbox dispatcher registered.");
|
|
3396
3345
|
return new URL(path, this.canonicalOrigin);
|
|
3397
3346
|
}
|
|
@@ -3401,50 +3350,32 @@ var ContextImpl = class ContextImpl {
|
|
|
3401
3350
|
if (path$1 == null) throw new RouterError("No shared inbox path registered.");
|
|
3402
3351
|
return new URL(path$1, this.canonicalOrigin);
|
|
3403
3352
|
}
|
|
3404
|
-
const path = this.federation.router.build("inbox", {
|
|
3405
|
-
identifier,
|
|
3406
|
-
handle: identifier
|
|
3407
|
-
});
|
|
3353
|
+
const path = this.federation.router.build("inbox", { identifier });
|
|
3408
3354
|
if (path == null) throw new RouterError("No inbox path registered.");
|
|
3409
3355
|
return new URL(path, this.canonicalOrigin);
|
|
3410
3356
|
}
|
|
3411
3357
|
getFollowingUri(identifier) {
|
|
3412
|
-
const path = this.federation.router.build("following", {
|
|
3413
|
-
identifier,
|
|
3414
|
-
handle: identifier
|
|
3415
|
-
});
|
|
3358
|
+
const path = this.federation.router.build("following", { identifier });
|
|
3416
3359
|
if (path == null) throw new RouterError("No following collection path registered.");
|
|
3417
3360
|
return new URL(path, this.canonicalOrigin);
|
|
3418
3361
|
}
|
|
3419
3362
|
getFollowersUri(identifier) {
|
|
3420
|
-
const path = this.federation.router.build("followers", {
|
|
3421
|
-
identifier,
|
|
3422
|
-
handle: identifier
|
|
3423
|
-
});
|
|
3363
|
+
const path = this.federation.router.build("followers", { identifier });
|
|
3424
3364
|
if (path == null) throw new RouterError("No followers collection path registered.");
|
|
3425
3365
|
return new URL(path, this.canonicalOrigin);
|
|
3426
3366
|
}
|
|
3427
3367
|
getLikedUri(identifier) {
|
|
3428
|
-
const path = this.federation.router.build("liked", {
|
|
3429
|
-
identifier,
|
|
3430
|
-
handle: identifier
|
|
3431
|
-
});
|
|
3368
|
+
const path = this.federation.router.build("liked", { identifier });
|
|
3432
3369
|
if (path == null) throw new RouterError("No liked collection path registered.");
|
|
3433
3370
|
return new URL(path, this.canonicalOrigin);
|
|
3434
3371
|
}
|
|
3435
3372
|
getFeaturedUri(identifier) {
|
|
3436
|
-
const path = this.federation.router.build("featured", {
|
|
3437
|
-
identifier,
|
|
3438
|
-
handle: identifier
|
|
3439
|
-
});
|
|
3373
|
+
const path = this.federation.router.build("featured", { identifier });
|
|
3440
3374
|
if (path == null) throw new RouterError("No featured collection path registered.");
|
|
3441
3375
|
return new URL(path, this.canonicalOrigin);
|
|
3442
3376
|
}
|
|
3443
3377
|
getFeaturedTagsUri(identifier) {
|
|
3444
|
-
const path = this.federation.router.build("featuredTags", {
|
|
3445
|
-
identifier,
|
|
3446
|
-
handle: identifier
|
|
3447
|
-
});
|
|
3378
|
+
const path = this.federation.router.build("featuredTags", { identifier });
|
|
3448
3379
|
if (path == null) throw new RouterError("No featured tags collection path registered.");
|
|
3449
3380
|
return new URL(path, this.canonicalOrigin);
|
|
3450
3381
|
}
|
|
@@ -3457,24 +3388,15 @@ var ContextImpl = class ContextImpl {
|
|
|
3457
3388
|
if (uri == null) return null;
|
|
3458
3389
|
if (uri.origin !== this.origin && uri.origin !== this.canonicalOrigin) return null;
|
|
3459
3390
|
const route = this.federation.router.route(uri.pathname);
|
|
3460
|
-
const logger$1 = (0, __logtape_logtape.getLogger)(["fedify", "federation"]);
|
|
3461
3391
|
if (route == null) return null;
|
|
3462
3392
|
else if (route.name === "sharedInbox") return {
|
|
3463
3393
|
type: "inbox",
|
|
3464
|
-
identifier: void 0
|
|
3465
|
-
get handle() {
|
|
3466
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3467
|
-
return void 0;
|
|
3468
|
-
}
|
|
3394
|
+
identifier: void 0
|
|
3469
3395
|
};
|
|
3470
|
-
const identifier =
|
|
3396
|
+
const identifier = route.values.identifier;
|
|
3471
3397
|
if (route.name === "actor") return {
|
|
3472
3398
|
type: "actor",
|
|
3473
|
-
identifier
|
|
3474
|
-
get handle() {
|
|
3475
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3476
|
-
return identifier;
|
|
3477
|
-
}
|
|
3399
|
+
identifier
|
|
3478
3400
|
};
|
|
3479
3401
|
else if (route.name.startsWith("object:")) {
|
|
3480
3402
|
const typeId = route.name.replace(/^object:/, "");
|
|
@@ -3486,59 +3408,31 @@ var ContextImpl = class ContextImpl {
|
|
|
3486
3408
|
};
|
|
3487
3409
|
} else if (route.name === "inbox") return {
|
|
3488
3410
|
type: "inbox",
|
|
3489
|
-
identifier
|
|
3490
|
-
get handle() {
|
|
3491
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3492
|
-
return identifier;
|
|
3493
|
-
}
|
|
3411
|
+
identifier
|
|
3494
3412
|
};
|
|
3495
3413
|
else if (route.name === "outbox") return {
|
|
3496
3414
|
type: "outbox",
|
|
3497
|
-
identifier
|
|
3498
|
-
get handle() {
|
|
3499
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3500
|
-
return identifier;
|
|
3501
|
-
}
|
|
3415
|
+
identifier
|
|
3502
3416
|
};
|
|
3503
3417
|
else if (route.name === "following") return {
|
|
3504
3418
|
type: "following",
|
|
3505
|
-
identifier
|
|
3506
|
-
get handle() {
|
|
3507
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3508
|
-
return identifier;
|
|
3509
|
-
}
|
|
3419
|
+
identifier
|
|
3510
3420
|
};
|
|
3511
3421
|
else if (route.name === "followers") return {
|
|
3512
3422
|
type: "followers",
|
|
3513
|
-
identifier
|
|
3514
|
-
get handle() {
|
|
3515
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3516
|
-
return identifier;
|
|
3517
|
-
}
|
|
3423
|
+
identifier
|
|
3518
3424
|
};
|
|
3519
3425
|
else if (route.name === "liked") return {
|
|
3520
3426
|
type: "liked",
|
|
3521
|
-
identifier
|
|
3522
|
-
get handle() {
|
|
3523
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3524
|
-
return identifier;
|
|
3525
|
-
}
|
|
3427
|
+
identifier
|
|
3526
3428
|
};
|
|
3527
3429
|
else if (route.name === "featured") return {
|
|
3528
3430
|
type: "featured",
|
|
3529
|
-
identifier
|
|
3530
|
-
get handle() {
|
|
3531
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3532
|
-
return identifier;
|
|
3533
|
-
}
|
|
3431
|
+
identifier
|
|
3534
3432
|
};
|
|
3535
3433
|
else if (route.name === "featuredTags") return {
|
|
3536
3434
|
type: "featuredTags",
|
|
3537
|
-
identifier
|
|
3538
|
-
get handle() {
|
|
3539
|
-
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
3540
|
-
return identifier;
|
|
3541
|
-
}
|
|
3435
|
+
identifier
|
|
3542
3436
|
};
|
|
3543
3437
|
const collectionTypes = ["collection", "orderedCollection"];
|
|
3544
3438
|
const collectionRegex = /* @__PURE__ */ new RegExp(`^(${collectionTypes.join("|")}):(.*)$`);
|
|
@@ -3640,19 +3534,10 @@ var ContextImpl = class ContextImpl {
|
|
|
3640
3534
|
return null;
|
|
3641
3535
|
}
|
|
3642
3536
|
getDocumentLoader(identity) {
|
|
3643
|
-
if ("identifier" in identity || "username" in identity
|
|
3537
|
+
if ("identifier" in identity || "username" in identity) {
|
|
3644
3538
|
let identifierPromise;
|
|
3645
|
-
if ("username" in identity
|
|
3646
|
-
|
|
3647
|
-
if ("username" in identity) username = identity.username;
|
|
3648
|
-
else {
|
|
3649
|
-
username = identity.handle;
|
|
3650
|
-
(0, __logtape_logtape.getLogger)([
|
|
3651
|
-
"fedify",
|
|
3652
|
-
"runtime",
|
|
3653
|
-
"docloader"
|
|
3654
|
-
]).warn("The \"handle\" property is deprecated; use \"identifier\" or \"username\" instead.", { identity });
|
|
3655
|
-
}
|
|
3539
|
+
if ("username" in identity) {
|
|
3540
|
+
const username = identity.username;
|
|
3656
3541
|
const mapper = this.federation.actorCallbacks?.handleMapper;
|
|
3657
3542
|
if (mapper == null) identifierPromise = Promise.resolve(username);
|
|
3658
3543
|
else {
|
|
@@ -3738,15 +3623,10 @@ var ContextImpl = class ContextImpl {
|
|
|
3738
3623
|
]);
|
|
3739
3624
|
let keys;
|
|
3740
3625
|
let identifier = null;
|
|
3741
|
-
if ("identifier" in sender || "username" in sender
|
|
3626
|
+
if ("identifier" in sender || "username" in sender) {
|
|
3742
3627
|
if ("identifier" in sender) identifier = sender.identifier;
|
|
3743
3628
|
else {
|
|
3744
|
-
|
|
3745
|
-
if ("username" in sender) username = sender.username;
|
|
3746
|
-
else {
|
|
3747
|
-
username = sender.handle;
|
|
3748
|
-
logger$1.warn("The \"handle\" property for the sender parameter is deprecated; use \"identifier\" or \"username\" instead.", { sender });
|
|
3749
|
-
}
|
|
3629
|
+
const username = sender.username;
|
|
3750
3630
|
if (this.federation.actorCallbacks?.handleMapper == null) identifier = username;
|
|
3751
3631
|
else {
|
|
3752
3632
|
const mapped = await this.federation.actorCallbacks.handleMapper(this, username);
|
|
@@ -4102,15 +3982,10 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
4102
3982
|
]);
|
|
4103
3983
|
let keys;
|
|
4104
3984
|
let identifier = null;
|
|
4105
|
-
if ("identifier" in forwarder || "username" in forwarder
|
|
3985
|
+
if ("identifier" in forwarder || "username" in forwarder) {
|
|
4106
3986
|
if ("identifier" in forwarder) identifier = forwarder.identifier;
|
|
4107
3987
|
else {
|
|
4108
|
-
|
|
4109
|
-
if ("username" in forwarder) username = forwarder.username;
|
|
4110
|
-
else {
|
|
4111
|
-
username = forwarder.handle;
|
|
4112
|
-
logger$1.warn("The \"handle\" property for the forwarder parameter is deprecated; use \"identifier\" or \"username\" instead.", { forwarder });
|
|
4113
|
-
}
|
|
3988
|
+
const username = forwarder.username;
|
|
4114
3989
|
if (this.federation.actorCallbacks?.handleMapper == null) identifier = username;
|
|
4115
3990
|
else {
|
|
4116
3991
|
const mapped = await this.federation.actorCallbacks.handleMapper(this, username);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
|
+
|
|
5
|
+
require('./transformers-3g8GZwkZ.cjs');
|
|
6
|
+
require('./http-DL7I-lJ1.cjs');
|
|
7
|
+
const require_middleware = require('./middleware-CeNadM06.cjs');
|
|
8
|
+
require('./proof-BYSTK-fO.cjs');
|
|
9
|
+
require('./types-Cd_hszr_.cjs');
|
|
10
|
+
require('./kv-cache-P81gWIMl.cjs');
|
|
11
|
+
|
|
12
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "./deno-
|
|
7
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-
|
|
6
|
+
import "./deno-CtGMjqVA.js";
|
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-C8EKZVUa.js";
|
|
8
8
|
import "./client-Dg7OfUDA.js";
|
|
9
9
|
import "./router-D9eI0s4b.js";
|
|
10
10
|
import "./types-CPz01LGH.js";
|
|
11
|
-
import "./key-
|
|
12
|
-
import "./http-
|
|
13
|
-
import "./ld-
|
|
14
|
-
import "./owner-
|
|
15
|
-
import "./proof-
|
|
16
|
-
import "./docloader-
|
|
11
|
+
import "./key-BaU3dCbr.js";
|
|
12
|
+
import "./http-MKkRvGCD.js";
|
|
13
|
+
import "./ld-Cl1Q2ID2.js";
|
|
14
|
+
import "./owner-CLtVml91.js";
|
|
15
|
+
import "./proof-0NbL8saz.js";
|
|
16
|
+
import "./docloader-DFtiZSjQ.js";
|
|
17
17
|
import "./kv-cache-B__dHl7g.js";
|
|
18
|
-
import "./inbox-
|
|
19
|
-
import "./builder-
|
|
18
|
+
import "./inbox-t2HfUOpK.js";
|
|
19
|
+
import "./builder-yo-Bb1YI.js";
|
|
20
20
|
import "./collection-CcnIw1qY.js";
|
|
21
21
|
import "./keycache-DRxpZ5r9.js";
|
|
22
22
|
import "./negotiation-5NPJL6zp.js";
|
|
23
23
|
import "./retry-D4GJ670a.js";
|
|
24
|
-
import "./send-
|
|
24
|
+
import "./send-yCNNrsU2.js";
|
|
25
25
|
|
|
26
26
|
export { FederationImpl };
|