@fedify/fedify 1.4.7 → 1.4.9

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/CHANGES.md CHANGED
@@ -3,6 +3,32 @@
3
3
  Fedify changelog
4
4
  ================
5
5
 
6
+ Version 1.4.9
7
+ -------------
8
+
9
+ Released on March 26, 2025.
10
+
11
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
12
+ the `base-url` parameter was provided.
13
+
14
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
15
+ [[#222]]
16
+
17
+
18
+ Version 1.4.8
19
+ -------------
20
+
21
+ Released on March 26, 2025.
22
+
23
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
24
+ objects returned by followers collection dispatcher had been an incorrect
25
+ value if a `base-url` parameter was provided.
26
+
27
+ - Fixed a bug where the `id` property of `OrderedCollection` and
28
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
29
+ had been an incorrect value if a `base-url` parameter was provided.
30
+
31
+
6
32
  Version 1.4.7
7
33
  -------------
8
34
 
@@ -179,6 +205,32 @@ Released on February 5, 2025.
179
205
  [#195]: https://github.com/fedify-dev/fedify/issues/195
180
206
 
181
207
 
208
+ Version 1.3.16
209
+ --------------
210
+
211
+ Released on March 26, 2025.
212
+
213
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
214
+ the `base-url` parameter was provided.
215
+
216
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
217
+ [[#222]]
218
+
219
+
220
+ Version 1.3.15
221
+ --------------
222
+
223
+ Released on March 26, 2025.
224
+
225
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
226
+ objects returned by followers collection dispatcher had been an incorrect
227
+ value if a `base-url` parameter was provided.
228
+
229
+ - Fixed a bug where the `id` property of `OrderedCollection` and
230
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
231
+ had been an incorrect value if a `base-url` parameter was provided.
232
+
233
+
182
234
  Version 1.3.14
183
235
  --------------
184
236
 
@@ -471,6 +523,31 @@ Released on November 30, 2024.
471
523
  [#193]: https://github.com/fedify-dev/fedify/issues/193
472
524
 
473
525
 
526
+ Version 1.2.20
527
+ --------------
528
+
529
+ Released on March 26, 2025.
530
+
531
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
532
+ the `base-url` parameter was provided.
533
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
534
+ [[#222]]
535
+
536
+
537
+ Version 1.2.19
538
+ --------------
539
+
540
+ Released on March 26, 2025.
541
+
542
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
543
+ objects returned by followers collection dispatcher had been an incorrect
544
+ value if a `base-url` parameter was provided.
545
+
546
+ - Fixed a bug where the `id` property of `OrderedCollection` and
547
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
548
+ had been an incorrect value if a `base-url` parameter was provided.
549
+
550
+
474
551
  Version 1.2.18
475
552
  --------------
476
553
 
@@ -812,6 +889,31 @@ Released on October 31, 2024.
812
889
  [#118]: https://github.com/fedify-dev/fedify/issues/118
813
890
 
814
891
 
892
+ Version 1.1.20
893
+ --------------
894
+
895
+ Released on March 26, 2025.
896
+
897
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
898
+ the `base-url` parameter was provided.
899
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
900
+ [[#222]]
901
+
902
+
903
+ Version 1.1.19
904
+ --------------
905
+
906
+ Released on March 26, 2025.
907
+
908
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
909
+ objects returned by followers collection dispatcher had been an incorrect
910
+ value if a `base-url` parameter was provided.
911
+
912
+ - Fixed a bug where the `id` property of `OrderedCollection` and
913
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
914
+ had been an incorrect value if a `base-url` parameter was provided.
915
+
916
+
815
917
  Version 1.1.18
816
918
  --------------
817
919
 
@@ -1194,6 +1296,33 @@ Released on October 20, 2024.
1194
1296
  [#150]: https://github.com/fedify-dev/fedify/issues/150
1195
1297
 
1196
1298
 
1299
+ Version 1.0.23
1300
+ --------------
1301
+
1302
+ Released on March 26, 2025.
1303
+
1304
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
1305
+ the `base-url` parameter was provided.
1306
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
1307
+ [[#222]]
1308
+
1309
+ [#222]: https://github.com/fedify-dev/fedify/issues/222
1310
+
1311
+
1312
+ Version 1.0.22
1313
+ --------------
1314
+
1315
+ Released on March 26, 2025.
1316
+
1317
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
1318
+ objects returned by followers collection dispatcher had been an incorrect
1319
+ value if a `base-url` parameter was provided.
1320
+
1321
+ - Fixed a bug where the `id` property of `OrderedCollection` and
1322
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
1323
+ had been an incorrect value if a `base-url` parameter was provided.
1324
+
1325
+
1197
1326
  Version 1.0.21
1198
1327
  --------------
1199
1328
 
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "@fedify/fedify",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./mod.ts",
@@ -41,7 +41,7 @@ export default {
41
41
  "@std/async": "jsr:@std/async@^1.0.5",
42
42
  "@std/bytes": "jsr:@std/bytes@^1.0.2",
43
43
  "@std/collections": "jsr:@std/collections@^1.0.6",
44
- "@std/encoding": "jsr:@std/encoding@^1.0.5",
44
+ "@std/encoding": "jsr:@std/encoding@1.0.7",
45
45
  "@std/fs": "jsr:@std/fs@^1.0.3",
46
46
  "@std/http": "jsr:@std/http@^1.0.6",
47
47
  "@std/path": "jsr:@std/path@^1.0.6",
@@ -3,7 +3,7 @@ import { encodeHex } from "../deps/jsr.io/@std/encoding/1.0.7/hex.js";
3
3
  /**
4
4
  * Calculates the [partial follower collection digest][1].
5
5
  *
6
- * [1]: https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md#partial-follower-collection-digest
6
+ * [1]: https://w3id.org/fep/8fcf#partial-follower-collection-digest
7
7
  * @param uris The URIs to calculate the digest. Duplicate URIs are ignored.
8
8
  * @returns The digest.
9
9
  */
@@ -27,7 +27,7 @@ export async function digest(uris) {
27
27
  /**
28
28
  * Builds [`Collection-Synchronization`][1] header content.
29
29
  *
30
- * [1]: https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md#the-collection-synchronization-http-header
30
+ * [1]: https://w3id.org/fep/8fcf#the-collection-synchronization-http-header
31
31
  *
32
32
  * @param collectionId The sender's followers collection URI.
33
33
  * @param actorIds The actor URIs to digest.
@@ -84,7 +84,9 @@ export async function handleCollection(request, { name, identifier, uriGetter, f
84
84
  const baseUri = uriGetter(identifier);
85
85
  if (cursor == null) {
86
86
  const firstCursor = await collectionCallbacks.firstCursor?.(context, identifier);
87
- const totalItems = await collectionCallbacks.counter?.(context, identifier);
87
+ const totalItems = filter == null
88
+ ? await collectionCallbacks.counter?.(context, identifier)
89
+ : undefined;
88
90
  if (firstCursor == null) {
89
91
  const itemsOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection ${spanName}`, {
90
92
  kind: SpanKind.SERVER,
@@ -133,7 +135,7 @@ export async function handleCollection(request, { name, identifier, uriGetter, f
133
135
  }
134
136
  collection = new OrderedCollection({
135
137
  id: baseUri,
136
- totalItems: Number(totalItems),
138
+ totalItems: totalItems == null ? null : Number(totalItems),
137
139
  first,
138
140
  last,
139
141
  });
@@ -223,7 +225,8 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
223
225
  if (!logged) {
224
226
  getLogger(["fedify", "federation", "collection"]).warn(`The ${collectionName} collection apparently does not implement ` +
225
227
  "filtering. This may result in a large response payload. " +
226
- "Please consider implementing filtering for the collection.");
228
+ "Please consider implementing filtering for the collection. " +
229
+ "See also: https://fedify.dev/manual/collections#filtering-by-server");
227
230
  logged = true;
228
231
  }
229
232
  continue;
@@ -1451,7 +1451,13 @@ export class FederationImpl {
1451
1451
  return await handleCollection(request, {
1452
1452
  name: "followers",
1453
1453
  identifier: route.values.identifier ?? route.values.handle,
1454
- uriGetter: context.getFollowersUri.bind(context),
1454
+ uriGetter: baseUrl == null
1455
+ ? context.getFollowersUri.bind(context)
1456
+ : (identifier) => {
1457
+ const uri = context.getFollowersUri(identifier);
1458
+ uri.searchParams.set("base-url", baseUrl);
1459
+ return uri;
1460
+ },
1455
1461
  context,
1456
1462
  filter: baseUrl != null ? new URL(baseUrl) : undefined,
1457
1463
  filterPredicate: baseUrl != null
@@ -2022,6 +2028,12 @@ export class ContextImpl {
2022
2028
  throw new Error("No first cursor dispatcher registered for followers collection.");
2023
2029
  }
2024
2030
  let cursor = await this.federation.followersCallbacks.firstCursor(this, identifier);
2031
+ if (cursor != null) {
2032
+ getLogger(["fedify", "federation", "outbox"]).warn("Since the followers collection dispatcher returned null for no " +
2033
+ "cursor (i.e., one-shot dispatcher), the pagination is used to fetch " +
2034
+ '"followers". However, it is recommended to implement the one-shot ' +
2035
+ "dispatcher for better performance.", { identifier });
2036
+ }
2025
2037
  while (cursor != null) {
2026
2038
  const result = await this.federation.followersCallbacks.dispatcher(this, identifier, cursor);
2027
2039
  if (result == null)
@@ -1,7 +1,7 @@
1
1
  import * as dntShim from "../_dnt.shims.js";
2
2
  import { getLogger } from "@logtape/logtape";
3
3
  import { SpanStatusCode, trace } from "@opentelemetry/api";
4
- import { delay } from "../deps/jsr.io/@std/async/1.0.11/delay.js";
4
+ import { delay } from "../deps/jsr.io/@std/async/1.0.12/delay.js";
5
5
  import metadata from "../deno.js";
6
6
  import { getDocumentLoader, } from "../runtime/docloader.js";
7
7
  import { lookupWebFinger } from "../webfinger/lookup.js";