Skip to main content
This release is 5 versions behind 1.0.2 — the latest version of @fedify/fedify. Jump to latest

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 month ago (0.15.0)
method Context.lookupObject
Context.lookupObject(
identifier: string | URL,
options?: LookupObjectOptions,
): 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/federation";

---- OR ----

Import directly with a jsr specifier

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

Add Package

npx jsr add @fedify/fedify

Import symbol

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

Add Package

yarn dlx jsr add @fedify/fedify

Import symbol

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

Add Package

pnpm dlx jsr add @fedify/fedify

Import symbol

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

Add Package

bunx jsr add @fedify/fedify

Import symbol

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