@fedify/fedify 0.11.0-dev.231 → 0.11.0-dev.235

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/CHANGES.md +12 -0
  2. package/esm/federation/middleware.js +19 -5
  3. package/esm/vocab/vocab.js +3385 -394
  4. package/package.json +1 -1
  5. package/types/codegen/type.d.ts.map +1 -1
  6. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_dumper/dumper.d.ts.map +1 -1
  7. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_dumper/dumper_state.d.ts.map +1 -1
  8. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_error.d.ts.map +1 -1
  9. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_loader/loader.d.ts.map +1 -1
  10. package/types/deps/jsr.io/@std/yaml/0.224.2/_loader/loader_state.d.ts.map +1 -0
  11. package/types/deps/jsr.io/@std/yaml/0.224.2/_mark.d.ts.map +1 -0
  12. package/types/deps/jsr.io/@std/yaml/0.224.2/_state.d.ts.map +1 -0
  13. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/binary.d.ts.map +1 -1
  14. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/bool.d.ts.map +1 -1
  15. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/float.d.ts.map +1 -1
  16. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/function.d.ts.map +1 -1
  17. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/int.d.ts.map +1 -1
  18. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/map.d.ts.map +1 -1
  19. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/merge.d.ts.map +1 -1
  20. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/mod.d.ts.map +1 -1
  21. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/nil.d.ts.map +1 -1
  22. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/omap.d.ts.map +1 -1
  23. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/pairs.d.ts.map +1 -1
  24. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/regexp.d.ts.map +1 -1
  25. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/seq.d.ts.map +1 -1
  26. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/set.d.ts.map +1 -1
  27. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/str.d.ts.map +1 -1
  28. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/timestamp.d.ts.map +1 -1
  29. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_type/undefined.d.ts.map +1 -1
  30. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/_utils.d.ts.map +1 -1
  31. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/mod.d.ts.map +1 -1
  32. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/parse.d.ts.map +1 -1
  33. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/schema/core.d.ts.map +1 -1
  34. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/schema/default.d.ts.map +1 -1
  35. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/schema/extended.d.ts.map +1 -1
  36. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/schema/failsafe.d.ts.map +1 -1
  37. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/schema/json.d.ts.map +1 -1
  38. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/schema/mod.d.ts.map +1 -1
  39. package/types/deps/jsr.io/@std/yaml/0.224.2/schema.d.ts.map +1 -0
  40. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/stringify.d.ts.map +1 -1
  41. package/types/deps/jsr.io/@std/yaml/{0.224.1 → 0.224.2}/type.d.ts.map +1 -1
  42. package/types/federation/callback.d.ts +17 -0
  43. package/types/federation/callback.d.ts.map +1 -1
  44. package/types/federation/middleware.d.ts +15 -5
  45. package/types/federation/middleware.d.ts.map +1 -1
  46. package/types/vocab/vocab.d.ts +381 -381
  47. package/types/vocab/vocab.d.ts.map +1 -1
  48. package/types/deps/jsr.io/@std/yaml/0.224.1/_loader/loader_state.d.ts.map +0 -1
  49. package/types/deps/jsr.io/@std/yaml/0.224.1/_mark.d.ts.map +0 -1
  50. package/types/deps/jsr.io/@std/yaml/0.224.1/_state.d.ts.map +0 -1
  51. package/types/deps/jsr.io/@std/yaml/0.224.1/schema.d.ts.map +0 -1
package/CHANGES.md CHANGED
@@ -8,6 +8,8 @@ Version 0.11.0
8
8
 
9
9
  To be released.
10
10
 
11
+ - Improved runtime type error messages for Activity Vocabulary API. [[#79]]
12
+
11
13
  - Added `Federation.setInboxDispatcher()` method. [[#71]]
12
14
 
13
15
  - Frequently used JSON-LD contexts are now preloaded. [[74]]
@@ -27,9 +29,19 @@ To be released.
27
29
  - Added `Offer` class to Activity Vocabulary API.
28
30
  [[#65], [#76] by Lee Dogeon]
29
31
 
32
+ - The key pair or the key pair for signing outgoing HTTP requests made from
33
+ the shared inbox now can be configured. This improves the compatibility
34
+ with other ActivityPub implementations that require authorized fetches
35
+ (i.e., secure mode).
36
+
37
+ - Added `SharedInboxKeyDispatcher` type.
38
+ - Renamed `InboxListenerSetter` interface to `InboxListenerSetters`.
39
+ - Added `InboxListenerSetters.setSharedKeyDispatcher()` method.
40
+
30
41
  [#71]: https://github.com/dahlia/fedify/issues/71
31
42
  [#74]: https://github.com/dahlia/fedify/issues/74
32
43
  [#76]: https://github.com/dahlia/fedify/pull/76
44
+ [#79]: https://github.com/dahlia/fedify/issues/79
33
45
 
34
46
 
35
47
  Version 0.10.0
@@ -49,6 +49,7 @@ export class Federation {
49
49
  #followersCallbacks;
50
50
  #inboxListeners;
51
51
  #inboxErrorHandler;
52
+ #sharedInboxKeyDispatcher;
52
53
  #documentLoader;
53
54
  #contextLoader;
54
55
  #authenticatedDocumentLoaderFactory;
@@ -651,7 +652,7 @@ export class Federation {
651
652
  }
652
653
  }
653
654
  const listeners = this.#inboxListeners = new Map();
654
- const setter = {
655
+ const setters = {
655
656
  on(
656
657
  // deno-lint-ignore no-explicit-any
657
658
  type, listener) {
@@ -659,14 +660,18 @@ export class Federation {
659
660
  throw new TypeError("Listener already set for this type.");
660
661
  }
661
662
  listeners.set(type, listener);
662
- return setter;
663
+ return setters;
663
664
  },
664
665
  onError: (handler) => {
665
666
  this.#inboxErrorHandler = handler;
666
- return setter;
667
+ return setters;
668
+ },
669
+ setSharedKeyDispatcher: (dispatcher) => {
670
+ this.#sharedInboxKeyDispatcher = dispatcher;
671
+ return setters;
667
672
  },
668
673
  };
669
- return setter;
674
+ return setters;
670
675
  }
671
676
  /**
672
677
  * Sends an activity to recipients' inboxes. You would typically use
@@ -794,7 +799,8 @@ export class Federation {
794
799
  return response instanceof Promise ? await response : response;
795
800
  }
796
801
  let context = this.#createContext(request, contextData);
797
- switch (route.name.replace(/:.*$/, "")) {
802
+ const routeName = route.name.replace(/:.*$/, "");
803
+ switch (routeName) {
798
804
  case "webfinger":
799
805
  return await handleWebFinger(request, {
800
806
  context,
@@ -869,6 +875,14 @@ export class Federation {
869
875
  });
870
876
  // falls through
871
877
  case "sharedInbox":
878
+ if (routeName !== "inbox" && this.#sharedInboxKeyDispatcher != null) {
879
+ const identity = await this.#sharedInboxKeyDispatcher(context);
880
+ context = this.#createContext(request, contextData, {
881
+ documentLoader: "handle" in identity
882
+ ? await context.getDocumentLoader(identity)
883
+ : context.getDocumentLoader(identity),
884
+ });
885
+ }
872
886
  return await handleInbox(request, {
873
887
  handle: route.values.handle ?? null,
874
888
  context,