@fedify/fedify 1.3.14 → 1.3.16

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.3.16
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.3.15
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.3.14
7
33
  --------------
8
34
 
@@ -295,6 +321,31 @@ Released on November 30, 2024.
295
321
  [#193]: https://github.com/fedify-dev/fedify/issues/193
296
322
 
297
323
 
324
+ Version 1.2.20
325
+ --------------
326
+
327
+ Released on March 26, 2025.
328
+
329
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
330
+ the `base-url` parameter was provided.
331
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
332
+ [[#222]]
333
+
334
+
335
+ Version 1.2.19
336
+ --------------
337
+
338
+ Released on March 26, 2025.
339
+
340
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
341
+ objects returned by followers collection dispatcher had been an incorrect
342
+ value if a `base-url` parameter was provided.
343
+
344
+ - Fixed a bug where the `id` property of `OrderedCollection` and
345
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
346
+ had been an incorrect value if a `base-url` parameter was provided.
347
+
348
+
298
349
  Version 1.2.18
299
350
  --------------
300
351
 
@@ -636,6 +687,31 @@ Released on October 31, 2024.
636
687
  [#118]: https://github.com/fedify-dev/fedify/issues/118
637
688
 
638
689
 
690
+ Version 1.1.20
691
+ --------------
692
+
693
+ Released on March 26, 2025.
694
+
695
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
696
+ the `base-url` parameter was provided.
697
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
698
+ [[#222]]
699
+
700
+
701
+ Version 1.1.19
702
+ --------------
703
+
704
+ Released on March 26, 2025.
705
+
706
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
707
+ objects returned by followers collection dispatcher had been an incorrect
708
+ value if a `base-url` parameter was provided.
709
+
710
+ - Fixed a bug where the `id` property of `OrderedCollection` and
711
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
712
+ had been an incorrect value if a `base-url` parameter was provided.
713
+
714
+
639
715
  Version 1.1.18
640
716
  --------------
641
717
 
@@ -1018,6 +1094,33 @@ Released on October 20, 2024.
1018
1094
  [#150]: https://github.com/fedify-dev/fedify/issues/150
1019
1095
 
1020
1096
 
1097
+ Version 1.0.23
1098
+ --------------
1099
+
1100
+ Released on March 26, 2025.
1101
+
1102
+ - Fixed a `TypeError` thrown by the followers collection dispatcher when
1103
+ the `base-url` parameter was provided.
1104
+ - Fixed a `TypeError` thrown by the `signRequest()` function on Node.js.
1105
+ [[#222]]
1106
+
1107
+ [#222]: https://github.com/fedify-dev/fedify/issues/222
1108
+
1109
+
1110
+ Version 1.0.22
1111
+ --------------
1112
+
1113
+ Released on March 26, 2025.
1114
+
1115
+ - Fixed a bug where the `totalItems` property of `OrderedCollection`
1116
+ objects returned by followers collection dispatcher had been an incorrect
1117
+ value if a `base-url` parameter was provided.
1118
+
1119
+ - Fixed a bug where the `id` property of `OrderedCollection` and
1120
+ `OrderedCollectionPage` objects returned by followers collection dispatcher
1121
+ had been an incorrect value if a `base-url` parameter was provided.
1122
+
1123
+
1021
1124
  Version 1.0.21
1022
1125
  --------------
1023
1126
 
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "@fedify/fedify",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./mod.ts",
@@ -40,7 +40,7 @@ export default {
40
40
  "@std/async": "jsr:@std/async@^1.0.5",
41
41
  "@std/bytes": "jsr:@std/bytes@^1.0.2",
42
42
  "@std/collections": "jsr:@std/collections@^1.0.6",
43
- "@std/encoding": "jsr:@std/encoding@^1.0.5",
43
+ "@std/encoding": "jsr:@std/encoding@1.0.7",
44
44
  "@std/fs": "jsr:@std/fs@^1.0.3",
45
45
  "@std/http": "jsr:@std/http@^1.0.6",
46
46
  "@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;
@@ -1393,7 +1393,13 @@ export class FederationImpl {
1393
1393
  return await handleCollection(request, {
1394
1394
  name: "followers",
1395
1395
  identifier: route.values.identifier ?? route.values.handle,
1396
- uriGetter: context.getFollowersUri.bind(context),
1396
+ uriGetter: baseUrl == null
1397
+ ? context.getFollowersUri.bind(context)
1398
+ : (identifier) => {
1399
+ const uri = context.getFollowersUri(identifier);
1400
+ uri.searchParams.set("base-url", baseUrl);
1401
+ return uri;
1402
+ },
1397
1403
  context,
1398
1404
  filter: baseUrl != null ? new URL(baseUrl) : undefined,
1399
1405
  filterPredicate: baseUrl != null
@@ -1949,6 +1955,12 @@ export class ContextImpl {
1949
1955
  throw new Error("No first cursor dispatcher registered for followers collection.");
1950
1956
  }
1951
1957
  let cursor = await this.federation.followersCallbacks.firstCursor(this, identifier);
1958
+ if (cursor != null) {
1959
+ getLogger(["fedify", "federation", "outbox"]).warn("Since the followers collection dispatcher returned null for no " +
1960
+ "cursor (i.e., one-shot dispatcher), the pagination is used to fetch " +
1961
+ '"followers". However, it is recommended to implement the one-shot ' +
1962
+ "dispatcher for better performance.", { identifier });
1963
+ }
1952
1964
  while (cursor != null) {
1953
1965
  const result = await this.federation.followersCallbacks.dispatcher(this, identifier, cursor);
1954
1966
  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";