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

@fedify/fedify@1.3.0-dev.477+5c1eaa6b
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 (1.3.0-dev.477+5c1eaa6b)
class Object

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.

Constructors

new
Object(
values: { id?: URL | null; attachments?: ()[]; attribution?: ; attributions?: ()[]; audience?:
Object
| URL
| null
; audiences?: (Object | URL)[]; content?: ; contents?: ((string | LanguageString))[]; contexts?: ()[]; name?: ; names?: ((string | LanguageString))[]; endTime?: Temporal.Instant | null; generators?: ()[]; icon?:
Image
| URL
| null
; icons?: (Image | URL)[]; image?:
Image
| URL
| null
; images?: (Image | URL)[]; replyTarget?:
Object
| Link
| URL
| null
; replyTargets?: ()[]; location?:
Object
| Link
| URL
| null
; locations?: ()[]; preview?:
Link
| Object
| URL
| null
; previews?: ()[]; published?: Temporal.Instant | null; replies?:
Collection
| URL
| null
; startTime?: Temporal.Instant | null; summary?: ; summaries?: ((string | LanguageString))[]; tags?: ()[]; updated?: Temporal.Instant | null; url?:
URL
| Link
| null
; urls?: ((URL | Link))[]; to?:
Object
| URL
| null
; tos?: (Object | URL)[]; bto?:
Object
| URL
| null
; btos?: (Object | URL)[]; cc?:
Object
| URL
| null
; ccs?: (Object | URL)[]; bcc?:
Object
| URL
| null
; bccs?: (Object | URL)[]; mediaType?: string | null; duration?: Temporal.Duration | null; sensitive?: boolean | null; source?: Source | null; proof?: ; proofs?: (DataIntegrityProof | URL)[]; }
,
unnamed 1?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; },
)

Constructs a new instance of Object with the given values.

Properties

protected
readonly
_contextLoader: DocumentLoader | undefined
protected
readonly
_documentLoader: DocumentLoader | undefined
readonly
attachmentIds: URL[]

Similar to Object.getAttachments, but returns their @ids instead of the objects themselves.

readonly
attributionId: URL | null

Similar to Object.getAttribution, but returns its @id URL instead of the object itself.

readonly
attributionIds: URL[]

Similar to Object.getAttributions, but returns their @ids instead of the objects themselves.

readonly
audienceId: URL | null

Similar to Object.getAudience, but returns its @id URL instead of the object itself.

readonly
audienceIds: URL[]

Similar to Object.getAudiences, but returns their @ids instead of the objects themselves.

readonly
bccId: URL | null

Similar to Object.getBcc, but returns its @id URL instead of the object itself.

readonly
bccIds: URL[]

Similar to Object.getBccs, but returns their @ids instead of the objects themselves.

readonly
btoId: URL | null

Similar to Object.getBto, but returns its @id URL instead of the object itself.

readonly
btoIds: URL[]

Similar to Object.getBtos, but returns their @ids instead of the objects themselves.

readonly
ccId: URL | null

Similar to Object.getCc, but returns its @id URL instead of the object itself.

readonly
ccIds: URL[]

Similar to Object.getCcs, but returns their @ids instead of the objects themselves.

readonly
content:

The content or textual representation of the Object encoded as a JSON string. By default, the value of content is HTML. The mediaType property can be used in the object to indicate a different content type.

The content MAY be expressed using multiple language-tagged values.

readonly
contents: ((string | LanguageString))[]

The content or textual representation of the Object encoded as a JSON string. By default, the value of content is HTML. The mediaType property can be used in the object to indicate a different content type.

The content MAY be expressed using multiple language-tagged values.

readonly
contextIds: URL[]

Similar to Object.getContexts, but returns their @ids instead of the objects themselves.

readonly
duration: Temporal.Duration | null

When the object describes a time-bound resource, such as an audio or video, a meeting, etc, the duration property indicates the object's approximate duration. The value MUST be expressed as an xsd:duration as defined by W3C XML Schema Definition Language (XSD) 1.1 Part 2: DataTypes, section 3.3.6 (e.g. a period of 5 seconds is represented as PT5S).

readonly
endTime: Temporal.Instant | null

The date and time describing the actual or expected ending time of the object. When used with an Activity object, for instance, the `endTime`` property specifies the moment the activity concluded or is expected to conclude.

readonly
generatorIds: URL[]

Similar to Object.getGenerators, but returns their @ids instead of the objects themselves.

readonly
iconId: URL | null

Similar to Object.getIcon, but returns its @id URL instead of the object itself.

readonly
iconIds: URL[]

Similar to Object.getIcons, but returns their @ids instead of the objects themselves.

readonly
id: URL | null
readonly
imageId: URL | null

Similar to Object.getImage, but returns its @id URL instead of the object itself.

readonly
imageIds: URL[]

Similar to Object.getImages, but returns their @ids instead of the objects themselves.

readonly
locationId: URL | null

Similar to Object.getLocation, but returns its @id URL instead of the object itself.

readonly
locationIds: URL[]

Similar to Object.getLocations, but returns their @ids instead of the objects themselves.

readonly
mediaType: string | null

When used on an Object, identifies the MIME media type of the value of the content property. If not specified, the content property is assumed to contain text/html content.

readonly
name:

A simple, human-readable, plain-text name for the object. HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.

readonly
names: ((string | LanguageString))[]

A simple, human-readable, plain-text name for the object. HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.

readonly
previewId: URL | null

Similar to Object.getPreview, but returns its @id URL instead of the object itself.

readonly
previewIds: URL[]

Similar to Object.getPreviews, but returns their @ids instead of the objects themselves.

readonly
proofId: URL | null

Similar to Object.getProof, but returns its @id URL instead of the object itself.

readonly
proofIds: URL[]

Similar to Object.getProofs, but returns their @ids instead of the objects themselves.

readonly
published: Temporal.Instant | null

The date and time at which the object was published.

readonly
repliesId: URL | null

Similar to Object.getReplies, but returns its @id URL instead of the object itself.

readonly
replyTargetId: URL | null

Similar to Object.getReplyTarget, but returns its @id URL instead of the object itself.

readonly
replyTargetIds: URL[]

Similar to Object.getReplyTargets, but returns their @ids instead of the objects themselves.

readonly
sensitive: boolean | null

Whether it contains any sensitive contents.

readonly
source: Source | null

The source property is intended to convey some sort of source from which the content markup was derived, as a form of provenance, or to support future editing by clients. In general, clients do the conversion from source to content, not the other way around.

readonly
startTime: Temporal.Instant | null

The date and time describing the actual or expected starting time of the object. When used with an Activity object, for instance, the startTime property specifies the moment the activity began or is scheduled to begin.

A natural language summarization of the object encoded as HTML. Multiple language tagged summaries MAY be provided.

readonly
summary:

A natural language summarization of the object encoded as HTML. Multiple language tagged summaries MAY be provided.

readonly
tagIds: URL[]

Similar to Object.getTags, but returns their @ids instead of the objects themselves.

readonly
toId: URL | null

Similar to Object.getTo, but returns its @id URL instead of the object itself.

readonly
toIds: URL[]

Similar to Object.getTos, but returns their @ids instead of the objects themselves.

readonly
updated: Temporal.Instant | null

The date and time at which the object was updated.

readonly
url:
URL
| Link
| null

Identifies one or more links to representations of the object.

readonly
urls: ((URL | Link))[]

Identifies one or more links to representations of the object.

Methods

[Symbol.for("nodejs.util.inspect.custom")](
_depth: number,
options: unknown,
inspect: (
value: unknown,
options: unknown,
) => string
,
): string
protected
_getCustomInspectProxy(): Record<string, unknown>
clone(
values?: { id?: URL | null; attachments?: ()[]; attribution?: ; attributions?: ()[]; audience?:
Object
| URL
| null
; audiences?: (Object | URL)[]; content?: ; contents?: ((string | LanguageString))[]; contexts?: ()[]; name?: ; names?: ((string | LanguageString))[]; endTime?: Temporal.Instant | null; generators?: ()[]; icon?:
Image
| URL
| null
; icons?: (Image | URL)[]; image?:
Image
| URL
| null
; images?: (Image | URL)[]; replyTarget?:
Object
| Link
| URL
| null
; replyTargets?: ()[]; location?:
Object
| Link
| URL
| null
; locations?: ()[]; preview?:
Link
| Object
| URL
| null
; previews?: ()[]; published?: Temporal.Instant | null; replies?:
Collection
| URL
| null
; startTime?: Temporal.Instant | null; summary?: ; summaries?: ((string | LanguageString))[]; tags?: ()[]; updated?: Temporal.Instant | null; url?:
URL
| Link
| null
; urls?: ((URL | Link))[]; to?:
Object
| URL
| null
; tos?: (Object | URL)[]; bto?:
Object
| URL
| null
; btos?: (Object | URL)[]; cc?:
Object
| URL
| null
; ccs?: (Object | URL)[]; bcc?:
Object
| URL
| null
; bccs?: (Object | URL)[]; mediaType?: string | null; duration?: Temporal.Duration | null; sensitive?: boolean | null; source?: Source | null; proof?: ; proofs?: (DataIntegrityProof | URL)[]; }
,
options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; },
): Object

Clones this instance, optionally updating it with the given values.

getAttachments(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<>

Identifies a resource attached or related to an object that potentially requires special handling. The intent is to provide a model that is at least semantically similar to attachments in email.

getAttribution(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<>

Identifies one or more entities to which this object is attributed. The attributed entities might not be Actors. For instance, an object might be attributed to the completion of another activity.

getAttributions(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<>

Identifies one or more entities to which this object is attributed. The attributed entities might not be Actors. For instance, an object might be attributed to the completion of another activity.

getAudience(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<Object | null>

Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.

getAudiences(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object>

Identifies one or more entities that represent the total population of entities for which the object can considered to be relevant.

getBcc(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<Object | null>

Identifies one or more Objects that are part of the private secondary audience of this Object.

getBccs(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object>

Identifies one or more Objects that are part of the private secondary audience of this Object.

getBto(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<Object | null>

Identifies an Object that is part of the private primary audience of this Object.

getBtos(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object>

Identifies an Object that is part of the private primary audience of this Object.

getCc(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<Object | null>

Identifies an Object that is part of the public secondary audience of this Object.

getCcs(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object>

Identifies an Object that is part of the public secondary audience of this Object.

getContexts(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object | Link>

Identifies the context within which the object exists or an activity was performed.

The notion of "context" used is intentionally vague. The intended function is to serve as a means of grouping objects and activities that share a common originating context or purpose. An example could be all activities relating to a common project or event.

getGenerators(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object | Link>

Identifies the entity (e.g. an application) that generated the object.

getIcon(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<Image | null>

Indicates an entity that describes an icon for this object. The image should have an aspect ratio of one (horizontal) to one (vertical) and should be suitable for presentation at a small size.

getIcons(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Image>

Indicates an entity that describes an icon for this object. The image should have an aspect ratio of one (horizontal) to one (vertical) and should be suitable for presentation at a small size.

getImage(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<Image | null>

Indicates an entity that describes an image for this object. Unlike the icon property, there are no aspect ratio or display size limitations assumed.

getImages(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Image>

Indicates an entity that describes an image for this object. Unlike the icon property, there are no aspect ratio or display size limitations assumed.

getLocation(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<
Object
| Link
| null
>

Indicates one or more physical or logical locations associated with the object.

getLocations(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object | Link>

Indicates one or more physical or logical locations associated with the object.

getPreview(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<
Link
| Object
| null
>

Identifies an entity that provides a preview of this object.

getPreviews(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Link | Object>

Identifies an entity that provides a preview of this object.

getProof(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<DataIntegrityProof | null>

A cryptographic proof that can be used to verify the integrity of an object.

getProofs(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<DataIntegrityProof>

A cryptographic proof that can be used to verify the integrity of an object.

getReplies(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<Collection | null>

Identifies a Collection containing objects considered to be responses to this object.

getReplyTarget(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<
Object
| Link
| null
>

Indicates one or more entities for which this object is considered a response.

getReplyTargets(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object | Link>

Indicates one or more entities for which this object is considered a response.

getTags(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object | Link>

One or more "tags" that have been associated with an objects. A tag can be any kind of Object. The key difference between attachment and tag is that the former implies association by inclusion, while the latter implies associated by reference.

getTo(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): Promise<Object | null>

Identifies an entity considered to be part of the public primary audience of an Object.

getTos(options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; suppressError?: boolean; }): AsyncIterable<Object>

Identifies an entity considered to be part of the public primary audience of an Object.

toJsonLd(options?: { format?: "compact" | "expand"; contextLoader?: DocumentLoader; context?:
string
| Record<string, string>
| (string | Record<string, string>)[]
; }
): Promise<unknown>

Converts this object to a JSON-LD structure.

Static Properties

readonly
typeId: URL

The type URI of Object: https://www.w3.org/ns/activitystreams#Object.

Static Methods

fromJsonLd(
json: unknown,
options?: { documentLoader?: DocumentLoader; contextLoader?: DocumentLoader; },
): Promise<Object>

Converts a JSON-LD structure to an object of this type.

Add Package

deno add jsr:@fedify/fedify

Import symbol

import { Object } from "@fedify/fedify";

---- OR ----

Import directly with a jsr specifier

import { Object } from "jsr:@fedify/fedify";

Add Package

npx jsr add @fedify/fedify

Import symbol

import { Object } from "@fedify/fedify";

Add Package

yarn dlx jsr add @fedify/fedify

Import symbol

import { Object } from "@fedify/fedify";

Add Package

pnpm dlx jsr add @fedify/fedify

Import symbol

import { Object } from "@fedify/fedify";

Add Package

bunx jsr add @fedify/fedify

Import symbol

import { Object } from "@fedify/fedify";