@fedify/fedify 0.14.0-dev.337 → 0.14.0-dev.339

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGES.md CHANGED
@@ -8,6 +8,23 @@ Version 0.14.0
8
8
 
9
9
  To be released.
10
10
 
11
+ - Removed the limitation that the `sendActivity({ handle: string },
12
+ "followers", Activity)` overload is only available for `RequestContext`
13
+ but not for `Context`. Now it is available for both. [[#115]]
14
+
15
+ - Added `Context.sendActivity({ handle: string }, "followers", Activity)`
16
+ overload.
17
+ - Added type parameter `TContext` to `CollectionsDispatcher` type's first
18
+ parameter to distinguish between `RequestContext` and `Context`.
19
+ - The first parameter of `CollectionDispatcher` type became `TContext`
20
+ (was `RequestContext`).
21
+ - Added type parameter `TContext` to `CollectionsCursor` type's first
22
+ parameter to distinguish between `RequestContext` and `Context`.
23
+ - The first parameter of `CollectionCursor` type became `TContext`
24
+ (was `RequestContext`).
25
+ - Added type parameter `TContext` to `CollectionsCallbackSetters` type's
26
+ first parameter to distinguish between `RequestContext` and `Context`.
27
+
11
28
  - Added `source` property to `Object` class in Activity Vocabulary API.
12
29
  [[#114]]
13
30
 
@@ -17,6 +34,39 @@ To be released.
17
34
 
18
35
  - Added `Source` class to Activity Vocabulary API. [[#114]]
19
36
 
37
+ - Added `aliases` property to `Actor` type in Activity Vocabulary API.
38
+
39
+ - Added `Application.getAliases()` method.
40
+ - Added `Application.getAlias()` method.
41
+ - `new Application()` constructor now accepts `alias` option.
42
+ - `new Application()` constructor now accepts `aliases` option.
43
+ - `Application.clone()` method now accepts `alias` option.
44
+ - `Application.clone()` method now accepts `aliases` option.
45
+ - Added `Group.getAliases()` method.
46
+ - Added `Group.getAlias()` method.
47
+ - `new Group()` constructor now accepts `alias` option.
48
+ - `new Group()` constructor now accepts `aliases` option.
49
+ - `Group.clone()` method now accepts `alias` option.
50
+ - `Group.clone()` method now accepts `aliases` option.
51
+ - Added `Organization.getAliases()` method.
52
+ - Added `Organization.getAlias()` method.
53
+ - `new Organization()` constructor now accepts `alias` option.
54
+ - `new Organization()` constructor now accepts `aliases` option.
55
+ - `Organization.clone()` method now accepts `alias` option.
56
+ - `Organization.clone()` method now accepts `aliases` option.
57
+ - Added `Person.getAliases()` method.
58
+ - Added `Person.getAlias()` method.
59
+ - `new Person()` constructor now accepts `alias` option.
60
+ - `new Person()` constructor now accepts `aliases` option.
61
+ - `Person.clone()` method now accepts `alias` option.
62
+ - `Person.clone()` method now accepts `aliases` option.
63
+ - Added `Service.getAliases()` method.
64
+ - Added `Service.getAlias()` method.
65
+ - `new Service()` constructor now accepts `alias` option.
66
+ - `new Service()` constructor now accepts `aliases` option.
67
+ - `Service.clone()` method now accepts `alias` option.
68
+ - `Service.clone()` method now accepts `aliases` option.
69
+
20
70
  - Improved the performance of `Object.toJsonLd()` method.
21
71
 
22
72
  - `Object.toJsonLd()` method no longer guarantees that the returned
@@ -34,6 +84,7 @@ To be released.
34
84
  Deno.
35
85
 
36
86
  [#114]: https://github.com/dahlia/fedify/issues/114
87
+ [#115]: https://github.com/dahlia/fedify/issues/115
37
88
 
38
89
 
39
90
  Version 0.13.0
@@ -496,9 +496,7 @@ class FederationImpl {
496
496
  }
497
497
  this.inboxPath = path;
498
498
  }
499
- const callbacks = {
500
- dispatcher,
501
- };
499
+ const callbacks = { dispatcher };
502
500
  this.inboxCallbacks = callbacks;
503
501
  const setters = {
504
502
  setCounter(counter) {
@@ -528,9 +526,7 @@ class FederationImpl {
528
526
  if (variables.size !== 1 || !variables.has("handle")) {
529
527
  throw new RouterError("Path for outbox dispatcher must have one variable: {handle}");
530
528
  }
531
- const callbacks = {
532
- dispatcher,
533
- };
529
+ const callbacks = { dispatcher };
534
530
  this.outboxCallbacks = callbacks;
535
531
  const setters = {
536
532
  setCounter(counter) {
@@ -560,9 +556,7 @@ class FederationImpl {
560
556
  if (variables.size !== 1 || !variables.has("handle")) {
561
557
  throw new RouterError("Path for following collection dispatcher must have one variable: {handle}");
562
558
  }
563
- const callbacks = {
564
- dispatcher,
565
- };
559
+ const callbacks = { dispatcher };
566
560
  this.followingCallbacks = callbacks;
567
561
  const setters = {
568
562
  setCounter(counter) {
@@ -592,9 +586,7 @@ class FederationImpl {
592
586
  if (variables.size !== 1 || !variables.has("handle")) {
593
587
  throw new RouterError("Path for followers collection dispatcher must have one variable: {handle}");
594
588
  }
595
- const callbacks = {
596
- dispatcher,
597
- };
589
+ const callbacks = { dispatcher };
598
590
  this.followersCallbacks = callbacks;
599
591
  const setters = {
600
592
  setCounter(counter) {
@@ -624,9 +616,7 @@ class FederationImpl {
624
616
  if (variables.size !== 1 || !variables.has("handle")) {
625
617
  throw new RouterError("Path for liked collection dispatcher must have one variable: {handle}");
626
618
  }
627
- const callbacks = {
628
- dispatcher,
629
- };
619
+ const callbacks = { dispatcher };
630
620
  this.likedCallbacks = callbacks;
631
621
  const setters = {
632
622
  setCounter(counter) {
@@ -656,9 +646,7 @@ class FederationImpl {
656
646
  if (variables.size !== 1 || !variables.has("handle")) {
657
647
  throw new RouterError("Path for featured collection dispatcher must have one variable: {handle}");
658
648
  }
659
- const callbacks = {
660
- dispatcher,
661
- };
649
+ const callbacks = { dispatcher };
662
650
  this.featuredCallbacks = callbacks;
663
651
  const setters = {
664
652
  setCounter(counter) {
@@ -689,9 +677,7 @@ class FederationImpl {
689
677
  throw new RouterError("Path for featured tags collection dispatcher must have one " +
690
678
  "variable: {handle}");
691
679
  }
692
- const callbacks = {
693
- dispatcher,
694
- };
680
+ const callbacks = { dispatcher };
695
681
  this.featuredTagsCallbacks = callbacks;
696
682
  const setters = {
697
683
  setCounter(counter) {
@@ -1313,7 +1299,7 @@ class ContextImpl {
1313
1299
  throw new Error("If recipients is 'followers', sender must be an actor handle.");
1314
1300
  }
1315
1301
  expandedRecipients = [];
1316
- for await (const recipient of this.getFollowers(sender.handle)) {
1302
+ for await (const recipient of this.#getFollowers(sender.handle)) {
1317
1303
  expandedRecipients.push(recipient);
1318
1304
  }
1319
1305
  const collectionId = this.federation.router.build("followers", sender);
@@ -1326,24 +1312,7 @@ class ContextImpl {
1326
1312
  }
1327
1313
  return await this.federation.sendActivity(keys, expandedRecipients, activity, opts);
1328
1314
  }
1329
- getFollowers(_handle) {
1330
- throw new Error('"followers" recipients are not supported in Context. ' +
1331
- "Use RequestContext instead.");
1332
- }
1333
- }
1334
- class RequestContextImpl extends ContextImpl {
1335
- #invokedFromActorDispatcher;
1336
- #invokedFromObjectDispatcher;
1337
- request;
1338
- url;
1339
- constructor(options) {
1340
- super(options);
1341
- this.#invokedFromActorDispatcher = options.invokedFromActorDispatcher;
1342
- this.#invokedFromObjectDispatcher = options.invokedFromObjectDispatcher;
1343
- this.request = options.request;
1344
- this.url = options.url;
1345
- }
1346
- async *getFollowers(handle) {
1315
+ async *#getFollowers(handle) {
1347
1316
  if (this.federation.followersCallbacks == null) {
1348
1317
  throw new Error("No followers collection dispatcher registered.");
1349
1318
  }
@@ -1366,6 +1335,19 @@ class RequestContextImpl extends ContextImpl {
1366
1335
  cursor = result.nextCursor ?? null;
1367
1336
  }
1368
1337
  }
1338
+ }
1339
+ class RequestContextImpl extends ContextImpl {
1340
+ #invokedFromActorDispatcher;
1341
+ #invokedFromObjectDispatcher;
1342
+ request;
1343
+ url;
1344
+ constructor(options) {
1345
+ super(options);
1346
+ this.#invokedFromActorDispatcher = options.invokedFromActorDispatcher;
1347
+ this.#invokedFromObjectDispatcher = options.invokedFromObjectDispatcher;
1348
+ this.request = options.request;
1349
+ this.url = options.url;
1350
+ }
1369
1351
  async getActor(handle) {
1370
1352
  if (this.federation.actorCallbacks == null ||
1371
1353
  this.federation.actorCallbacks.dispatcher == null) {
@@ -242,3 +242,20 @@ properties:
242
242
  description: Whether the actor allows to be indexed.
243
243
  range:
244
244
  - "http://www.w3.org/2001/XMLSchema#boolean"
245
+
246
+ - pluralName: aliases
247
+ singularName: alias
248
+ singularAccessor: true
249
+ compactName: alsoKnownAs
250
+ uri: "https://www.w3.org/ns/activitystreams#alsoKnownAs"
251
+ description: |
252
+ The `aliases` (`alsoKnownAs`) property is used to specify alternative names
253
+ or aliases for an entity. It can be used to provide additional identifiers
254
+ or labels for an entity, which can be useful in scenarios where an entity
255
+ may have multiple names or aliases.
256
+ range:
257
+ - "https://www.w3.org/ns/activitystreams#Application"
258
+ - "https://www.w3.org/ns/activitystreams#Group"
259
+ - "https://www.w3.org/ns/activitystreams#Organization"
260
+ - "https://www.w3.org/ns/activitystreams#Person"
261
+ - "https://www.w3.org/ns/activitystreams#Service"
@@ -242,3 +242,20 @@ properties:
242
242
  description: Whether the actor allows to be indexed.
243
243
  range:
244
244
  - "http://www.w3.org/2001/XMLSchema#boolean"
245
+
246
+ - pluralName: aliases
247
+ singularName: alias
248
+ singularAccessor: true
249
+ compactName: alsoKnownAs
250
+ uri: "https://www.w3.org/ns/activitystreams#alsoKnownAs"
251
+ description: |
252
+ The `aliases` (`alsoKnownAs`) property is used to specify alternative names
253
+ or aliases for an entity. It can be used to provide additional identifiers
254
+ or labels for an entity, which can be useful in scenarios where an entity
255
+ may have multiple names or aliases.
256
+ range:
257
+ - "https://www.w3.org/ns/activitystreams#Application"
258
+ - "https://www.w3.org/ns/activitystreams#Group"
259
+ - "https://www.w3.org/ns/activitystreams#Organization"
260
+ - "https://www.w3.org/ns/activitystreams#Person"
261
+ - "https://www.w3.org/ns/activitystreams#Service"
@@ -242,3 +242,20 @@ properties:
242
242
  description: Whether the actor allows to be indexed.
243
243
  range:
244
244
  - "http://www.w3.org/2001/XMLSchema#boolean"
245
+
246
+ - pluralName: aliases
247
+ singularName: alias
248
+ singularAccessor: true
249
+ compactName: alsoKnownAs
250
+ uri: "https://www.w3.org/ns/activitystreams#alsoKnownAs"
251
+ description: |
252
+ The `aliases` (`alsoKnownAs`) property is used to specify alternative names
253
+ or aliases for an entity. It can be used to provide additional identifiers
254
+ or labels for an entity, which can be useful in scenarios where an entity
255
+ may have multiple names or aliases.
256
+ range:
257
+ - "https://www.w3.org/ns/activitystreams#Application"
258
+ - "https://www.w3.org/ns/activitystreams#Group"
259
+ - "https://www.w3.org/ns/activitystreams#Organization"
260
+ - "https://www.w3.org/ns/activitystreams#Person"
261
+ - "https://www.w3.org/ns/activitystreams#Service"
@@ -242,3 +242,20 @@ properties:
242
242
  description: Whether the actor allows to be indexed.
243
243
  range:
244
244
  - "http://www.w3.org/2001/XMLSchema#boolean"
245
+
246
+ - pluralName: aliases
247
+ singularName: alias
248
+ singularAccessor: true
249
+ compactName: alsoKnownAs
250
+ uri: "https://www.w3.org/ns/activitystreams#alsoKnownAs"
251
+ description: |
252
+ The `aliases` (`alsoKnownAs`) property is used to specify alternative names
253
+ or aliases for an entity. It can be used to provide additional identifiers
254
+ or labels for an entity, which can be useful in scenarios where an entity
255
+ may have multiple names or aliases.
256
+ range:
257
+ - "https://www.w3.org/ns/activitystreams#Application"
258
+ - "https://www.w3.org/ns/activitystreams#Group"
259
+ - "https://www.w3.org/ns/activitystreams#Organization"
260
+ - "https://www.w3.org/ns/activitystreams#Person"
261
+ - "https://www.w3.org/ns/activitystreams#Service"
@@ -242,3 +242,20 @@ properties:
242
242
  description: Whether the actor allows to be indexed.
243
243
  range:
244
244
  - "http://www.w3.org/2001/XMLSchema#boolean"
245
+
246
+ - pluralName: aliases
247
+ singularName: alias
248
+ singularAccessor: true
249
+ compactName: alsoKnownAs
250
+ uri: "https://www.w3.org/ns/activitystreams#alsoKnownAs"
251
+ description: |
252
+ The `aliases` (`alsoKnownAs`) property is used to specify alternative names
253
+ or aliases for an entity. It can be used to provide additional identifiers
254
+ or labels for an entity, which can be useful in scenarios where an entity
255
+ may have multiple names or aliases.
256
+ range:
257
+ - "https://www.w3.org/ns/activitystreams#Application"
258
+ - "https://www.w3.org/ns/activitystreams#Group"
259
+ - "https://www.w3.org/ns/activitystreams#Organization"
260
+ - "https://www.w3.org/ns/activitystreams#Person"
261
+ - "https://www.w3.org/ns/activitystreams#Service"