kopia lustrzana https://github.com/activitypub-js/activitypub-models
add Activity types
rodzic
f93f5deb2f
commit
e7ad5082f2
|
@ -18,17 +18,23 @@ export type Mention = 'placeholder';
|
|||
export type AnyASObject = ASObject | Article | Audio | Document | Event | Image | Note | Page | Place | Profile | Relationship | Tombstone | Video;
|
||||
export type DateTime = string;
|
||||
export type Duration = string;
|
||||
export type UrlField = string | Link;
|
||||
export type IconField = string | Image | Link;
|
||||
export type ImageField = string | Image | Link;
|
||||
export type AttachmentField = string | AnyASObject | Link;
|
||||
export type AudienceField = string | AnyASObject | Link;
|
||||
export type InReplyToField = string | AnyASObject | Link;
|
||||
export type LocationField = string | AnyASObject | Link;
|
||||
export type PreviewField = string | AnyASObject | Link;
|
||||
export type ToField = string | AnyASObject | Link;
|
||||
export type BtoField = string | AnyASObject | Link;
|
||||
export type CcField = string | AnyASObject | Link;
|
||||
export type BccField = string | AnyASObject | Link;
|
||||
export type AttributedToField = string | AnyASObject | Link | Mention;
|
||||
export type TagField = string | AnyASObject | Link | Mention;
|
||||
export type UrlValue = string | Link;
|
||||
export type IconValue = string | Image | Link;
|
||||
export type ImageValue = string | Image | Link;
|
||||
export type AttachmentValue = string | AnyASObject | Link;
|
||||
export type AudienceValue = string | AnyASObject | Link;
|
||||
export type InReplyToValue = string | AnyASObject | Link;
|
||||
export type LocationValue = string | Place | Link;
|
||||
export type PreviewValue = string | AnyASObject | Link;
|
||||
export type ToValue = string | AnyASObject | Link;
|
||||
export type BtoValue = string | AnyASObject | Link;
|
||||
export type CcValue = string | AnyASObject | Link;
|
||||
export type BccValue = string | AnyASObject | Link;
|
||||
export type ObjectValue = string | AnyASObject | Link;
|
||||
export type AttributedToValue = string | AnyASObject | Link | Mention;
|
||||
export type TagValue = string | AnyASObject | Link | Mention;
|
||||
export type ActorValue = string | ASObject | Link;
|
||||
export type TargetValue = string | ASObject | Link;
|
||||
export type ResultValue = string | ASObject | Link;
|
||||
export type OriginValue = string | ASObject | Link;
|
||||
export type InstrumentValue = string | ASObject | Link;
|
|
@ -1,14 +0,0 @@
|
|||
import {ASBase} from "./ASBase.model";
|
||||
import {IntransitiveActivityFields} from "./IntransitiveActivity.model";
|
||||
|
||||
// TODO: types
|
||||
// https://www.w3.org/TR/activitystreams-core/#activities
|
||||
export interface ActivityFields extends IntransitiveActivityFields {
|
||||
object?: any; // Object?
|
||||
}
|
||||
|
||||
export class Activity extends ASBase<ActivityFields>{
|
||||
constructor(fields: ActivityFields) {
|
||||
super(fields);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import {ASBase} from "../ASBase.model";
|
||||
import { ActivityFields } from "./Activity.types";
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#Activity Docs}
|
||||
*/
|
||||
export class Activity extends ASBase<ActivityFields>{
|
||||
constructor(fields: ActivityFields) {
|
||||
super(fields);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
import {ASObjectFields} from "../asObject/ASObject.types";
|
||||
import {
|
||||
ActorValue,
|
||||
InstrumentValue,
|
||||
ObjectValue,
|
||||
OriginValue,
|
||||
ResultValue,
|
||||
TargetValue
|
||||
} from "../../common/common.types";
|
||||
|
||||
export interface ActivityFields extends ASObjectFields {
|
||||
|
||||
/**
|
||||
* Describes one or more entities that either performed or are expected to perform the activity.
|
||||
* Any single activity can have multiple actors. The actor MAY be specified using an indirect Link.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#actor Docs}
|
||||
*/
|
||||
actor?: ActorValue | ActorValue[];
|
||||
|
||||
/**
|
||||
* When used within an Activity, describes the direct object of the activity.
|
||||
* For instance, in the activity "John added a movie to his wishlist",
|
||||
* the object of the activity is the movie added.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#object Docs}
|
||||
*/
|
||||
object?: ObjectValue | ObjectValue[];
|
||||
|
||||
/**
|
||||
* Describes the indirect object, or target, of the activity. The precise meaning of the target is largely dependent
|
||||
* on the type of action being described but will often be the object of the English preposition "to".
|
||||
* For instance, in the activity "John added a movie to his wishlist", the target of the activity
|
||||
* is John's wishlist. An activity can have more than one target.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#target Docs}
|
||||
*/
|
||||
target?: TargetValue | TargetValue[];
|
||||
|
||||
/**
|
||||
* Describes the result of the activity. For instance, if a particular action results
|
||||
* in the creation of a new resource, the result property can be used to describe that new resource.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#result Docs}
|
||||
*/
|
||||
result?: ResultValue | ResultValue[];
|
||||
|
||||
/**
|
||||
* Describes an indirect object of the activity from which the activity is directed.
|
||||
* The precise meaning of the origin is the object of the English preposition "from".
|
||||
* For instance, in the activity "John moved an item to List B from List A",
|
||||
* the origin of the activity is "List A".
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#origin Docs}
|
||||
*/
|
||||
origin?: OriginValue | OriginValue[];
|
||||
|
||||
/**
|
||||
* Identifies one or more objects used (or to be used)
|
||||
* in the completion of an Activity.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#instrument Docs}
|
||||
*/
|
||||
instrument?: InstrumentValue | InstrumentValue[];
|
||||
}
|
|
@ -4,20 +4,20 @@ import { ASObject } from "./ASObject.model";
|
|||
import {
|
||||
DateTime,
|
||||
Duration,
|
||||
UrlField,
|
||||
IconField,
|
||||
ImageField,
|
||||
AttachmentField,
|
||||
AudienceField,
|
||||
InReplyToField,
|
||||
LocationField,
|
||||
PreviewField,
|
||||
ToField,
|
||||
BtoField,
|
||||
CcField,
|
||||
BccField,
|
||||
AttributedToField,
|
||||
TagField,
|
||||
UrlValue,
|
||||
IconValue,
|
||||
ImageValue,
|
||||
AttachmentValue,
|
||||
AudienceValue,
|
||||
InReplyToValue,
|
||||
LocationValue,
|
||||
PreviewValue,
|
||||
ToValue,
|
||||
BtoValue,
|
||||
CcValue,
|
||||
BccValue,
|
||||
AttributedToValue,
|
||||
TagValue,
|
||||
} from "../../common/common.types";
|
||||
|
||||
// TODO: types
|
||||
|
@ -45,7 +45,7 @@ export interface ASObjectFields {
|
|||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#attachment Docs}
|
||||
*/
|
||||
attachment?: AttachmentField | AttachmentField[];
|
||||
attachment?: AttachmentValue | AttachmentValue[];
|
||||
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ export interface ASObjectFields {
|
|||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#attributedTo Docs}
|
||||
*/
|
||||
attributedTo?: AttributedToField | AttributedToField[];
|
||||
attributedTo?: AttributedToValue | AttributedToValue[];
|
||||
|
||||
/**
|
||||
* Identifies one or more entities that represent the total population of entities
|
||||
|
@ -63,7 +63,7 @@ export interface ASObjectFields {
|
|||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#audience Docs}
|
||||
*/
|
||||
audience?: AudienceField | AudienceField[];
|
||||
audience?: AudienceValue | AudienceValue[];
|
||||
|
||||
// TODO: only content or contentMap at one time
|
||||
|
||||
|
@ -167,7 +167,7 @@ export interface ASObjectFields {
|
|||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#icon Docs}
|
||||
*/
|
||||
icon?: IconField | IconField[];
|
||||
icon?: IconValue | IconValue[];
|
||||
|
||||
/**
|
||||
* Indicates an entity that describes an image for this object.
|
||||
|
@ -175,28 +175,28 @@ export interface ASObjectFields {
|
|||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#image Docs}
|
||||
*/
|
||||
image?: ImageField | ImageField[];
|
||||
image?: ImageValue | ImageValue[];
|
||||
|
||||
/**
|
||||
* Indicates one or more entities for which this object is considered a response.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#inReplyTo Docs}
|
||||
*/
|
||||
inReplyTo?: InReplyToField | InReplyToField[];
|
||||
inReplyTo?: InReplyToValue | InReplyToValue[];
|
||||
|
||||
/**
|
||||
* Indicates one or more physical or logical locations associated with the object.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#location Docs}
|
||||
*/
|
||||
location?: LocationField | LocationField[];
|
||||
location?: LocationValue | LocationValue[];
|
||||
|
||||
/**
|
||||
* Identifies an entity that provides a preview of this object.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#preview Docs}
|
||||
*/
|
||||
preview?: PreviewField;
|
||||
preview?: PreviewValue;
|
||||
|
||||
/**
|
||||
* The date and time at which the object was published.
|
||||
|
@ -248,7 +248,7 @@ export interface ASObjectFields {
|
|||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#tag Docs}
|
||||
*/
|
||||
tag?: TagField | TagField[];
|
||||
tag?: TagValue | TagValue[];
|
||||
|
||||
/**
|
||||
* The date and time at which the object was updated.
|
||||
|
@ -271,35 +271,35 @@ export interface ASObjectFields {
|
|||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#url Docs}
|
||||
*/
|
||||
url?: UrlField | UrlField[];
|
||||
url?: UrlValue | UrlValue[];
|
||||
|
||||
/**
|
||||
* Identifies an entity or entities considered to be part of the public primary audience of an Object.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#to Docs}
|
||||
*/
|
||||
to?: ToField | ToField[];
|
||||
to?: ToValue | ToValue[];
|
||||
|
||||
/**
|
||||
* Identifies an Object that is part of the private primary audience of this Object.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#bto Docs}
|
||||
*/
|
||||
bto?: BtoField | BtoField[];
|
||||
bto?: BtoValue | BtoValue[];
|
||||
|
||||
/**
|
||||
* Identifies an Object that is part of the public secondary audience of this Object.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#cc Docs}
|
||||
*/
|
||||
cc?: CcField | CcField[];
|
||||
cc?: CcValue | CcValue[];
|
||||
|
||||
/**
|
||||
* Identifies one or more Objects that are part of the private secondary audience of this Object.
|
||||
*
|
||||
* {@link https://www.w3.org/ns/activitystreams#bcc Docs}
|
||||
*/
|
||||
bcc?: BccField | BccField[];
|
||||
bcc?: BccValue | BccValue[];
|
||||
|
||||
/**
|
||||
* When the object describes a time-bound resource, such as an audio or video, a meeting, etc.,
|
||||
|
|
Ładowanie…
Reference in New Issue