Unverified Commit 5c237dfe authored by Hong Minhee's avatar Hong Minhee
Browse files

Use en dash in "key–value" throughout codebase

Replace hyphen with en dash in "key-value" references across:

- Documentation (CLI, tutorial, manual)
- Code comments and interfaces
- Examples and CLI prompts

Improves typographic consistency following standard punctuation guidelines.

[ci skip]
parent b9776790
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3677,7 +3677,7 @@ Released on April 2, 2024.

 -  Fedify is now available on npm: [@fedify/fedify].  [[#24]]

 -  Abstract key-value store for caching.
 -  Abstract keyvalue store for caching.

     -  Added `KvStore` interface.
     -  Added `KvStoreSetOptions` interface.
+3 −3
Original line number Diff line number Diff line
@@ -609,7 +609,7 @@ export const command = new Command()
  )
  .option(
    "-k, --kv-store <kv-store:kv-store>",
    "Choose the key-value store to use for caching.",
    "Choose the keyvalue store to use for caching.",
  )
  .option(
    "-q, --message-queue <message-queue:message-queue>",
@@ -687,7 +687,7 @@ export const command = new Command()
        dinosaurDrawn = true;
      }
      kvStore = await Select.prompt({
        message: "Choose the key-value store to use for caching",
        message: "Choose the keyvalue store to use for caching",
        options: [
          { name: "In-memory", value: null },
          ...Object.entries(kvStores).map(([value, { label, runtimes }]) => ({
@@ -744,7 +744,7 @@ export const command = new Command()
    }
    logger.debug(
      "Runtime: {runtime}; package manager: {packageManager}; " +
        "web framework: {webFramework}; key-value store: {kvStore}; " +
        "web framework: {webFramework}; keyvalue store: {kvStore}; " +
        "message queue: {messageQueue}",
      {
        runtime,
+4 −4
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ project. It will ask you a few questions to set up the project:
 -  Package manager (if Node.js): [npm], [pnpm], or [Yarn]
 -  Web framework: Bare-bones, [Fresh] (if Deno), [Hono], [Express] (unless
    Deno), or [Nitro] (unless Deno)
 -  Key-value store: In-memory, [Redis], [PostgreSQL], or [Deno KV] (if Deno)
 -  keyvalue store: In-memory, [Redis], [PostgreSQL], or [Deno KV] (if Deno)
 -  Message queue: In-memory, [Redis], [PostgreSQL], [AMQP] (e.g., [RabbitMQ]),
    or [Deno KV] (if Deno)

@@ -171,16 +171,16 @@ the `-w`/`--web-framework` option. The available options are:

If it's omitted, no web framework will be integrated.

### `-k`/`--kv-store`: Key-value store
### `-k`/`--kv-store`: keyvalue store

You can specify the key-value store to use by using the `-k`/`--kv-store`
You can specify the keyvalue store to use by using the `-k`/`--kv-store`
option.  The available options are:

 -  `redis`: [Redis]
 -  `postgres`: [PostgreSQL]
 -  `denokv`: [Deno KV] (if Deno)

If it's omitted, the in-memory key-value store (which is for development
If it's omitted, the in-memory keyvalue store (which is for development
purpose) will be used.

### `-q`/`--message-queue`: Message queue
+3 −3
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ properties. Some of them are required:
that the `Federation` object uses to store several kinds of cache data and
to maintain the queue of outgoing activities.

`KvStore` is an abstract interface that represents a key-value store.
`KvStore` is an abstract interface that represents a keyvalue store.
For now, Fedify provides two built-in implementations of `KvStore`, which are
`MemoryKvStore` and `DenoKvStore` classes.  The `MemoryKvStore` class is for
testing and development purposes, and the `DenoKvStore` class is Deno KV-backed
@@ -221,7 +221,7 @@ function.

Usually, you don't need to set this property because the default document
loader is sufficient for most cases.  The default document loader
caches the loaded documents in the key-value store.
caches the loaded documents in the keyvalue store.

See the
[*Getting a `DocumentLoader`* section](./context.md#getting-a-documentloader)
@@ -237,7 +237,7 @@ loader function that loads remote JSON-LD documents as the actor.

Usually, you don't need to set this property because the default document
loader factory is sufficient for most cases.  The default document loader
factory intentionally doesn't cache the loaded documents in the key-value
factory intentionally doesn't cache the loaded documents in the keyvalue
store.

See the [*Getting an authenticated `DocumentLoader`*
+14 −14
Original line number Diff line number Diff line
@@ -245,13 +245,13 @@ const federation = createFederation<void>({
In the above code, we import the `createFederation()` function from the Fedify
framework to create a new `Federation` object.  We pass an object to the
`createFederation()` function, which is the configuration object.
The `kv` property is a key-value store that is used to store several internal
The `kv` property is a keyvalue store that is used to store several internal
data of the `Federation` object.  We use the `MemoryKvStore` to open
a key-value store.
a keyvalue store.

> [!IMPORTANT]
> Since `MemoryKvStore` is for testing and development purposes, you should
> use a persistent key-value store like `DenoKvStore` (in Deno) or
> use a persistent keyvalue store like `DenoKvStore` (in Deno) or
> [`RedisKvStore`] (from [@fedify/redis] package) or [`PostgresKvStore`]
> (from [@fedify/postgres] package) for production use.
>
@@ -828,7 +828,7 @@ import {
By the way, when should we generate a key pair?  In general, you should generate
a key pair when the actor is created.  In our case, we generate a key pair when
the actor *me* is dispatched for the first time.  Then, we store the key pair
in the key-value store so that the server can use the key pair later.
in the keyvalue store so that the server can use the key pair later.

The `~ActorCallbackSetters.setKeyPairsDispatcher()` method is used to set a key
pairs dispatcher for the actor.  The key pairs dispatcher is a function that is
@@ -848,7 +848,7 @@ import {
} from "@fedify/fedify";
const federation = null as unknown as Federation<void>;
// ---cut-before---
const kv = await Deno.openKv();  // Open the key-value store
const kv = await Deno.openKv();  // Open the keyvalue store

federation
  .setActorDispatcher("/users/{identifier}", async (ctx, identifier) => {
@@ -907,7 +907,7 @@ const federation = null as unknown as Federation<void>;
import { serialize as encodeV8, deserialize as decodeV8 } from "node:v8";
import { openKv } from "@deno/kv";

// Open the key-value store:
// Open the keyvalue store:
const kv = await openKv("kv.db", { encodeV8, decodeV8 });

federation
@@ -965,7 +965,7 @@ const federation = null as unknown as Federation<void>;
// ---cut-before---
import { openKv } from "@deno/kv";

const kv = await openKv("kv.db");  // Open the key-value store
const kv = await openKv("kv.db");  // Open the keyvalue store

federation
  .setActorDispatcher("/users/{identifier}", async (ctx, identifier) => {
@@ -1017,13 +1017,13 @@ method to set a key pairs dispatcher for the actor *me*. The key pairs
dispatcher is called when the key pairs of an actor is needed. The key pairs
dispatcher should return an array of objects that contain the private key
and the public key of the actor.  In this case, we generate a new key pair
at the first time and store it in the key-value store.  When the actor *me* is
dispatched again, the key pairs dispatcher loads the key pair from the key-value
at the first time and store it in the keyvalue store.  When the actor *me* is
dispatched again, the key pairs dispatcher loads the key pair from the keyvalue
store.

> [!NOTE]
> Although we use the Deno KV database in this tutorial, you can use any
> other your favorite database to store the key pair.  The key-value store
> other your favorite database to store the key pair.  The keyvalue store
> is just an example.

Restart the server and make an HTTP request to the actor *me* using `curl`.
@@ -1130,7 +1130,7 @@ Listing followers
-----------------

The server should list the actor's followers on the home page.  To do this,
we need to store the followers in the key-value store.  We will store each
we need to store the followers in the keyvalue store.  We will store each
`Follow` activity's ID as the key and the follower's actor ID as the value:

~~~~ typescript{16-17} twoslash [server.ts]
@@ -1153,7 +1153,7 @@ federation
      follower,
      new Accept({ actor: follow.objectId, object: follow }),
    );
    // Store the follower in the key-value store:
    // Store the follower in the keyvalue store:
    await kv.set(["followers", follow.id.href], follow.actorId.href);
  });
~~~~
@@ -1257,7 +1257,7 @@ serve({
:::

The above code lists the actor's followers on the home page.  The followers are
stored in the key-value store, and we retrieve the followers from the key-value
stored in the keyvalue store, and we retrieve the followers from the keyvalue
store and display them on the home page.

Restart the server and navigate to the home page in your web browser.  You
@@ -1315,7 +1315,7 @@ Exercises
---------

 -  Implement unfollowing feature: Listen to the `Undo` activity and remove
    the follower from the key-value store when the server receives an `Undo`
    the follower from the keyvalue store when the server receives an `Undo`
    activity.

 -  Integration with a web framework: In the above example, we hard-coded
Loading