@fedify/fedify 2.0.0-dev.379 → 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-CTaPayj3.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-DqzG_RZH.js → deno-CtGMjqVA.js} +1 -1
- package/dist/{docloader-DzdrkeHk.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-BgVFYDxB.cjs → http-DL7I-lJ1.cjs} +1 -1
- package/dist/{http-wC3zLKG0.js → http-MKkRvGCD.js} +2 -2
- package/dist/{http-wpL3tTw3.js → http-d87H9gTL.js} +1 -1
- package/dist/{inbox-DD3ldbso.js → inbox-t2HfUOpK.js} +1 -1
- package/dist/{key-DT5WUsoA.js → key-BaU3dCbr.js} +1 -1
- package/dist/{kv-cache-dm5snJVx.js → kv-cache-BlAk9XRp.js} +2 -4
- package/dist/{kv-cache-fDtLLSX6.cjs → kv-cache-P81gWIMl.cjs} +1 -3
- package/dist/{ld-DkkOCVAX.js → ld-Cl1Q2ID2.js} +2 -2
- package/dist/{middleware-1jFftSD2.js → middleware-C8EKZVUa.js} +48 -128
- package/dist/{middleware-DTsAIZ_v.js → middleware-CahwrUem.js} +4 -4
- package/dist/{middleware-CyiaCQia.cjs → middleware-CeNadM06.cjs} +51 -176
- package/dist/middleware-DzqLMJf8.cjs +12 -0
- package/dist/{middleware-BPQUgG_4.js → middleware-QKMHl3jD.js} +11 -11
- package/dist/{middleware-BgA11Zdl.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-DkyFfykp.js → owner-CLtVml91.js} +1 -1
- package/dist/{proof-YGxK2bz_.js → proof-0NbL8saz.js} +2 -2
- package/dist/{proof-DiizpGmV.js → proof-B7X2V-RL.js} +1 -1
- package/dist/{proof-BAMTO1-Z.cjs → proof-BYSTK-fO.cjs} +1 -1
- package/dist/{send-Bh3NMyL9.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-DPeL5rKU.cjs +0 -12
|
@@ -235,14 +235,10 @@ type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) =
|
|
|
235
235
|
identifier: string;
|
|
236
236
|
} | {
|
|
237
237
|
username: string;
|
|
238
|
-
} | {
|
|
239
|
-
handle: string;
|
|
240
238
|
} | null | Promise<SenderKeyPair | {
|
|
241
239
|
identifier: string;
|
|
242
240
|
} | {
|
|
243
241
|
username: string;
|
|
244
|
-
} | {
|
|
245
|
-
handle: string;
|
|
246
242
|
} | null>;
|
|
247
243
|
/**
|
|
248
244
|
* A callback that handles errors during outbox processing.
|
|
@@ -783,13 +779,6 @@ interface CreateExponentialBackoffPolicyOptions {
|
|
|
783
779
|
declare function createExponentialBackoffPolicy(options?: CreateExponentialBackoffPolicyOptions): RetryPolicy;
|
|
784
780
|
//#endregion
|
|
785
781
|
//#region src/federation/middleware.d.ts
|
|
786
|
-
/**
|
|
787
|
-
* Options for {@link createFederation} function.
|
|
788
|
-
* @template TContextData The type of the context data.
|
|
789
|
-
* @since 0.10.0
|
|
790
|
-
* @deprecated Use {@link FederationOptions} instead.
|
|
791
|
-
*/
|
|
792
|
-
interface CreateFederationOptions<TContextData> extends FederationOptions<TContextData> {}
|
|
793
782
|
/**
|
|
794
783
|
* Configures the task queues for sending and receiving activities.
|
|
795
784
|
* @since 1.3.0
|
|
@@ -844,7 +833,7 @@ interface FederationKvPrefixes {
|
|
|
844
833
|
readonly httpMessageSignaturesSpec: KvKey;
|
|
845
834
|
}
|
|
846
835
|
/**
|
|
847
|
-
* Options for {@link
|
|
836
|
+
* Options for {@link FederationOptions.origin} when it is not a string.
|
|
848
837
|
* @since 1.5.0
|
|
849
838
|
*/
|
|
850
839
|
interface FederationOrigin {
|
|
@@ -867,7 +856,7 @@ interface FederationOrigin {
|
|
|
867
856
|
* @returns A new {@link Federation} instance.
|
|
868
857
|
* @since 0.10.0
|
|
869
858
|
*/
|
|
870
|
-
declare function createFederation<TContextData>(options:
|
|
859
|
+
declare function createFederation<TContextData>(options: FederationOptions<TContextData>): Federation<TContextData>;
|
|
871
860
|
//#endregion
|
|
872
861
|
//#region src/federation/federation.d.ts
|
|
873
862
|
/**
|
|
@@ -932,7 +921,7 @@ interface Federatable<TContextData> {
|
|
|
932
921
|
* @returns An object with methods to set other actor dispatcher callbacks.
|
|
933
922
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
934
923
|
*/
|
|
935
|
-
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
924
|
+
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
|
936
925
|
/**
|
|
937
926
|
* Registers an object dispatcher.
|
|
938
927
|
*
|
|
@@ -1028,7 +1017,7 @@ interface Federatable<TContextData> {
|
|
|
1028
1017
|
* @param dispatcher An inbox dispatcher callback to register.
|
|
1029
1018
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1030
1019
|
*/
|
|
1031
|
-
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1020
|
+
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1032
1021
|
/**
|
|
1033
1022
|
* Registers an outbox dispatcher.
|
|
1034
1023
|
*
|
|
@@ -1052,7 +1041,7 @@ interface Federatable<TContextData> {
|
|
|
1052
1041
|
* @param dispatcher An outbox dispatcher callback to register.
|
|
1053
1042
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1054
1043
|
*/
|
|
1055
|
-
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1044
|
+
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1056
1045
|
/**
|
|
1057
1046
|
* Registers a following collection dispatcher.
|
|
1058
1047
|
* @param path The URI path pattern for the following collection. The syntax
|
|
@@ -1064,7 +1053,7 @@ interface Federatable<TContextData> {
|
|
|
1064
1053
|
* callbacks.
|
|
1065
1054
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
1066
1055
|
*/
|
|
1067
|
-
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1056
|
+
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1068
1057
|
/**
|
|
1069
1058
|
* Registers a followers collection dispatcher.
|
|
1070
1059
|
* @param path The URI path pattern for the followers collection. The syntax
|
|
@@ -1076,7 +1065,7 @@ interface Federatable<TContextData> {
|
|
|
1076
1065
|
* callbacks.
|
|
1077
1066
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1078
1067
|
*/
|
|
1079
|
-
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1068
|
+
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
1080
1069
|
/**
|
|
1081
1070
|
* Registers a liked collection dispatcher.
|
|
1082
1071
|
* @param path The URI path pattern for the liked collection. The syntax
|
|
@@ -1088,7 +1077,7 @@ interface Federatable<TContextData> {
|
|
|
1088
1077
|
* callbacks.
|
|
1089
1078
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1090
1079
|
*/
|
|
1091
|
-
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1080
|
+
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1092
1081
|
/**
|
|
1093
1082
|
* Registers a featured collection dispatcher.
|
|
1094
1083
|
* @param path The URI path pattern for the featured collection. The syntax
|
|
@@ -1100,7 +1089,7 @@ interface Federatable<TContextData> {
|
|
|
1100
1089
|
* callbacks.
|
|
1101
1090
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1102
1091
|
*/
|
|
1103
|
-
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1092
|
+
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1104
1093
|
/**
|
|
1105
1094
|
* Registers a featured tags collection dispatcher.
|
|
1106
1095
|
* @param path The URI path pattern for the featured tags collection.
|
|
@@ -1112,7 +1101,7 @@ interface Federatable<TContextData> {
|
|
|
1112
1101
|
* callbacks.
|
|
1113
1102
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1114
1103
|
*/
|
|
1115
|
-
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1104
|
+
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1116
1105
|
/**
|
|
1117
1106
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
|
1118
1107
|
*
|
|
@@ -1142,7 +1131,7 @@ interface Federatable<TContextData> {
|
|
|
1142
1131
|
* @returns An object to register inbox listeners.
|
|
1143
1132
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
1144
1133
|
*/
|
|
1145
|
-
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1134
|
+
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
1146
1135
|
/**
|
|
1147
1136
|
* Registers a collection of objects dispatcher.
|
|
1148
1137
|
*
|
|
@@ -1393,9 +1382,9 @@ interface FederationOptions<TContextData> {
|
|
|
1393
1382
|
/**
|
|
1394
1383
|
* Whether to allow fetching private network addresses in the document loader.
|
|
1395
1384
|
*
|
|
1396
|
-
* If turned on, {@link
|
|
1397
|
-
* {@link
|
|
1398
|
-
* {@link
|
|
1385
|
+
* If turned on, {@link FederationOptions.documentLoader},
|
|
1386
|
+
* {@link FederationOptions.contextLoader}, and
|
|
1387
|
+
* {@link FederationOptions.authenticatedDocumentLoaderFactory}
|
|
1399
1388
|
* cannot be configured.
|
|
1400
1389
|
*
|
|
1401
1390
|
* Mostly useful for testing purposes. *Do not use in production.*
|
|
@@ -1982,8 +1971,6 @@ interface Context<TContextData> {
|
|
|
1982
1971
|
identifier: string;
|
|
1983
1972
|
} | {
|
|
1984
1973
|
username: string;
|
|
1985
|
-
} | {
|
|
1986
|
-
handle: string;
|
|
1987
1974
|
}): Promise<DocumentLoader>;
|
|
1988
1975
|
/**
|
|
1989
1976
|
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
|
@@ -2114,8 +2101,6 @@ interface Context<TContextData> {
|
|
|
2114
2101
|
identifier: string;
|
|
2115
2102
|
} | {
|
|
2116
2103
|
username: string;
|
|
2117
|
-
} | {
|
|
2118
|
-
handle: string;
|
|
2119
2104
|
}, recipients: Recipient | Recipient[], activity: Activity, options?: SendActivityOptions): Promise<void>;
|
|
2120
2105
|
/**
|
|
2121
2106
|
* Sends an activity to the inboxes of the sender's followers.
|
|
@@ -2130,8 +2115,6 @@ interface Context<TContextData> {
|
|
|
2130
2115
|
identifier: string;
|
|
2131
2116
|
} | {
|
|
2132
2117
|
username: string;
|
|
2133
|
-
} | {
|
|
2134
|
-
handle: string;
|
|
2135
2118
|
}, recipients: "followers", activity: Activity, options?: SendActivityOptionsForCollection): Promise<void>;
|
|
2136
2119
|
/**
|
|
2137
2120
|
* Manually routes an activity to the appropriate inbox listener.
|
|
@@ -2309,8 +2292,6 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2309
2292
|
identifier: string;
|
|
2310
2293
|
} | {
|
|
2311
2294
|
username: string;
|
|
2312
|
-
} | {
|
|
2313
|
-
handle: string;
|
|
2314
2295
|
}, recipients: Recipient | Recipient[], options?: ForwardActivityOptions): Promise<void>;
|
|
2315
2296
|
/**
|
|
2316
2297
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
@@ -2328,8 +2309,6 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2328
2309
|
identifier: string;
|
|
2329
2310
|
} | {
|
|
2330
2311
|
username: string;
|
|
2331
|
-
} | {
|
|
2332
|
-
handle: string;
|
|
2333
2312
|
}, recipients: "followers", options?: ForwardActivityOptions): Promise<void>;
|
|
2334
2313
|
}
|
|
2335
2314
|
/**
|
|
@@ -2342,7 +2321,6 @@ type ParseUriResult =
|
|
|
2342
2321
|
{
|
|
2343
2322
|
readonly type: "actor";
|
|
2344
2323
|
readonly identifier: string;
|
|
2345
|
-
readonly handle: string;
|
|
2346
2324
|
}
|
|
2347
2325
|
/**
|
|
2348
2326
|
* The case of an object URI.
|
|
@@ -2357,35 +2335,30 @@ type ParseUriResult =
|
|
|
2357
2335
|
*/ | {
|
|
2358
2336
|
readonly type: "inbox";
|
|
2359
2337
|
readonly identifier: undefined;
|
|
2360
|
-
readonly handle: undefined;
|
|
2361
2338
|
}
|
|
2362
2339
|
/**
|
|
2363
2340
|
* The case of an personal inbox URI.
|
|
2364
2341
|
*/ | {
|
|
2365
2342
|
readonly type: "inbox";
|
|
2366
2343
|
readonly identifier: string;
|
|
2367
|
-
readonly handle: string;
|
|
2368
2344
|
}
|
|
2369
2345
|
/**
|
|
2370
2346
|
* The case of an outbox collection URI.
|
|
2371
2347
|
*/ | {
|
|
2372
2348
|
readonly type: "outbox";
|
|
2373
2349
|
readonly identifier: string;
|
|
2374
|
-
readonly handle: string;
|
|
2375
2350
|
}
|
|
2376
2351
|
/**
|
|
2377
2352
|
* The case of a following collection URI.
|
|
2378
2353
|
*/ | {
|
|
2379
2354
|
readonly type: "following";
|
|
2380
2355
|
readonly identifier: string;
|
|
2381
|
-
readonly handle: string;
|
|
2382
2356
|
}
|
|
2383
2357
|
/**
|
|
2384
2358
|
* The case of a followers collection URI.
|
|
2385
2359
|
*/ | {
|
|
2386
2360
|
readonly type: "followers";
|
|
2387
2361
|
readonly identifier: string;
|
|
2388
|
-
readonly handle: string;
|
|
2389
2362
|
}
|
|
2390
2363
|
/**
|
|
2391
2364
|
* The case of a liked collection URI.
|
|
@@ -2393,7 +2366,6 @@ type ParseUriResult =
|
|
|
2393
2366
|
*/ | {
|
|
2394
2367
|
readonly type: "liked";
|
|
2395
2368
|
readonly identifier: string;
|
|
2396
|
-
readonly handle: string;
|
|
2397
2369
|
}
|
|
2398
2370
|
/**
|
|
2399
2371
|
* The case of a featured collection URI.
|
|
@@ -2401,7 +2373,6 @@ type ParseUriResult =
|
|
|
2401
2373
|
*/ | {
|
|
2402
2374
|
readonly type: "featured";
|
|
2403
2375
|
readonly identifier: string;
|
|
2404
|
-
readonly handle: string;
|
|
2405
2376
|
}
|
|
2406
2377
|
/**
|
|
2407
2378
|
* The case of a featured tags collection URI.
|
|
@@ -2409,7 +2380,6 @@ type ParseUriResult =
|
|
|
2409
2380
|
*/ | {
|
|
2410
2381
|
readonly type: "featuredTags";
|
|
2411
2382
|
readonly identifier: string;
|
|
2412
|
-
readonly handle: string;
|
|
2413
2383
|
}
|
|
2414
2384
|
/**
|
|
2415
2385
|
* The case of a custom collection URI.
|
|
@@ -2580,4 +2550,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2580
2550
|
readonly multikey: Multikey;
|
|
2581
2551
|
}
|
|
2582
2552
|
//#endregion
|
|
2583
|
-
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions,
|
|
2553
|
+
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { validateCryptoKey } from "./key-
|
|
7
|
-
import { doubleKnock } from "./http-
|
|
6
|
+
import { validateCryptoKey } from "./key-BaU3dCbr.js";
|
|
7
|
+
import { doubleKnock } from "./http-MKkRvGCD.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { curry } from "es-toolkit";
|
|
10
|
-
import { UrlError, createActivityPubRequest,
|
|
10
|
+
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
11
11
|
|
|
12
12
|
//#region src/utils/docloader.ts
|
|
13
13
|
const logger = getLogger([
|
|
@@ -49,14 +49,6 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
|
|
|
49
49
|
}
|
|
50
50
|
return load;
|
|
51
51
|
}
|
|
52
|
-
const _fetchDocumentLoader = getDocumentLoader();
|
|
53
|
-
const _fetchDocumentLoader_allowPrivateAddress = getDocumentLoader({ allowPrivateAddress: true });
|
|
54
|
-
function fetchDocumentLoader(url, arg = false) {
|
|
55
|
-
const allowPrivateAddress = typeof arg === "boolean" ? arg : false;
|
|
56
|
-
logger.warn("fetchDocumentLoader() function is deprecated. Use getDocumentLoader() function instead.");
|
|
57
|
-
const loader = allowPrivateAddress ? _fetchDocumentLoader_allowPrivateAddress : _fetchDocumentLoader;
|
|
58
|
-
return loader(url);
|
|
59
|
-
}
|
|
60
52
|
|
|
61
53
|
//#endregion
|
|
62
|
-
export {
|
|
54
|
+
export { getAuthenticatedDocumentLoader };
|
|
@@ -8,10 +8,10 @@ import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
10
|
import { MemoryKvStore } from "../kv-QzKcOQgP.js";
|
|
11
|
-
import "../deno-
|
|
11
|
+
import "../deno-CtGMjqVA.js";
|
|
12
12
|
import "../router-D9eI0s4b.js";
|
|
13
|
-
import "../inbox-
|
|
14
|
-
import { createFederationBuilder } from "../builder-
|
|
13
|
+
import "../inbox-t2HfUOpK.js";
|
|
14
|
+
import { createFederationBuilder } from "../builder-yo-Bb1YI.js";
|
|
15
15
|
import { assertExists } from "../std__assert-DWivtrGR.js";
|
|
16
16
|
import "../assert_rejects-Ce45JcFg.js";
|
|
17
17
|
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
@@ -8,25 +8,25 @@ import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
10
|
import { MemoryKvStore } from "../kv-QzKcOQgP.js";
|
|
11
|
-
import "../deno-
|
|
12
|
-
import { createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-
|
|
11
|
+
import "../deno-CtGMjqVA.js";
|
|
12
|
+
import { createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-C8EKZVUa.js";
|
|
13
13
|
import "../client-Dg7OfUDA.js";
|
|
14
14
|
import "../router-D9eI0s4b.js";
|
|
15
15
|
import "../types-CPz01LGH.js";
|
|
16
|
-
import "../key-
|
|
17
|
-
import { signRequest } from "../http-
|
|
18
|
-
import "../ld-
|
|
19
|
-
import "../owner-
|
|
20
|
-
import "../proof-
|
|
21
|
-
import "../docloader-
|
|
16
|
+
import "../key-BaU3dCbr.js";
|
|
17
|
+
import { signRequest } from "../http-MKkRvGCD.js";
|
|
18
|
+
import "../ld-Cl1Q2ID2.js";
|
|
19
|
+
import "../owner-CLtVml91.js";
|
|
20
|
+
import "../proof-0NbL8saz.js";
|
|
21
|
+
import "../docloader-DFtiZSjQ.js";
|
|
22
22
|
import "../kv-cache-B__dHl7g.js";
|
|
23
|
-
import { InboxListenerSet } from "../inbox-
|
|
24
|
-
import "../builder-
|
|
23
|
+
import { InboxListenerSet } from "../inbox-t2HfUOpK.js";
|
|
24
|
+
import "../builder-yo-Bb1YI.js";
|
|
25
25
|
import "../collection-CcnIw1qY.js";
|
|
26
26
|
import "../keycache-DRxpZ5r9.js";
|
|
27
27
|
import "../negotiation-5NPJL6zp.js";
|
|
28
28
|
import "../retry-D4GJ670a.js";
|
|
29
|
-
import "../send-
|
|
29
|
+
import "../send-yCNNrsU2.js";
|
|
30
30
|
import "../std__assert-DWivtrGR.js";
|
|
31
31
|
import "../assert_rejects-Ce45JcFg.js";
|
|
32
32
|
import "../assert_throws-BNXdRGWP.js";
|
|
@@ -46,10 +46,10 @@ test("handleActor()", async () => {
|
|
|
46
46
|
return new URL(`https://example.com/users/${identifier}`);
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
const actorDispatcher = (ctx,
|
|
50
|
-
if (
|
|
49
|
+
const actorDispatcher = (ctx, identifier) => {
|
|
50
|
+
if (identifier !== "someone") return null;
|
|
51
51
|
return new Person({
|
|
52
|
-
id: ctx.getActorUri(
|
|
52
|
+
id: ctx.getActorUri(identifier),
|
|
53
53
|
name: "Someone"
|
|
54
54
|
});
|
|
55
55
|
};
|
|
@@ -233,11 +233,11 @@ test("handleObject()", async () => {
|
|
|
233
233
|
data: void 0,
|
|
234
234
|
url: new URL("https://example.com/"),
|
|
235
235
|
getObjectUri(_cls, values) {
|
|
236
|
-
return new URL(`https://example.com/users/${values.
|
|
236
|
+
return new URL(`https://example.com/users/${values.identifier}/notes/${values.id}`);
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
const objectDispatcher = (ctx, values) => {
|
|
240
|
-
if (values.
|
|
240
|
+
if (values.identifier !== "someone" || values.id !== "123") return null;
|
|
241
241
|
return new Note({
|
|
242
242
|
id: ctx.getObjectUri(Note, values),
|
|
243
243
|
summary: "Hello, world!"
|
|
@@ -256,7 +256,7 @@ test("handleObject()", async () => {
|
|
|
256
256
|
let response = await handleObject(context.request, {
|
|
257
257
|
context,
|
|
258
258
|
values: {
|
|
259
|
-
|
|
259
|
+
identifier: "someone",
|
|
260
260
|
id: "123"
|
|
261
261
|
},
|
|
262
262
|
onNotFound,
|
|
@@ -269,7 +269,7 @@ test("handleObject()", async () => {
|
|
|
269
269
|
response = await handleObject(context.request, {
|
|
270
270
|
context,
|
|
271
271
|
values: {
|
|
272
|
-
|
|
272
|
+
identifier: "someone",
|
|
273
273
|
id: "123"
|
|
274
274
|
},
|
|
275
275
|
objectDispatcher,
|
|
@@ -282,7 +282,7 @@ test("handleObject()", async () => {
|
|
|
282
282
|
response = await handleObject(context.request, {
|
|
283
283
|
context,
|
|
284
284
|
values: {
|
|
285
|
-
|
|
285
|
+
identifier: "no-one",
|
|
286
286
|
id: "123"
|
|
287
287
|
},
|
|
288
288
|
objectDispatcher,
|
|
@@ -296,7 +296,7 @@ test("handleObject()", async () => {
|
|
|
296
296
|
response = await handleObject(context.request, {
|
|
297
297
|
context,
|
|
298
298
|
values: {
|
|
299
|
-
|
|
299
|
+
identifier: "someone",
|
|
300
300
|
id: "not-exist"
|
|
301
301
|
},
|
|
302
302
|
objectDispatcher,
|
|
@@ -314,7 +314,7 @@ test("handleObject()", async () => {
|
|
|
314
314
|
response = await handleObject(context.request, {
|
|
315
315
|
context,
|
|
316
316
|
values: {
|
|
317
|
-
|
|
317
|
+
identifier: "someone",
|
|
318
318
|
id: "123"
|
|
319
319
|
},
|
|
320
320
|
objectDispatcher,
|
|
@@ -352,7 +352,7 @@ test("handleObject()", async () => {
|
|
|
352
352
|
response = await handleObject(context.request, {
|
|
353
353
|
context,
|
|
354
354
|
values: {
|
|
355
|
-
|
|
355
|
+
identifier: "no-one",
|
|
356
356
|
id: "123"
|
|
357
357
|
},
|
|
358
358
|
objectDispatcher,
|
|
@@ -366,7 +366,7 @@ test("handleObject()", async () => {
|
|
|
366
366
|
response = await handleObject(context.request, {
|
|
367
367
|
context,
|
|
368
368
|
values: {
|
|
369
|
-
|
|
369
|
+
identifier: "someone",
|
|
370
370
|
id: "not-exist"
|
|
371
371
|
},
|
|
372
372
|
objectDispatcher,
|
|
@@ -380,7 +380,7 @@ test("handleObject()", async () => {
|
|
|
380
380
|
response = await handleObject(context.request, {
|
|
381
381
|
context,
|
|
382
382
|
values: {
|
|
383
|
-
|
|
383
|
+
identifier: "someone",
|
|
384
384
|
id: "123"
|
|
385
385
|
},
|
|
386
386
|
objectDispatcher,
|
|
@@ -400,7 +400,7 @@ test("handleObject()", async () => {
|
|
|
400
400
|
response = await handleObject(context.request, {
|
|
401
401
|
context,
|
|
402
402
|
values: {
|
|
403
|
-
|
|
403
|
+
identifier: "someone",
|
|
404
404
|
id: "123"
|
|
405
405
|
},
|
|
406
406
|
objectDispatcher,
|
|
@@ -447,8 +447,8 @@ test("handleCollection()", async () => {
|
|
|
447
447
|
return new URL(`https://example.com/users/${identifier}`);
|
|
448
448
|
}
|
|
449
449
|
});
|
|
450
|
-
const dispatcher = (_ctx,
|
|
451
|
-
if (
|
|
450
|
+
const dispatcher = (_ctx, identifier, cursor) => {
|
|
451
|
+
if (identifier !== "someone") return null;
|
|
452
452
|
const items = [
|
|
453
453
|
new Create({ id: new URL("https://example.com/activities/1") }),
|
|
454
454
|
new Create({ id: new URL("https://example.com/activities/2") }),
|
|
@@ -464,9 +464,9 @@ test("handleCollection()", async () => {
|
|
|
464
464
|
}
|
|
465
465
|
return { items };
|
|
466
466
|
};
|
|
467
|
-
const counter = (_ctx,
|
|
468
|
-
const firstCursor = (_ctx,
|
|
469
|
-
const lastCursor = (_ctx,
|
|
467
|
+
const counter = (_ctx, identifier) => identifier === "someone" ? 3 : null;
|
|
468
|
+
const firstCursor = (_ctx, identifier) => identifier === "someone" ? "0" : null;
|
|
469
|
+
const lastCursor = (_ctx, identifier) => identifier === "someone" ? "2" : null;
|
|
470
470
|
let onNotFoundCalled = null;
|
|
471
471
|
const onNotFound = (request) => {
|
|
472
472
|
onNotFoundCalled = request;
|
|
@@ -1208,7 +1208,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1208
1208
|
url: new URL("https://example.com/")
|
|
1209
1209
|
});
|
|
1210
1210
|
const dispatcher = (_ctx, values, cursor) => {
|
|
1211
|
-
if (values.
|
|
1211
|
+
if (values.identifier !== "someone") return null;
|
|
1212
1212
|
const items = [
|
|
1213
1213
|
new Create({ id: new URL("https://example.com/activities/1") }),
|
|
1214
1214
|
new Create({ id: new URL("https://example.com/activities/2") }),
|
|
@@ -1224,9 +1224,9 @@ test("handleCustomCollection()", async () => {
|
|
|
1224
1224
|
}
|
|
1225
1225
|
return { items };
|
|
1226
1226
|
};
|
|
1227
|
-
const counter = (_ctx, values) => values.
|
|
1228
|
-
const firstCursor = (_ctx, values) => values.
|
|
1229
|
-
const lastCursor = (_ctx, values) => values.
|
|
1227
|
+
const counter = (_ctx, values) => values.identifier === "someone" ? 3 : null;
|
|
1228
|
+
const firstCursor = (_ctx, values) => values.identifier === "someone" ? "0" : null;
|
|
1229
|
+
const lastCursor = (_ctx, values) => values.identifier === "someone" ? "2" : null;
|
|
1230
1230
|
const callbacks = {
|
|
1231
1231
|
dispatcher,
|
|
1232
1232
|
counter,
|
|
@@ -1250,7 +1250,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1250
1250
|
let response = await handleCustomCollection(context.request, {
|
|
1251
1251
|
context,
|
|
1252
1252
|
name: "custom collection",
|
|
1253
|
-
values: {
|
|
1253
|
+
values: { identifier: "someone" },
|
|
1254
1254
|
...errorHandlers
|
|
1255
1255
|
});
|
|
1256
1256
|
assertEquals(response.status, 404);
|
|
@@ -1263,7 +1263,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1263
1263
|
response = await handleCustomCollection(context.request, {
|
|
1264
1264
|
context,
|
|
1265
1265
|
name: "custom collection",
|
|
1266
|
-
values: {
|
|
1266
|
+
values: { identifier: "no-one" },
|
|
1267
1267
|
collectionCallbacks: { dispatcher },
|
|
1268
1268
|
...errorHandlers
|
|
1269
1269
|
});
|
|
@@ -1274,7 +1274,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1274
1274
|
response = await handleCustomCollection(context.request, {
|
|
1275
1275
|
context,
|
|
1276
1276
|
name: "custom collection",
|
|
1277
|
-
values: {
|
|
1277
|
+
values: { identifier: "someone" },
|
|
1278
1278
|
collectionCallbacks: { dispatcher },
|
|
1279
1279
|
...errorHandlers
|
|
1280
1280
|
});
|
|
@@ -1353,7 +1353,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1353
1353
|
response = await handleCustomCollection(context.request, {
|
|
1354
1354
|
context,
|
|
1355
1355
|
name: "custom collection",
|
|
1356
|
-
values: {
|
|
1356
|
+
values: { identifier: "someone" },
|
|
1357
1357
|
collectionCallbacks: {
|
|
1358
1358
|
dispatcher,
|
|
1359
1359
|
authorizePredicate: (_ctx, _values, key, keyOwner) => key != null && keyOwner != null
|
|
@@ -1372,7 +1372,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1372
1372
|
response = await handleCustomCollection(context.request, {
|
|
1373
1373
|
context,
|
|
1374
1374
|
name: "custom collection",
|
|
1375
|
-
values: {
|
|
1375
|
+
values: { identifier: "someone" },
|
|
1376
1376
|
collectionCallbacks: {
|
|
1377
1377
|
dispatcher,
|
|
1378
1378
|
authorizePredicate: (_ctx, _values, key, keyOwner) => key != null && keyOwner != null
|
|
@@ -1408,7 +1408,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1408
1408
|
response = await handleCustomCollection(context.request, {
|
|
1409
1409
|
context,
|
|
1410
1410
|
name: "custom collection",
|
|
1411
|
-
values: {
|
|
1411
|
+
values: { identifier: "someone" },
|
|
1412
1412
|
collectionCallbacks: callbacks,
|
|
1413
1413
|
...errorHandlers
|
|
1414
1414
|
});
|
|
@@ -1433,7 +1433,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1433
1433
|
response = await handleCustomCollection(context.request, {
|
|
1434
1434
|
context,
|
|
1435
1435
|
name: "custom collection",
|
|
1436
|
-
values: {
|
|
1436
|
+
values: { identifier: "someone" },
|
|
1437
1437
|
collectionCallbacks: callbacks,
|
|
1438
1438
|
...errorHandlers
|
|
1439
1439
|
});
|
|
@@ -1462,7 +1462,7 @@ test("handleCustomCollection()", async () => {
|
|
|
1462
1462
|
response = await handleCustomCollection(context.request, {
|
|
1463
1463
|
context,
|
|
1464
1464
|
name: "custom collection",
|
|
1465
|
-
values: {
|
|
1465
|
+
values: { identifier: "someone" },
|
|
1466
1466
|
collectionCallbacks: callbacks,
|
|
1467
1467
|
...errorHandlers
|
|
1468
1468
|
});
|
|
@@ -1515,10 +1515,10 @@ test("handleInbox() records OpenTelemetry span events", async () => {
|
|
|
1515
1515
|
return new URL(`https://example.com/users/${identifier}`);
|
|
1516
1516
|
}
|
|
1517
1517
|
});
|
|
1518
|
-
const actorDispatcher = (ctx,
|
|
1519
|
-
if (
|
|
1518
|
+
const actorDispatcher = (ctx, identifier) => {
|
|
1519
|
+
if (identifier !== "someone") return null;
|
|
1520
1520
|
return new Person({
|
|
1521
|
-
id: ctx.getActorUri(
|
|
1521
|
+
id: ctx.getActorUri(identifier),
|
|
1522
1522
|
name: "Someone",
|
|
1523
1523
|
inbox: new URL("https://example.com/users/someone/inbox"),
|
|
1524
1524
|
publicKey: rsaPublicKey2
|
|
@@ -8,25 +8,25 @@ import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
10
|
import { MemoryKvStore } from "../kv-QzKcOQgP.js";
|
|
11
|
-
import "../deno-
|
|
12
|
-
import { createFederation } from "../middleware-
|
|
11
|
+
import "../deno-CtGMjqVA.js";
|
|
12
|
+
import { createFederation } from "../middleware-C8EKZVUa.js";
|
|
13
13
|
import "../client-Dg7OfUDA.js";
|
|
14
14
|
import "../router-D9eI0s4b.js";
|
|
15
15
|
import "../types-CPz01LGH.js";
|
|
16
|
-
import "../key-
|
|
17
|
-
import "../http-
|
|
18
|
-
import "../ld-
|
|
19
|
-
import "../owner-
|
|
20
|
-
import { signObject } from "../proof-
|
|
21
|
-
import "../docloader-
|
|
16
|
+
import "../key-BaU3dCbr.js";
|
|
17
|
+
import "../http-MKkRvGCD.js";
|
|
18
|
+
import "../ld-Cl1Q2ID2.js";
|
|
19
|
+
import "../owner-CLtVml91.js";
|
|
20
|
+
import { signObject } from "../proof-0NbL8saz.js";
|
|
21
|
+
import "../docloader-DFtiZSjQ.js";
|
|
22
22
|
import "../kv-cache-B__dHl7g.js";
|
|
23
|
-
import "../inbox-
|
|
24
|
-
import "../builder-
|
|
23
|
+
import "../inbox-t2HfUOpK.js";
|
|
24
|
+
import "../builder-yo-Bb1YI.js";
|
|
25
25
|
import "../collection-CcnIw1qY.js";
|
|
26
26
|
import "../keycache-DRxpZ5r9.js";
|
|
27
27
|
import "../negotiation-5NPJL6zp.js";
|
|
28
28
|
import "../retry-D4GJ670a.js";
|
|
29
|
-
import "../send-
|
|
29
|
+
import "../send-yCNNrsU2.js";
|
|
30
30
|
import "../std__assert-DWivtrGR.js";
|
|
31
31
|
import "../assert_rejects-Ce45JcFg.js";
|
|
32
32
|
import "../assert_throws-BNXdRGWP.js";
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
import { test } from "../dist-B5f6a8Tt.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
|
-
import "../deno-
|
|
9
|
-
import { InboxListenerSet } from "../inbox-
|
|
8
|
+
import "../deno-CtGMjqVA.js";
|
|
9
|
+
import { InboxListenerSet } from "../inbox-t2HfUOpK.js";
|
|
10
10
|
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
11
11
|
import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
|
|
12
12
|
|