Skip to main content

Built and signed on GitHub Actions

An ActivityPub/fediverse server framework

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
a week ago (1.3.0)
method Context.lookupObject
Context.lookupObject(
identifier: string | URL,
): Promise<Object | null>

Looks up an ActivityStreams object by its URI (including acct: URIs) or a fediverse handle (e.g., @user@server or user@server).

Examples

Example 1

// Look up an actor by its fediverse handle:
await ctx.lookupObject("@hongminhee@fosstodon.org");
// returning a `Person` object.

// A fediverse handle can omit the leading '@':
await ctx.lookupObject("hongminhee@fosstodon.org");
// returning a `Person` object.

// A `acct:` URI can be used as well:
await ctx.lookupObject("acct:hongminhee@fosstodon.org");
// returning a `Person` object.

// Look up an object by its URI:
await ctx.lookupObject("https://todon.eu/@hongminhee/112060633798771581");
// returning a `Note` object.

// It can be a `URL` object as well:
await ctx.lookupObject(
  new URL("https://todon.eu/@hongminhee/112060633798771581")
);
// returning a `Note` object.

It's almost the same as the lookupObject function, but it uses the context's document loader and context loader by default.

Parameters

identifier: string | URL

The URI or fediverse handle to look up.

optional
options: LookupObjectOptions

Lookup options.

Return Type

Promise<Object | null>

The object, or null if not found.

Add Package

deno add jsr:@fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify";

---- OR ----

Import directly with a jsr specifier

import { type Context } from "jsr:@fedify/fedify";

Add Package

npx jsr add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify";

Add Package

yarn dlx jsr add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify";

Add Package

pnpm dlx jsr add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify";

Add Package

bunx jsr add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify";