@fedify/fedify 1.5.0-dev.732 → 1.5.0-dev.745

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
@@ -94,6 +94,32 @@ To be released.
94
94
  [multibase]: https://github.com/multiformats/js-multibase
95
95
 
96
96
 
97
+ Version 1.4.9
98
+ -------------
99
+
100
+ Released on March 26, 2025.
101
+
102
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
103
+ the `base-url` parameter was provided.
104
+
105
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
106
+ [[#222]]
107
+
108
+
109
+ Version 1.4.8
110
+ -------------
111
+
112
+ Released on March 26, 2025.
113
+
114
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
115
+ objects returned by followers collection dispatcher had been an incorrect
116
+ value if a `base-url` parameter was provided.
117
+
118
+ - Fixed a bug where the `id` property of `OrderedCollection` and
119
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
120
+ had been an incorrect value if a `base-url` parameter was provided.
121
+
122
+
97
123
  Version 1.4.7
98
124
  -------------
99
125
 
@@ -270,6 +296,32 @@ Released on February 5, 2025.
270
296
  [#195]: https://github.com/fedify-dev/fedify/issues/195
271
297
 
272
298
 
299
+ Version 1.3.16
300
+ --------------
301
+
302
+ Released on March 26, 2025.
303
+
304
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
305
+ the `base-url` parameter was provided.
306
+
307
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
308
+ [[#222]]
309
+
310
+
311
+ Version 1.3.15
312
+ --------------
313
+
314
+ Released on March 26, 2025.
315
+
316
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
317
+ objects returned by followers collection dispatcher had been an incorrect
318
+ value if a `base-url` parameter was provided.
319
+
320
+ - Fixed a bug where the `id` property of `OrderedCollection` and
321
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
322
+ had been an incorrect value if a `base-url` parameter was provided.
323
+
324
+
273
325
  Version 1.3.14
274
326
  --------------
275
327
 
@@ -562,6 +614,31 @@ Released on November 30, 2024.
562
614
  [#193]: https://github.com/fedify-dev/fedify/issues/193
563
615
 
564
616
 
617
+ Version 1.2.20
618
+ --------------
619
+
620
+ Released on March 26, 2025.
621
+
622
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
623
+ the `base-url` parameter was provided.
624
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
625
+ [[#222]]
626
+
627
+
628
+ Version 1.2.19
629
+ --------------
630
+
631
+ Released on March 26, 2025.
632
+
633
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
634
+ objects returned by followers collection dispatcher had been an incorrect
635
+ value if a `base-url` parameter was provided.
636
+
637
+ - Fixed a bug where the `id` property of `OrderedCollection` and
638
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
639
+ had been an incorrect value if a `base-url` parameter was provided.
640
+
641
+
565
642
  Version 1.2.18
566
643
  --------------
567
644
 
@@ -903,6 +980,31 @@ Released on October 31, 2024.
903
980
  [#118]: https://github.com/fedify-dev/fedify/issues/118
904
981
 
905
982
 
983
+ Version 1.1.20
984
+ --------------
985
+
986
+ Released on March 26, 2025.
987
+
988
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
989
+ the `base-url` parameter was provided.
990
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
991
+ [[#222]]
992
+
993
+
994
+ Version 1.1.19
995
+ --------------
996
+
997
+ Released on March 26, 2025.
998
+
999
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
1000
+ objects returned by followers collection dispatcher had been an incorrect
1001
+ value if a `base-url` parameter was provided.
1002
+
1003
+ - Fixed a bug where the `id` property of `OrderedCollection` and
1004
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
1005
+ had been an incorrect value if a `base-url` parameter was provided.
1006
+
1007
+
906
1008
  Version 1.1.18
907
1009
  --------------
908
1010
 
@@ -1285,6 +1387,33 @@ Released on October 20, 2024.
1285
1387
  [#150]: https://github.com/fedify-dev/fedify/issues/150
1286
1388
 
1287
1389
 
1390
+ Version 1.0.23
1391
+ --------------
1392
+
1393
+ Released on March 26, 2025.
1394
+
1395
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
1396
+ the `base-url` parameter was provided.
1397
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
1398
+ [[#222]]
1399
+
1400
+ [#222]: https://github.com/fedify-dev/fedify/issues/222
1401
+
1402
+
1403
+ Version 1.0.22
1404
+ --------------
1405
+
1406
+ Released on March 26, 2025.
1407
+
1408
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
1409
+ objects returned by followers collection dispatcher had been an incorrect
1410
+ value if a `base-url` parameter was provided.
1411
+
1412
+ - Fixed a bug where the `id` property of `OrderedCollection` and
1413
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
1414
+ had been an incorrect value if a `base-url` parameter was provided.
1415
+
1416
+
1288
1417
  Version 1.0.21
1289
1418
  --------------
1290
1419
 
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "@fedify/fedify",
3
- "version": "1.5.0-dev.732+7b169275",
3
+ "version": "1.5.0-dev.745+3feb71c5",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./mod.ts",
@@ -29,7 +29,7 @@ export default {
29
29
  "@std/async": "jsr:@std/async@^1.0.5",
30
30
  "@std/bytes": "jsr:@std/bytes@^1.0.2",
31
31
  "@std/collections": "jsr:@std/collections@^1.0.6",
32
- "@std/encoding": "jsr:@std/encoding@^1.0.5",
32
+ "@std/encoding": "jsr:@std/encoding@1.0.7",
33
33
  "@std/http": "jsr:@std/http@^1.0.6",
34
34
  "@std/testing": "jsr:@std/testing@^0.224.0",
35
35
  "@std/text": "jsr:@std/text@^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.
@@ -120,7 +120,9 @@ export async function handleCollection(request, { name, identifier, uriGetter, f
120
120
  const baseUri = uriGetter(identifier);
121
121
  if (cursor == null) {
122
122
  const firstCursor = await collectionCallbacks.firstCursor?.(context, identifier);
123
- const totalItems = await collectionCallbacks.counter?.(context, identifier);
123
+ const totalItems = filter == null
124
+ ? await collectionCallbacks.counter?.(context, identifier)
125
+ : undefined;
124
126
  if (firstCursor == null) {
125
127
  const itemsOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection ${spanName}`, {
126
128
  kind: SpanKind.SERVER,
@@ -169,7 +171,7 @@ export async function handleCollection(request, { name, identifier, uriGetter, f
169
171
  }
170
172
  collection = new OrderedCollection({
171
173
  id: baseUri,
172
- totalItems: Number(totalItems),
174
+ totalItems: totalItems == null ? null : Number(totalItems),
173
175
  first,
174
176
  last,
175
177
  });
@@ -277,7 +279,8 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
277
279
  if (!logged) {
278
280
  getLogger(["fedify", "federation", "collection"]).warn(`The ${collectionName} collection apparently does not implement ` +
279
281
  "filtering. This may result in a large response payload. " +
280
- "Please consider implementing filtering for the collection.");
282
+ "Please consider implementing filtering for the collection. " +
283
+ "See also: https://fedify.dev/manual/collections#filtering-by-server");
281
284
  logged = true;
282
285
  }
283
286
  continue;
@@ -1544,7 +1544,13 @@ export class FederationImpl {
1544
1544
  return await handleCollection(request, {
1545
1545
  name: "followers",
1546
1546
  identifier: route.values.identifier ?? route.values.handle,
1547
- uriGetter: context.getFollowersUri.bind(context),
1547
+ uriGetter: baseUrl == null
1548
+ ? context.getFollowersUri.bind(context)
1549
+ : (identifier) => {
1550
+ const uri = context.getFollowersUri(identifier);
1551
+ uri.searchParams.set("base-url", baseUrl);
1552
+ return uri;
1553
+ },
1548
1554
  context,
1549
1555
  filter: baseUrl != null ? new URL(baseUrl) : undefined,
1550
1556
  filterPredicate: baseUrl != null
@@ -2174,6 +2180,12 @@ export class ContextImpl {
2174
2180
  throw new Error("No first cursor dispatcher registered for followers collection.");
2175
2181
  }
2176
2182
  let cursor = await this.federation.followersCallbacks.firstCursor(this, identifier);
2183
+ if (cursor != null) {
2184
+ getLogger(["fedify", "federation", "outbox"]).warn("Since the followers collection dispatcher returned null for no " +
2185
+ "cursor (i.e., one-shot dispatcher), the pagination is used to fetch " +
2186
+ '"followers". However, it is recommended to implement the one-shot ' +
2187
+ "dispatcher for better performance.", { identifier });
2188
+ }
2177
2189
  while (cursor != null) {
2178
2190
  const result = await this.federation.followersCallbacks.dispatcher(this, identifier, cursor);
2179
2191
  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";