@graffiti-garden/api
    Preparing search index...

    Interface GraffitiObjectBase

    Objects are the atomic unit in Graffiti that can represent both data (e.g. a social media post or profile) and activities (e.g. a like or follow). Objects are created and modified by a single actor.

    Most of an object's content is stored in its value property, which can be any JSON object. However, we recommend using properties from the Activity Vocabulary or properties that emerge in the Graffiti folksonomy to promote interoperability.

    The object is globally addressable via its url.

    The channels and allowed properties enable the object's creator to shape the visibility of and access to their object.

    The lastModified property can be used to compare object versions.

    interface GraffitiObjectBase {
        value: {};
        channels: string[];
        allowed?: string[] | null;
        actor: string;
        url: string;
        lastModified: number;
    }
    Index

    Properties

    value: {}

    The object's content as freeform JSON. We recommend using properties from the Activity Vocabulary or properties that emerge in the Graffiti folksonomy to promote interoperability.

    channels: string[]

    An array of URIs the creator associates with the object. Objects can only be found by querying one of the object's channels using the Graffiti.discover method. This allows creators to express the intended audience of their object which helps to prevent context collapse even in the highly interoperable ecosystem that Graffiti envisions. For example, channel URIs may be:

    • A actor's own actor URI. Putting an object in this channel is a way to broadcast the object to the actor's followers, like posting a tweet.
    • The URL of a Graffiti post. Putting an object in this channel is a way to broadcast to anyone viewing the post, like commenting on a tweet.
    • A URI representing a topic. Putting an object in this channel is a way to broadcast to anyone interested in that topic, like posting in a subreddit.
    allowed?: string[] | null

    An optional array of actor URIs that the creator allows to access the object. If no allowed array is provided, the object can be accessed by anyone (so long as they also know the right channel to look in). An object can always be accessed by its creator, even if the allowed array is empty.

    The allowed array is not revealed to actors other than the creator, like a BCC email. An actor may choose to add a to property to the object's value to indicate other recipients, however this is not enforced by Graffiti and may not accurately reflect the actual allowed array.

    allowed can be combined with channels. For example, to send someone a direct message the sender should put their object in the channel of the recipient's actor URI to notify them of the message and also add the recipient's actor URI to the allowed array to prevent others from seeing the message.

    actor: string

    The URI of the actor that created the object. This actor also has the unique permission to modify or delete the object.

    We borrow the term actor from the ActivityPub because like in ActivityPub there is not necessarily a one-to-one mapping between actors and people/users. Multiple people can share the same actor or one person can have multiple actors. Actors can also be bots.

    In Graffiti, actors are always globally unique URIs which allows them to also function as channels.

    url: string

    A globally unique identifier and locator for the object. It can be used to point to an object or to retrieve the object directly with Graffiti.get. If an object is put with the same URL as an existing object, the existing object will be replaced with the new object.

    An object's URL is generated when the object is first created and should include sufficient randomness to prevent collisions and guessing. The URL starts with a "scheme," just like web URLs start with http or https, to indicate to indicate the particular Graffiti implementation. This allows for applications to pull from multiple coexisting Graffiti implementations without collision. Existing schemes include graffiti:local: for objects stored locally (see the local implementation) and graffiti:remote: for objects stored on Graffiti-specific web servers (see the remote implementation) Options available in the future might include graffiti:solid: for objects stored on Solid servers or graffiti:p2p: for objects stored on a peer-to-peer network.

    lastModified: number

    A number used to compare different versions of an object that has been updated via replacement (see Graffiti.put) or patch (see Graffiti.patch). Newer versions of an object have larger revision values than older versions. The revision can only be used to compare different versions of the same object, but cannot reliably be used to compare different objects. In cases where comparing different objects by time is useful, you could instead add createdAt or lastModified timestamp properties to an object's value.

    Depending on the implementation, the revision may be a timestamp, an incremental counter, may include randomness for obfuscation, and so on. Be careful not to rely on any of these specific revision instantiations as they may not be consistent across different implementations.