Skip to content

Commit bafeb8d

Browse files
committed
Replaced @fedify/fedify/vocab to @fedify/vocab
1 parent 6700923 commit bafeb8d

99 files changed

Lines changed: 743 additions & 561 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/manual/access-control.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ authorized fetch for the actor dispatcher:
3535

3636
~~~~ typescript{9-11} twoslash
3737
// @noErrors: 2307 2345
38-
import type { Actor, Federation } from "@fedify/fedify";
38+
import type { Federation } from "@fedify/fedify";
39+
import type { Actor } from "@fedify/vocab";
3940
/**
4041
* A hypothetical `Federation` instance.
4142
*/
@@ -68,7 +69,8 @@ The equivalent method is available for collections as well:
6869

6970
~~~~ typescript{9-11} twoslash
7071
// @noErrors: 2307 2345
71-
import type { Actor, Federation } from "@fedify/fedify";
72+
import type { Federation } from "@fedify/fedify";
73+
import type { Actor } from "@fedify/vocab";
7274
/**
7375
* A hypothetical `Federation` instance.
7476
*/
@@ -116,7 +118,8 @@ actor). The below pseudo code shows how to filter out private posts:
116118

117119
~~~~ typescript{7} twoslash
118120
// @noErrors: 2307
119-
import type { Actor, Create, Federation } from "@fedify/fedify";
121+
import type { Federation } from "@fedify/fedify";
122+
import type { Actor, Create } from "@fedify/vocab";
120123
const federation = null as unknown as Federation<void>;
121124
interface Post {
122125
/**
@@ -177,7 +180,8 @@ domain name, such as `example.com@example.com`. Here is an example of how to
177180
implement an instance actor:
178181

179182
~~~~ typescript{3-11,20-27} twoslash
180-
import { type Actor, Application, type Federation, Person } from "@fedify/fedify";
183+
import { type Federation } from "@fedify/fedify";
184+
import { type Actor, Application, Person } from "@fedify/vocab";
181185
/**
182186
* A hypothetical `Federation` instance.
183187
*/

docs/manual/actor.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ const federation = null as unknown as Federation<void>;
3232
interface User { }
3333
const user = null as User | null;
3434
// ---cut-before---
35-
import { createFederation, Person } from "@fedify/fedify";
35+
import { createFederation } from "@fedify/fedify";
36+
import { Person } from "@fedify/vocab";
3637
3738
const federation = createFederation({
3839
// Omitted for brevity; see the related section for details.
@@ -196,7 +197,8 @@ the URIs of the actor's endpoints. The most important endpoint is the `sharedIn
196197
to generate the URI of the actor's shared inbox:
197198

198199
~~~~ typescript twoslash
199-
import { Endpoints, Context } from "@fedify/fedify";
200+
import { Context } from "@fedify/fedify";
201+
import { Endpoints } from "@fedify/vocab";
200202
const ctx = null as unknown as Context<void>;
201203
// ---cut-before---
202204
new Endpoints({ sharedInbox: ctx.getInboxUri() })
@@ -245,7 +247,8 @@ the `~ActorCallbackSetters.setKeyPairsDispatcher()` method so that Fedify can
245247
dispatch appropriate key pairs by the actor's identifier:
246248

247249
~~~~ typescript{4-6,10-14,17-26} twoslash
248-
import { type Federation, Person } from "@fedify/fedify";
250+
import { type Federation } from "@fedify/fedify";
251+
import { Person } from "@fedify/vocab";
249252
const federation = null as unknown as Federation<void>;
250253
interface User {}
251254
const user = null as User | null;
@@ -514,7 +517,8 @@ If you want to provide links with other `rel` than
514517
`url` property:
515518

516519
~~~~ typescript{8-16} twoslash
517-
import { type Federation, Person, Link } from "@fedify/fedify";
520+
import { type Federation } from "@fedify/fedify";
521+
import { Link, Person } from "@fedify/vocab";
518522
const federation = null as unknown as Federation<void>;
519523
// ---cut-before---
520524
federation

docs/manual/collections.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ interface Post {
8585
*/
8686
function getPostsByUserId(userId: string): Post[] { return []; }
8787
// ---cut-before---
88-
import { Article, Create } from "@fedify/fedify";
88+
import { Article, Create } from "@fedify/vocab";
8989

9090
federation
9191
.setOutboxDispatcher("/users/{identifier}/outbox", async (ctx, identifier) => {
@@ -178,7 +178,8 @@ Here's an example of how to implement collection pages for the outbox collection
178178
with assuming that the database system supports cursor-based pagination:
179179

180180
~~~~ typescript twoslash
181-
import { Article, Create, type Federation } from "@fedify/fedify";
181+
import { type Federation } from "@fedify/fedify";
182+
import { Article, Create } from "@fedify/vocab";
182183
const federation = null as unknown as Federation<void>;
183184
/**
184185
* A hypothetical type that represents a post.
@@ -290,7 +291,8 @@ The value for the first cursor is determined by
290291
`~CollectionCallbackSetters.setFirstCursor()` method:
291292

292293
~~~~ typescript twoslash
293-
import { Article, Create, type Federation } from "@fedify/fedify";
294+
import { type Federation } from "@fedify/fedify";
295+
import { Article, Create } from "@fedify/vocab";
294296
const federation = null as unknown as Federation<void>;
295297
/**
296298
* A hypothetical type that represents a post.
@@ -447,7 +449,8 @@ So, the below example assumes that the database system supports offset-based
447449
pagination, which is easy to implement backward pagination:
448450

449451
~~~~ typescript twoslash
450-
import { Article, Create, type Federation } from "@fedify/fedify";
452+
import { type Federation } from "@fedify/fedify";
453+
import { Article, Create } from "@fedify/vocab";
451454
const federation = null as unknown as Federation<void>;
452455
/**
453456
* A hypothetical type that represents a post.
@@ -610,7 +613,7 @@ async function countInboxByUserId(userId: string): Promise<number> {
610613
return 0;
611614
}
612615
// ---cut-before---
613-
import { Activity } from "@fedify/fedify";
616+
import { Activity } from "@fedify/vocab";
614617

615618
federation
616619
.setInboxDispatcher("/users/{identifier}/inbox", async (ctx, identifier) => {
@@ -790,7 +793,8 @@ has to consist of `Recipient` objects that represent the actors.
790793
The below example shows how to construct a followers collection:
791794

792795
~~~~ typescript twoslash
793-
import type { Federation, Recipient } from "@fedify/fedify";
796+
import type { Federation } from "@fedify/fedify";
797+
import type { Recipient } from "@fedify/vocab";
794798
const federation = null as unknown as Federation<void>;
795799
/**
796800
* A hypothetical type that represents an actor in the database.
@@ -904,7 +908,8 @@ the `Context.sendActivity()` method, you should return the entire followers
904908
collection when the `cursor` parameter is `null`:
905909

906910
~~~~ typescript{5-17} twoslash
907-
import type { Federation, Recipient } from "@fedify/fedify";
911+
import type { Federation } from "@fedify/fedify";
912+
import type { Recipient } from "@fedify/vocab";
908913
const federation = null as unknown as Federation<void>;
909914
/**
910915
* A hypothetical type that represents an actor in the database.
@@ -1031,7 +1036,8 @@ The following example shows how to filter the followers collection by the
10311036
server:
10321037

10331038
~~~~ typescript{8-11} twoslash
1034-
import type { Federation, Recipient } from "@fedify/fedify";
1039+
import type { Federation } from "@fedify/fedify";
1040+
import type { Recipient } from "@fedify/vocab";
10351041
const federation = null as unknown as Federation<void>;
10361042
/**
10371043
* A hypothetical type that represents an actor in the database.
@@ -1146,7 +1152,7 @@ async function getLikedByUserId(userId: string): Promise<Object[]> {
11461152
return [];
11471153
}
11481154
// ---cut-before---
1149-
import type { Object } from "@fedify/fedify";
1155+
import type { Object } from "@fedify/vocab";
11501156

11511157
federation
11521158
.setLikedDispatcher("/users/{identifier}/liked", async (ctx, identifier, cursor) => {
@@ -1171,7 +1177,7 @@ async function getLikedByUserId(userId: string): Promise<Object[]> {
11711177
return [];
11721178
}
11731179
// ---cut-before---
1174-
import type { Object } from "@fedify/fedify";
1180+
import type { Object } from "@fedify/vocab";
11751181

11761182
federation
11771183
.setLikedDispatcher("/users/{identifier}/liked", async (ctx, identifier, cursor) => {
@@ -1238,7 +1244,8 @@ as the outbox collection, so we don't repeat the explanation here.
12381244
The below example shows how to construct a featured collection:
12391245

12401246
~~~~ typescript twoslash
1241-
import type { Object, Federation } from "@fedify/fedify";
1247+
import type { Federation } from "@fedify/fedify";
1248+
import type { Object } from "@fedify/vocab";
12421249
const federation = null as unknown as Federation<void>;
12431250
/**
12441251
* A hypothetical function that returns the objects that an actor has featured.
@@ -1312,7 +1319,8 @@ way as the outbox collection, so we don't repeat the explanation here.
13121319
The below example shows how to construct a featured tags collection:
13131320

13141321
~~~~ typescript twoslash
1315-
import { Hashtag, type Federation } from "@fedify/fedify";
1322+
import { type Federation } from "@fedify/fedify";
1323+
import { Hashtag } from "@fedify/vocab";
13161324
const federation = null as unknown as Federation<void>;
13171325
/**
13181326
* A hypothetical function that returns the tags that an actor has featured.
@@ -1401,7 +1409,8 @@ collections. Both methods work similarly to the built-in collection dispatchers.
14011409
Here's an example of creating a custom collection of bookmarked posts:
14021410

14031411
~~~~ typescript twoslash
1404-
import { Article, type Federation } from "@fedify/fedify";
1412+
import { type Federation } from "@fedify/fedify";
1413+
import { Article } from "@fedify/vocab";
14051414
const federation = null as unknown as Federation<void>;
14061415
/**
14071416
* A hypothetical type that represents a bookmarked post.
@@ -1476,7 +1485,8 @@ federation
14761485
For ordered collections, simply use `setOrderedCollectionDispatcher()` instead:
14771486

14781487
~~~~ typescript twoslash
1479-
import { Article, type Federation } from "@fedify/fedify";
1488+
import { type Federation } from "@fedify/fedify";
1489+
import { Article } from "@fedify/vocab";
14801490
const federation = null as unknown as Federation<void>;
14811491
/**
14821492
* A hypothetical type that represents a bookmarked post.
@@ -1560,7 +1570,8 @@ Custom collections support the same callback methods as built-in collections:
15601570
Custom collections can have multiple parameters in their URI patterns:
15611571

15621572
~~~~ typescript twoslash
1563-
import { Note, type Federation } from "@fedify/fedify";
1573+
import { type Federation } from "@fedify/fedify";
1574+
import { Note } from "@fedify/vocab";
15641575
const federation = null as unknown as Federation<void>;
15651576
/**
15661577
* A hypothetical function that returns posts by category.
@@ -1628,7 +1639,8 @@ ctx.getCollectionUri("category-posts", {
16281639
You can restrict access to custom collections using the `.authorize()` method:
16291640

16301641
~~~~ typescript twoslash
1631-
import { Article, type Federation } from "@fedify/fedify";
1642+
import { type Federation } from "@fedify/fedify";
1643+
import { Article } from "@fedify/vocab";
16321644
const federation = null as unknown as Federation<void>;
16331645
/**
16341646
* A hypothetical function that checks if a user can access another user's bookmarks.

docs/manual/context.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ Here's an example of using the `~Context.getActorUri()` method in the actor
110110
dispatcher:
111111

112112
~~~~ typescript twoslash
113-
import { type Federation, Person } from "@fedify/fedify";
113+
import { type Federation } from "@fedify/fedify";
114+
import { Person } from "@fedify/vocab";
114115
const federation = null as unknown as Federation<void>;
115116
interface User { }
116117
const user: User | null = true ? { } : null;
@@ -142,7 +143,7 @@ example in an [inbox listener](./inbox.md):
142143
import { type Federation } from "@fedify/fedify";
143144
const federation = null as unknown as Federation<void>;
144145
// ---cut-before---
145-
import { Accept, Follow } from "@fedify/fedify";
146+
import { Accept, Follow } from "@fedify/vocab";
146147
147148
federation
148149
.setInboxListeners("/users/{identifier}/inbox", "/inbox")
@@ -193,7 +194,8 @@ object from the URL arguments. The following shows an example of using
193194
the `RequestContext.getActor()` method:
194195

195196
~~~~ typescript twoslash
196-
import { type Federation, Update } from "@fedify/fedify";
197+
import { type Federation } from "@fedify/fedify";
198+
import { Update } from "@fedify/vocab";
197199
const federation = null as unknown as Federation<void>;
198200
const request = new Request("");
199201
const identifier: string = "";
@@ -218,7 +220,8 @@ In the same way, you can use the `RequestContext.getObject()` method to dispatch
218220
an object from the URL arguments. The following shows an example:
219221

220222
~~~~ typescript twoslash
221-
import { type Federation, Note } from "@fedify/fedify";
223+
import { type Federation } from "@fedify/fedify";
224+
import { Note } from "@fedify/vocab";
222225
const federation = null as unknown as Federation<void>;
223226
const request = new Request("");
224227
const identifier: string = "";
@@ -248,7 +251,8 @@ compatible with `Context`. So you can just pass a `Context` object to those
248251
methods:
249252

250253
~~~~ typescript twoslash
251-
import { type Context, Object } from "@fedify/fedify";
254+
import { type Context } from "@fedify/fedify";
255+
import { Object } from "@fedify/vocab";
252256
const ctx = null as unknown as Context<void>;
253257
const jsonLd: unknown = {};
254258
// ---cut-before---
@@ -268,7 +272,8 @@ In such cases, you can use the `Context.getDocumentLoader()` method to get
268272
an authenticated `DocumentLoader` object. The following shows an example:
269273

270274
~~~~ typescript twoslash
271-
import { type Actor, type Context, Person } from "@fedify/fedify";
275+
import { type Context } from "@fedify/fedify";
276+
import { type Actor, Person } from "@fedify/vocab";
272277
const ctx = null as unknown as Context<void>;
273278
const actor = new Person({}) as Actor;
274279
// ---cut-before---
@@ -325,7 +330,7 @@ Looking up remote objects
325330
> For example, you can get the `object` from an `Activity` object directly:
326331
>
327332
> ~~~~ typescript twoslash
328-
> import { Activity } from "@fedify/fedify";
333+
> import { Activity } from "@fedify/vocab";
329334
> const activity = new Activity({});
330335
> // ---cut-before---
331336
> const object = await activity.getObject();
@@ -334,7 +339,8 @@ Looking up remote objects
334339
>instead of:
335340
>
336341
> ~~~~ typescript twoslash
337-
> import { Activity, type Context } from "@fedify/fedify";
342+
> import { type Context } from "@fedify/fedify";
343+
> import { Activity } from "@fedify/vocab";
338344
> const ctx = null as unknown as Context<void>;
339345
> const activity = new Activity({});
340346
> // ---cut-before---
@@ -507,7 +513,8 @@ and so on. The `Context.traverseCollection()` method plays a role in such
507513
cases. The following shows an example of traversing an actor's outbox:
508514

509515
~~~~ typescript twoslash
510-
import { type Context, isActor } from "@fedify/fedify";
516+
import { type Context } from "@fedify/fedify";
517+
import { isActor } from "@fedify/vocab";
511518
const ctx = null as unknown as Context<void>;
512519
// ---cut-before---
513520
const actor = await ctx.lookupObject("@hongminhee@fosstodon.org");

docs/manual/deploy.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ type Env = {
228228
KV_NAMESPACE: KVNamespace<string>;
229229
QUEUE: Queue;
230230
};
231-
import { Person } from "@fedify/fedify";
231+
import { Person } from "@fedify/vocab";
232232
// ---cut-before---
233233
import { createFederationBuilder } from "@fedify/fedify";
234234
import { WorkersKvStore, WorkersMessageQueue } from "@fedify/cfworkers";
@@ -265,7 +265,8 @@ must manually connect queue handlers:
265265

266266
~~~~ typescript twoslash
267267
// @noErrors: 2345
268-
import { createFederationBuilder, Person, type Message } from "@fedify/fedify";
268+
import { createFederationBuilder, type Message } from "@fedify/fedify";
269+
import { Person } from "@fedify/vocab";
269270
import { WorkersKvStore, WorkersMessageQueue } from "@fedify/cfworkers";
270271

271272
type Env = {

docs/manual/federation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ and is available in the `Context` object passed to the dispatchers and
468468
listeners. For example, you can access the `Federation` object like this:
469469

470470
~~~~ typescript twoslash
471-
import { type FederationBuilder, Person } from "@fedify/fedify";
471+
import { type FederationBuilder } from "@fedify/fedify";
472+
import { Person } from "@fedify/vocab";
472473
const builder = null as unknown as FederationBuilder<void>;
473474
// ---cut-before---
474475
builder.setActorDispatcher(

0 commit comments

Comments
 (0)