@fedify/fedify 2.0.0-pr.559.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/{builder-BJ8JxPW5.js → builder-DIwRDV19.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-BdNW_8a3.d.cts} +19 -46
- package/dist/{context-liIe6DFH.d.ts → context-C-GVKcJR.d.ts} +19 -46
- package/dist/{deno-CQvbJJs6.js → deno-CJgVX6Dr.js} +1 -4
- package/dist/{docloader-C7haPFrm.js → docloader-BMecQIi-.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 +90 -5
- package/dist/federation/webfinger.test.js +12 -15
- package/dist/{http-D75q_hW-.js → http-CMTBVAxQ.js} +2 -2
- package/dist/{http-D3jnynqJ.cjs → http-CowIBMKY.cjs} +1 -4
- package/dist/{http-BO0w34cM.js → http-DoLgvgZ3.js} +1 -4
- package/dist/{inbox-DHboTK3x.js → inbox-BrQMunLn.js} +1 -1
- package/dist/{key-DzOIwgIi.js → key-BQD4Ef_6.js} +1 -1
- package/dist/{kv-cache-Chn8IE8p.cjs → kv-cache-174yQHE6.cjs} +1 -3
- package/dist/{kv-cache-JQOZpm43.js → kv-cache-CFlvozMZ.js} +2 -4
- package/dist/{ld-BDvJI1Ch.js → ld-DNdCEe6l.js} +2 -2
- package/dist/{middleware-CqxuI8xD.js → middleware-BN-t5M_R.js} +157 -210
- package/dist/middleware-BYNnNj-3.cjs +12 -0
- package/dist/{middleware-C1SMUD_l.js → middleware-D5JdOwAE.js} +193 -260
- package/dist/{middleware-HBYhBAM1.js → middleware-UqzNuf3o.js} +11 -11
- package/dist/{middleware-DATx715C.cjs → middleware-aQr0yVne.cjs} +193 -260
- package/dist/{middleware-BDPlUI8Z.js → middleware-dO1Uzsiv.js} +4 -4
- package/dist/{mod-H3ScYaOb.d.cts → mod-5PNty1K9.d.cts} +1 -1
- package/dist/{mod-Do_sZWAA.d.cts → mod-BcpEGTWV.d.cts} +1 -1
- package/dist/{mod-CvhyLrjX.d.ts → mod-CevNbUol.d.ts} +0 -18
- package/dist/{mod-Dquroqiv.d.ts → mod-CtO31FCx.d.ts} +1 -1
- package/dist/{mod-B9_l3te3.d.ts → mod-Da9fNDyC.d.ts} +1 -1
- package/dist/{mod-DWaA45ef.d.cts → mod-ErTjUJs9.d.cts} +0 -18
- 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-DSRxYIP4.js → owner-DbymvgVI.js} +1 -1
- package/dist/{proof-C_XZU5IE.js → proof-C85CNL5a.js} +1 -1
- package/dist/{proof-CWEkXV08.cjs → proof-DQFAjOse.cjs} +1 -1
- package/dist/{proof-9WkFZv2S.js → proof-DVBdddim.js} +2 -2
- package/dist/{send-qOq9Dgkb.js → send-CkvEc-Tx.js} +35 -4
- 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 +13 -33
- 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 +8 -8
- package/dist/middleware-C3SOA_O_.cjs +0 -12
|
@@ -79,7 +79,10 @@ declare class SendActivityError extends Error {
|
|
|
79
79
|
*/
|
|
80
80
|
readonly statusCode: number;
|
|
81
81
|
/**
|
|
82
|
-
* The response body from the inbox, if any.
|
|
82
|
+
* The response body from the inbox, if any. Note that this may be
|
|
83
|
+
* truncated to a maximum of 1 KiB to prevent excessive memory consumption
|
|
84
|
+
* when remote servers return large error pages (e.g., Cloudflare error pages).
|
|
85
|
+
* If truncated, the string will end with `"… (truncated)"`.
|
|
83
86
|
*/
|
|
84
87
|
readonly responseBody: string;
|
|
85
88
|
/**
|
|
@@ -235,14 +238,10 @@ type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) =
|
|
|
235
238
|
identifier: string;
|
|
236
239
|
} | {
|
|
237
240
|
username: string;
|
|
238
|
-
} | {
|
|
239
|
-
handle: string;
|
|
240
241
|
} | null | Promise<SenderKeyPair | {
|
|
241
242
|
identifier: string;
|
|
242
243
|
} | {
|
|
243
244
|
username: string;
|
|
244
|
-
} | {
|
|
245
|
-
handle: string;
|
|
246
245
|
} | null>;
|
|
247
246
|
/**
|
|
248
247
|
* A callback that handles errors during outbox processing.
|
|
@@ -783,13 +782,6 @@ interface CreateExponentialBackoffPolicyOptions {
|
|
|
783
782
|
declare function createExponentialBackoffPolicy(options?: CreateExponentialBackoffPolicyOptions): RetryPolicy;
|
|
784
783
|
//#endregion
|
|
785
784
|
//#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
785
|
/**
|
|
794
786
|
* Configures the task queues for sending and receiving activities.
|
|
795
787
|
* @since 1.3.0
|
|
@@ -844,7 +836,7 @@ interface FederationKvPrefixes {
|
|
|
844
836
|
readonly httpMessageSignaturesSpec: KvKey;
|
|
845
837
|
}
|
|
846
838
|
/**
|
|
847
|
-
* Options for {@link
|
|
839
|
+
* Options for {@link FederationOptions.origin} when it is not a string.
|
|
848
840
|
* @since 1.5.0
|
|
849
841
|
*/
|
|
850
842
|
interface FederationOrigin {
|
|
@@ -867,7 +859,7 @@ interface FederationOrigin {
|
|
|
867
859
|
* @returns A new {@link Federation} instance.
|
|
868
860
|
* @since 0.10.0
|
|
869
861
|
*/
|
|
870
|
-
declare function createFederation<TContextData>(options:
|
|
862
|
+
declare function createFederation<TContextData>(options: FederationOptions<TContextData>): Federation<TContextData>;
|
|
871
863
|
//#endregion
|
|
872
864
|
//#region src/federation/federation.d.ts
|
|
873
865
|
/**
|
|
@@ -932,7 +924,7 @@ interface Federatable<TContextData> {
|
|
|
932
924
|
* @returns An object with methods to set other actor dispatcher callbacks.
|
|
933
925
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
934
926
|
*/
|
|
935
|
-
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
927
|
+
setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
|
|
936
928
|
/**
|
|
937
929
|
* Registers an object dispatcher.
|
|
938
930
|
*
|
|
@@ -1028,7 +1020,7 @@ interface Federatable<TContextData> {
|
|
|
1028
1020
|
* @param dispatcher An inbox dispatcher callback to register.
|
|
1029
1021
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1030
1022
|
*/
|
|
1031
|
-
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1023
|
+
setInboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1032
1024
|
/**
|
|
1033
1025
|
* Registers an outbox dispatcher.
|
|
1034
1026
|
*
|
|
@@ -1052,7 +1044,7 @@ interface Federatable<TContextData> {
|
|
|
1052
1044
|
* @param dispatcher An outbox dispatcher callback to register.
|
|
1053
1045
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1054
1046
|
*/
|
|
1055
|
-
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1047
|
+
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1056
1048
|
/**
|
|
1057
1049
|
* Registers a following collection dispatcher.
|
|
1058
1050
|
* @param path The URI path pattern for the following collection. The syntax
|
|
@@ -1064,7 +1056,7 @@ interface Federatable<TContextData> {
|
|
|
1064
1056
|
* callbacks.
|
|
1065
1057
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
1066
1058
|
*/
|
|
1067
|
-
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1059
|
+
setFollowingDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Actor | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1068
1060
|
/**
|
|
1069
1061
|
* Registers a followers collection dispatcher.
|
|
1070
1062
|
* @param path The URI path pattern for the followers collection. The syntax
|
|
@@ -1076,7 +1068,7 @@ interface Federatable<TContextData> {
|
|
|
1076
1068
|
* callbacks.
|
|
1077
1069
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1078
1070
|
*/
|
|
1079
|
-
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1071
|
+
setFollowersDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>;
|
|
1080
1072
|
/**
|
|
1081
1073
|
* Registers a liked collection dispatcher.
|
|
1082
1074
|
* @param path The URI path pattern for the liked collection. The syntax
|
|
@@ -1088,7 +1080,7 @@ interface Federatable<TContextData> {
|
|
|
1088
1080
|
* callbacks.
|
|
1089
1081
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1090
1082
|
*/
|
|
1091
|
-
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1083
|
+
setLikedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Object$1 | URL, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1092
1084
|
/**
|
|
1093
1085
|
* Registers a featured collection dispatcher.
|
|
1094
1086
|
* @param path The URI path pattern for the featured collection. The syntax
|
|
@@ -1100,7 +1092,7 @@ interface Federatable<TContextData> {
|
|
|
1100
1092
|
* callbacks.
|
|
1101
1093
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1102
1094
|
*/
|
|
1103
|
-
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1095
|
+
setFeaturedDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Object$1, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1104
1096
|
/**
|
|
1105
1097
|
* Registers a featured tags collection dispatcher.
|
|
1106
1098
|
* @param path The URI path pattern for the featured tags collection.
|
|
@@ -1112,7 +1104,7 @@ interface Federatable<TContextData> {
|
|
|
1112
1104
|
* callbacks.
|
|
1113
1105
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
1114
1106
|
*/
|
|
1115
|
-
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1107
|
+
setFeaturedTagsDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
1116
1108
|
/**
|
|
1117
1109
|
* Assigns the URL path for the inbox and starts setting inbox listeners.
|
|
1118
1110
|
*
|
|
@@ -1142,7 +1134,7 @@ interface Federatable<TContextData> {
|
|
|
1142
1134
|
* @returns An object to register inbox listeners.
|
|
1143
1135
|
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
1144
1136
|
*/
|
|
1145
|
-
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}
|
|
1137
|
+
setInboxListeners(inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}`, sharedInboxPath?: string): InboxListenerSetters<TContextData>;
|
|
1146
1138
|
/**
|
|
1147
1139
|
* Registers a collection of objects dispatcher.
|
|
1148
1140
|
*
|
|
@@ -1393,9 +1385,9 @@ interface FederationOptions<TContextData> {
|
|
|
1393
1385
|
/**
|
|
1394
1386
|
* Whether to allow fetching private network addresses in the document loader.
|
|
1395
1387
|
*
|
|
1396
|
-
* If turned on, {@link
|
|
1397
|
-
* {@link
|
|
1398
|
-
* {@link
|
|
1388
|
+
* If turned on, {@link FederationOptions.documentLoader},
|
|
1389
|
+
* {@link FederationOptions.contextLoader}, and
|
|
1390
|
+
* {@link FederationOptions.authenticatedDocumentLoaderFactory}
|
|
1399
1391
|
* cannot be configured.
|
|
1400
1392
|
*
|
|
1401
1393
|
* Mostly useful for testing purposes. *Do not use in production.*
|
|
@@ -1982,8 +1974,6 @@ interface Context<TContextData> {
|
|
|
1982
1974
|
identifier: string;
|
|
1983
1975
|
} | {
|
|
1984
1976
|
username: string;
|
|
1985
|
-
} | {
|
|
1986
|
-
handle: string;
|
|
1987
1977
|
}): Promise<DocumentLoader>;
|
|
1988
1978
|
/**
|
|
1989
1979
|
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
|
@@ -2114,8 +2104,6 @@ interface Context<TContextData> {
|
|
|
2114
2104
|
identifier: string;
|
|
2115
2105
|
} | {
|
|
2116
2106
|
username: string;
|
|
2117
|
-
} | {
|
|
2118
|
-
handle: string;
|
|
2119
2107
|
}, recipients: Recipient | Recipient[], activity: Activity, options?: SendActivityOptions): Promise<void>;
|
|
2120
2108
|
/**
|
|
2121
2109
|
* Sends an activity to the inboxes of the sender's followers.
|
|
@@ -2130,8 +2118,6 @@ interface Context<TContextData> {
|
|
|
2130
2118
|
identifier: string;
|
|
2131
2119
|
} | {
|
|
2132
2120
|
username: string;
|
|
2133
|
-
} | {
|
|
2134
|
-
handle: string;
|
|
2135
2121
|
}, recipients: "followers", activity: Activity, options?: SendActivityOptionsForCollection): Promise<void>;
|
|
2136
2122
|
/**
|
|
2137
2123
|
* Manually routes an activity to the appropriate inbox listener.
|
|
@@ -2309,8 +2295,6 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2309
2295
|
identifier: string;
|
|
2310
2296
|
} | {
|
|
2311
2297
|
username: string;
|
|
2312
|
-
} | {
|
|
2313
|
-
handle: string;
|
|
2314
2298
|
}, recipients: Recipient | Recipient[], options?: ForwardActivityOptions): Promise<void>;
|
|
2315
2299
|
/**
|
|
2316
2300
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
@@ -2328,8 +2312,6 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2328
2312
|
identifier: string;
|
|
2329
2313
|
} | {
|
|
2330
2314
|
username: string;
|
|
2331
|
-
} | {
|
|
2332
|
-
handle: string;
|
|
2333
2315
|
}, recipients: "followers", options?: ForwardActivityOptions): Promise<void>;
|
|
2334
2316
|
}
|
|
2335
2317
|
/**
|
|
@@ -2342,7 +2324,6 @@ type ParseUriResult =
|
|
|
2342
2324
|
{
|
|
2343
2325
|
readonly type: "actor";
|
|
2344
2326
|
readonly identifier: string;
|
|
2345
|
-
readonly handle: string;
|
|
2346
2327
|
}
|
|
2347
2328
|
/**
|
|
2348
2329
|
* The case of an object URI.
|
|
@@ -2357,35 +2338,30 @@ type ParseUriResult =
|
|
|
2357
2338
|
*/ | {
|
|
2358
2339
|
readonly type: "inbox";
|
|
2359
2340
|
readonly identifier: undefined;
|
|
2360
|
-
readonly handle: undefined;
|
|
2361
2341
|
}
|
|
2362
2342
|
/**
|
|
2363
2343
|
* The case of an personal inbox URI.
|
|
2364
2344
|
*/ | {
|
|
2365
2345
|
readonly type: "inbox";
|
|
2366
2346
|
readonly identifier: string;
|
|
2367
|
-
readonly handle: string;
|
|
2368
2347
|
}
|
|
2369
2348
|
/**
|
|
2370
2349
|
* The case of an outbox collection URI.
|
|
2371
2350
|
*/ | {
|
|
2372
2351
|
readonly type: "outbox";
|
|
2373
2352
|
readonly identifier: string;
|
|
2374
|
-
readonly handle: string;
|
|
2375
2353
|
}
|
|
2376
2354
|
/**
|
|
2377
2355
|
* The case of a following collection URI.
|
|
2378
2356
|
*/ | {
|
|
2379
2357
|
readonly type: "following";
|
|
2380
2358
|
readonly identifier: string;
|
|
2381
|
-
readonly handle: string;
|
|
2382
2359
|
}
|
|
2383
2360
|
/**
|
|
2384
2361
|
* The case of a followers collection URI.
|
|
2385
2362
|
*/ | {
|
|
2386
2363
|
readonly type: "followers";
|
|
2387
2364
|
readonly identifier: string;
|
|
2388
|
-
readonly handle: string;
|
|
2389
2365
|
}
|
|
2390
2366
|
/**
|
|
2391
2367
|
* The case of a liked collection URI.
|
|
@@ -2393,7 +2369,6 @@ type ParseUriResult =
|
|
|
2393
2369
|
*/ | {
|
|
2394
2370
|
readonly type: "liked";
|
|
2395
2371
|
readonly identifier: string;
|
|
2396
|
-
readonly handle: string;
|
|
2397
2372
|
}
|
|
2398
2373
|
/**
|
|
2399
2374
|
* The case of a featured collection URI.
|
|
@@ -2401,7 +2376,6 @@ type ParseUriResult =
|
|
|
2401
2376
|
*/ | {
|
|
2402
2377
|
readonly type: "featured";
|
|
2403
2378
|
readonly identifier: string;
|
|
2404
|
-
readonly handle: string;
|
|
2405
2379
|
}
|
|
2406
2380
|
/**
|
|
2407
2381
|
* The case of a featured tags collection URI.
|
|
@@ -2409,7 +2383,6 @@ type ParseUriResult =
|
|
|
2409
2383
|
*/ | {
|
|
2410
2384
|
readonly type: "featuredTags";
|
|
2411
2385
|
readonly identifier: string;
|
|
2412
|
-
readonly handle: string;
|
|
2413
2386
|
}
|
|
2414
2387
|
/**
|
|
2415
2388
|
* The case of a custom collection URI.
|
|
@@ -2580,4 +2553,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
2580
2553
|
readonly multikey: Multikey;
|
|
2581
2554
|
}
|
|
2582
2555
|
//#endregion
|
|
2583
|
-
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions,
|
|
2556
|
+
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 };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
//#region deno.json
|
|
7
7
|
var name = "@fedify/fedify";
|
|
8
|
-
var version = "2.0.0
|
|
8
|
+
var version = "2.0.0";
|
|
9
9
|
var license = "MIT";
|
|
10
10
|
var exports = {
|
|
11
11
|
".": "./src/mod.ts",
|
|
@@ -20,9 +20,6 @@ var exports = {
|
|
|
20
20
|
};
|
|
21
21
|
var imports = {
|
|
22
22
|
"@multiformats/base-x": "npm:@multiformats/base-x@^4.0.1",
|
|
23
|
-
"@opentelemetry/core": "npm:@opentelemetry/core@^2.0.0",
|
|
24
|
-
"@opentelemetry/sdk-trace-base": "npm:@opentelemetry/sdk-trace-base@^2.0.0",
|
|
25
|
-
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.27.0",
|
|
26
23
|
"@std/assert": "jsr:@std/assert@^0.226.0",
|
|
27
24
|
"@std/url": "jsr:@std/url@^0.225.1",
|
|
28
25
|
"asn1js": "npm:asn1js@^3.0.7",
|
|
@@ -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-BQD4Ef_6.js";
|
|
7
|
+
import { doubleKnock } from "./http-CMTBVAxQ.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-CJgVX6Dr.js";
|
|
12
12
|
import "../router-D9eI0s4b.js";
|
|
13
|
-
import "../inbox-
|
|
14
|
-
import { createFederationBuilder } from "../builder-
|
|
13
|
+
import "../inbox-BrQMunLn.js";
|
|
14
|
+
import { createFederationBuilder } from "../builder-DIwRDV19.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-CJgVX6Dr.js";
|
|
12
|
+
import { createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-BN-t5M_R.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-BQD4Ef_6.js";
|
|
17
|
+
import { signRequest } from "../http-CMTBVAxQ.js";
|
|
18
|
+
import "../ld-DNdCEe6l.js";
|
|
19
|
+
import "../owner-DbymvgVI.js";
|
|
20
|
+
import "../proof-DVBdddim.js";
|
|
21
|
+
import "../docloader-BMecQIi-.js";
|
|
22
22
|
import "../kv-cache-B__dHl7g.js";
|
|
23
|
-
import { InboxListenerSet } from "../inbox-
|
|
24
|
-
import "../builder-
|
|
23
|
+
import { InboxListenerSet } from "../inbox-BrQMunLn.js";
|
|
24
|
+
import "../builder-DIwRDV19.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-CkvEc-Tx.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-CJgVX6Dr.js";
|
|
12
|
+
import { createFederation } from "../middleware-BN-t5M_R.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-BQD4Ef_6.js";
|
|
17
|
+
import "../http-CMTBVAxQ.js";
|
|
18
|
+
import "../ld-DNdCEe6l.js";
|
|
19
|
+
import "../owner-DbymvgVI.js";
|
|
20
|
+
import { signObject } from "../proof-DVBdddim.js";
|
|
21
|
+
import "../docloader-BMecQIi-.js";
|
|
22
22
|
import "../kv-cache-B__dHl7g.js";
|
|
23
|
-
import "../inbox-
|
|
24
|
-
import "../builder-
|
|
23
|
+
import "../inbox-BrQMunLn.js";
|
|
24
|
+
import "../builder-DIwRDV19.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-CkvEc-Tx.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-CJgVX6Dr.js";
|
|
9
|
+
import { InboxListenerSet } from "../inbox-BrQMunLn.js";
|
|
10
10
|
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
11
11
|
import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
|
|
12
12
|
|