A set of type-safe object mappings for the Activity Vocabulary.
Each class in this module represents a type of object in the Activity
Vocabulary. For example, the Note class represents the
Note
type
in the Activity Vocabulary.
There are two ways to instnatiate an object of a class in this module. The first way is to use the constructor of the class. For example:
const note = new Note({ attributedTo: new URL("https://example.com/user"), content: "Hello, world!", }); const create = new Create({ actor: new URL("https://example.com/user"), object: note, });
The second way is to deserialize an object from a JSON-LD document using
the fromJsonLd()
method of the class. For example:
const create = await Create.fromJsonLd({ "@context": "https://www.w3.org/ns/activitystreams", "type": "Create", "actor": "https://example.com/user", "object": { "type": "Note", "attributedTo": "https://example.com/user", "content": "Hello, world!", }, });
In order to serialize an object to a JSON-LD document, use the toJsonLd()
method of the object. For example:
const jsonLd = await create.toJsonLd();
Note that both fromJsonLd()
and toJsonLd()
are asynchronous methods
that return a Promise
.
Indicates that the actor
accepts the object
. The target
property can be
used in certain circumstances to indicate the context into which the object
has been accepted.
An Activity is a subtype of Object that describes some form of action that may happen, is currently happening, or has already happened. The Activity type itself serves as an abstract base type for all types of activities. It is important to note that the Activity type itself does not carry any specific semantics about the kind of action being taken.
Indicates that the actor
has added the object
to the target
.
If the target
property is not explicitly specified, the target would need
to be determined implicitly by context. The origin
can be used to identify
the context from which the object
originated.
Indicates that the actor
is calling the target
's attention the object
.
Describes a software application.
An IntransitiveActivity
that indicates that the actor
has arrived at the location
.
The origin
can be used to identify the context from which the actor
originated.
The target
typically has no defined meaning.
Represents any kind of multi-paragraph written work.
Represents an audio document of any kind.
ChatMessage
s are the messages sent in 1-on-1 chats. They are similar to
Notes, but the addressing is done by having a single AP actor in
the to
field. Addressing multiple actors is not allowed. These messages
are always private, there is no public version of them. They are created with
a Create activity.
Used to represent distinct subsets of items from a Collection
.
Refer to the Activity Streams 2.0 Core for a complete description of
the CollectionPage
object.
Indicates that the actor
has created the object
.
A proof that can be added to any activity or object, allowing recipients to verify the identity of the actor and the integrity of the data.
Indicates that the actor
has deleted the object
. If specified,
the origin
indicates the context from which the object
was deleted.
Means of communicating or interacting with the DID subject or associated entities via one or more service endpoints. Examples include discovery services, agent services, social networking services, file storage services, and verifiable credential repository services.
Indicates that the actor
dislikes the object
.
Represents a document of any kind.
Represents an emoji reaction. See also FEP-c0e0.
Represents any kind of event.
Indicates that the actor
is "flagging" the object
. Flagging is defined
in the sense common to many social platforms as reporting content as being
inappropriate for any number of reasons.
Indicates that the actor
is "following" the object
. Following is defined
in the sense typically used within Social systems in which the actor is
interested in any activity performed by or on the object. The target
and
origin
typically have no defined meaning.
Represents a formal or informal collective of Actors.
Indicates that the actor
is ignoring the object
. The target
and
origin
typically have no defined meaning.
An image document of any kind.
Instances of IntransitiveActivity
are a subtype of Activity
representing intransitive actions. The object
property is therefore
inappropriate for these activities.
A specialization of Offer
in which the actor
is extending an invitation
for the object
to the target
.
Indicates that the actor
has joined the object
.
The target
and origin
typically have no defined meaning.
Indicates that the actor
has left the object
.
The target
and origin
typically have no meaning.
Indicates that the actor
likes, recommends or endorses the object
.
The target
and origin
typically have no defined meaning.
A Link is an indirect, qualified reference to a resource identified by a URL.
The fundamental model for links is established by RFC 5988. Many of the
properties defined by the Activity Vocabulary allow values that are either
instances of Object or Link. When a Link is used,
it establishes a qualified relation connecting the subject (the containing
object) to the resource identified by the href
. Properties of
the Link are properties of the reference as opposed to properties of
the resource.
Indicates that the actor
has listened to the object
.
Indicates that the actor
has moved object
from origin
to target
.
If the origin
or target
are not specified,
either can be determined by context.
Represents a key owned by an actor according to FEP-521a: Representing actor's public keys.
Represents a short written work typically less than a single paragraph in length.
Describes an object of any kind. The Object type serves as the base type for most of the other kinds of objects defined in the Activity Vocabulary, including other Core types such as Activity, IntransitiveActivity, Collection and OrderedCollection.
Indicates that the actor is offering the object. If specified, the target indicates the entity to which the object is being offered.
A subtype of Collection in which members of the logical collection are assumed to always be strictly ordered.
Used to represent ordered subsets of items from an OrderedCollection
.
Refer to the Activity Streams 2.0 Core for a complete description of
the OrderedCollectionPage
object.
Represents an organization.
Represents an individual person.
Represents a logical or physical location. See 5.3 Representing Places for additional information.
A Profile is a content object that describes another Object, typically used to describe Actor Type objects. The Profile.describes property is used to reference the object being described by the profile.
A pair of property name and value.
Represents a question being asked. Question objects are an extension of
IntransitiveActivity. That is, the Question object is an Activity,
but the direct object is the question itself and therefore it would not
contain an object
property.
Indicates that the actor
has read the object
.
Indicates that the actor
is rejecting the object
. The target
and
origin
typically have no defined meaning.
Describes a relationship between two individuals. The Relationship.subject and Relationship.object properties are used to identify the connected individuals.
Indicates that the actor
is removing the object
. If specified,
the origin
indicates the context from which the object
is being removed.
Represents a service of any kind.
A specialization of Accept indicating that the acceptance is tentative.
A specialization of Reject in which the rejection is considered tentative.
A Tombstone
represents a content object that has been deleted.
It can be used in Collections to signify that there used to be
an object at this position, but it has been deleted.
Indicates that the actor
is traveling to target
from origin
.
Travel
is an IntransitiveObject
whose actor
specifies the direct object.
If the target
or origin
are not specified,
either can be determined by context.
Indicates that the actor
has updated the object
. Note, however,
that this vocabulary does not define a mechanism for describing the actual
set of modifications made to object
.
Represents a video document of any kind.
Indicates that the actor
has viewed the object.
Gets the actor class by the given type name.
Gets the actor handle, of the form @username@domain
, from the given actor
or an actor URI.
Gets the type name of the given actor.
Looks up an ActivityStreams object by its URI (including acct:
URIs)
or a fediverse handle (e.g., @user@server
or user@server
).
Normalizes the given actor handle.
Traverses a collection, yielding each item in the collection. If the collection is paginated, it will fetch the next page automatically.
A string representation of an actor type name.
The special public collection for public addressing. Do not mutate this object.
Add Package
deno add jsr:@fedify/fedify
Import symbol
import * as mod from "@fedify/fedify/vocab";
---- OR ----
Import directly with a jsr specifier
import * as mod from "jsr:@fedify/fedify/vocab";
Add Package
npx jsr add @fedify/fedify
Import symbol
import * as mod from "@fedify/fedify/vocab";
Add Package
yarn dlx jsr add @fedify/fedify
Import symbol
import * as mod from "@fedify/fedify/vocab";
Add Package
pnpm dlx jsr add @fedify/fedify
Import symbol
import * as mod from "@fedify/fedify/vocab";
Add Package
bunx jsr add @fedify/fedify
Import symbol
import * as mod from "@fedify/fedify/vocab";