Skip to main content
Home

Built and signed on GitHub Actions

Works with
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 Score94%
Downloads78/wk
Published6 hours ago (1.10.1)

An ActivityPub/fediverse server framework

function actorDehydrator
actorDehydrator<TContextData>(
activity: Activity,
_context: Context<TContextData>,
): Activity

An activity transformer that dehydrates the actor property of an activity so that it only contains the actor's URI. For example, suppose we have an activity like this:

import { Follow, Person } from "@fedify/fedify/vocab";
const input = new Follow({
  id: new URL("http://example.com/activities/1"),
  actor: new Person({
    id: new URL("http://example.com/actors/1"),
    name: "Alice",
    preferredUsername: "alice",
  }),
  object: new Person({
    id: new URL("http://example.com/actors/2"),
    name: "Bob",
    preferredUsername: "bob",
  }),
});

The result of applying this transformer would be:

import { Follow, Person } from "@fedify/fedify/vocab";
const output = new Follow({
  id: new URL("http://example.com/activities/1"),
  actor: new URL("http://example.com/actors/1"),
  object: new Person({
    id: new URL("http://example.com/actors/2"),
    name: "Bob",
    preferredUsername: "bob",
  }),
});

As some ActivityPub implementations like Threads fail to deal with inlined actor objects, this transformer can be used to work around this issue.

Type Parameters

TContextData

The type of the context data.

Parameters

activity: Activity

The activity to dehydrate the actor property of.

_context: Context<TContextData>

Return Type

Activity

The dehydrated activity.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fedify/fedify

Import symbol

import { actorDehydrator } from "@fedify/fedify/compat";
or

Import directly with a jsr specifier

import { actorDehydrator } from "jsr:@fedify/fedify/compat";

Add Package

pnpm i jsr:@fedify/fedify
or (using pnpm 10.8 or older)
pnpm dlx jsr add @fedify/fedify

Import symbol

import { actorDehydrator } from "@fedify/fedify/compat";

Add Package

yarn add jsr:@fedify/fedify
or (using Yarn 4.8 or older)
yarn dlx jsr add @fedify/fedify

Import symbol

import { actorDehydrator } from "@fedify/fedify/compat";

Add Package

vlt install jsr:@fedify/fedify

Import symbol

import { actorDehydrator } from "@fedify/fedify/compat";

Add Package

npx jsr add @fedify/fedify

Import symbol

import { actorDehydrator } from "@fedify/fedify/compat";

Add Package

bunx jsr add @fedify/fedify

Import symbol

import { actorDehydrator } from "@fedify/fedify/compat";