Unverified Commit 22cef13a authored by Hong Minhee's avatar Hong Minhee
Browse files

Deprecate new Federation() constructor

parent 68ec66b9
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -106,6 +106,15 @@ To be released.
     -  The `Context.sendActivity()` method's first parameter now accepts
        `SenderKeyPair[]` as well.

 -  In the future, `Federation` class will become an interface.
    For the forward compatibility, the following changes are made:

     -  Added `createFederation()` function.
     -  Added `CreateFederationOptions` interface.
     -  Deprecated `new Federation()` constructor.  Use `createFederation()`
        function instead.
     -  Deprecated `FederationParameters` interface.

 -  Added `Arrive` class to Activity Vocabulary API.
    [[#65], [#68] by Randy Wressell]

@@ -718,3 +727,5 @@ Version 0.1.0
-------------

Initial release.  Released on March 8, 2024.

<!-- cSpell: ignore Wressell -->
+2 −2
Original line number Diff line number Diff line
@@ -7,8 +7,8 @@ import {
  type Actor,
  Application,
  type Context,
  createFederation,
  Endpoints,
  Federation,
  Follow,
  generateCryptoKeyPair,
  getActorHandle,
@@ -111,7 +111,7 @@ export const command = new Command()
    printServerInfo(fedCtx);
  });

const federation = new Federation<number>({
const federation = createFederation<number>({
  kv: new MemoryKvStore(),
  queue: new InProcessMessageQueue(),
  documentLoader: await getDocumentLoader(),
+2 −2
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@ the following:
The below example shows how to register an actor dispatcher:

~~~~ typescript{7-15}
import { Federation, Person } from "@fedify/fedify";
import { createFederation, Person } from "@fedify/fedify";

const federation = new Federation({
const federation = createFederation({
  // Omitted for brevity; see the related section for details.
});

+4 −4
Original line number Diff line number Diff line
@@ -22,13 +22,13 @@ The key features of the `Federation` object are as follows:
 -  Maintaining a queue of [outgoing activities](./send.md)
 -  Registering a [NodeInfo dispatcher](./nodeinfo.md)

You can create a `Federation` object by calling the constructor function
with an optional configuration object:
You can create a `Federation` object by calling `createFederation()` function
with a configuration object:

~~~~ typescript
import { Federation, MemoryKvStore } from "@fedify/fedify";
import { createFederation, MemoryKvStore } from "@fedify/fedify";

const federation = new Federation<void>({
const federation = createFederation<void>({
  kv: new MemoryKvStore(),
  // Omitted for brevity; see the following sections for details.
});
+3 −3
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@ With Fedify, you can register an inbox listener for both types of inboxes at
a time.  The following shows how to register an inbox listener:

~~~~ typescript{7-18}
import { Federation, Follow } from "@fedify/fedify";
import { createFederation, Follow } from "@fedify/fedify";

const federation = new Federation({
const federation = createFederation({
  // Omitted for brevity; see the related section for details.
});

@@ -85,7 +85,7 @@ multiple inbox listeners for different activity types.
The `Context.documentLoader` property carries a `DocumentLoader` object that
you can use to fetch a remote document.  If a request is made to a shared inbox,
the `Context.documentLoader` property is set to the default `documentLoader`
that is specified in the `new Federation()` constructor.  However, if a request
that is specified in the `createFederation()` function.  However, if a request
is made to a personal inbox, the `Context.documentLoader` property is set to
an authenticated `DocumentLoader` object that is identified by the inbox owner's
key.
Loading