Activity Streams Models (#1)

* add types for ASObject & refactor

* fix order

* add ASObject description

* add Activity types

* add IntransitiveActivity types

* add ModelType enum

* rename dir

* add Application types

* add Article, Document, Event, Group and Note types

* add Organization, Person and Service types

* clean up

* update AnyASObject type

* Add Audio, Image, Page and Video types

* Add Place, Question and Relationship types

* Add Profile and Tombstone types. Refactor ASObject types

* Add Link types and refactor

* Move asBase to directory

* Add Mention types and fix Link

* Add Collection, CollectionPage, OrderedCollection and OrderedCollectionPage types

* fix and refactor
pull/3/head
Kirill 2022-10-30 23:32:42 +03:00 zatwierdzone przez GitHub
rodzic 9ef1d17b68
commit 79f67b63b9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
69 zmienionych plików z 1479 dodań i 202 usunięć

Wyświetl plik

@ -0,0 +1,3 @@
export const contexts = {
activityStreamsV2: 'https://www.w3.org/ns/activitystreams'
}

Wyświetl plik

@ -0,0 +1,128 @@
import {ASObject} from "../models/asObject/ASObject.model";
import {Collection} from "../models/collection/Collection.model";
import {OrderedCollection} from "../models/orderedCollection/OrderedCollection.model";
import {Article} from "../models/article/Article.model";
import {Audio} from "../models/audio/Audio.model";
import {Document} from "../models/document/Document.model";
import {ASEvent} from "../models/asEvent/ASEvent.model";
import {Image} from "../models/image/Image.model";
import {Note} from "../models/note/Note.model";
import {Page} from "../models/page/Page.model";
import {Place} from "../models/place/Place.model";
import {Profile} from "../models/profile/Profile.model";
import {Relationship} from "../models/relationship/Relationship.model";
import {Tombstone} from "../models/tombstone/Tombstone.model";
import {Video} from "../models/video/Video.model";
import {Link} from "../models/link/Link.model";
import {Mention} from "../models/mention/Mention.model";
import {CollectionPage} from "../models/collectionPage/CollectionPage.model";
import {OrderedCollectionPage} from "../models/orderedCollectionPage/OrderedCollectionPage.model";
export enum ASModelType {
Object = 'Object',
Activity = 'Activity',
Application = 'Application',
Article = 'Article',
Document = 'Document',
Event = 'Event',
Group = 'Group',
Note = 'Note',
Organization = 'Organization',
Person = 'Person',
Service = 'Service',
Audio = 'Audio',
Image = 'Image',
Page = 'Page',
Video = 'Video',
Place = 'Place',
Relationship = 'Relationship',
Question = 'Question',
Tombstone = 'Tombstone',
Profile = 'Profile',
Link = 'Link',
Mention = 'Mention',
Collection = 'Collection',
CollectionPage = 'CollectionPage',
OrderedCollection = 'OrderedCollection',
OrderedCollectionPage = 'OrderedCollectionPage',
}
export type AnyCollection = Collection | OrderedCollection;
export type AnyASObject = ASObject | Article | Audio | Document | ASEvent | Image | Note | Page | Place | Profile | Relationship | Tombstone | Video | AnyCollection;
export type DateTime = string;
export type LanguageTag = string;
export type MediaType = string;
export type Duration = string;
export type UrlValue = string | Link;
export type IdValue = string;
export type TypeValue = string;
export type DurationValue = Duration;
export type ContentValue = string;
export type ContentMapValue = Record<string, string>;
export type MediaTypeValue = MediaType;
export type NameValue = string;
export type NameMapValue = Record<string, string>;
export type SummaryValue = string;
export type SummaryMapValue = Record<string, string>;
export type EndTimeValue = DateTime;
export type StartTimeValue = DateTime;
export type PublishedValue = DateTime;
export type UpdatedValue = DateTime;
export type RepliesValue = string | AnyCollection;
export type RelationshipValue = string | AnyASObject;
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 GeneratorValue = 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 | AnyASObject | Link;
export type TargetValue = string | AnyASObject | Link;
export type ResultValue = string | AnyASObject | Link;
export type OriginValue = string | AnyASObject | Link;
export type InstrumentValue = string | AnyASObject | Link;
export type OneOfValue = string | AnyASObject | Link;
export type AnyOfValue = string | AnyASObject | Link;
export type SubjectValue = string | AnyASObject | Link;
export type AccuracyValue = number;
export type AltitudeValue = number;
export type LatitudeValue = number;
export type LongitudeValue = number;
export type RadiusValue = number;
export type UnitsValue = 'cm' | 'feet' | 'inches' | 'km' | 'm' | 'miles' | string;
export type ClosedValue = string | AnyASObject | Link | DateTime | boolean;
export type FormerTypeValue = string;
export type DeletedValue = DateTime;
export type DescribesValue = string | AnyASObject;
export type HrefValue = string;
export type HreflangValue = LanguageTag;
export type RelValue = string;
export type HeightValue = number;
export type WidthValue = number;
export type TotalItemsValue = number;
export type CollectionCurrentValue = string | CollectionPage | Link;
export type CollectionFirstValue = string | CollectionPage | Link;
export type CollectionLastValue = string | CollectionPage | Link;
export type CollectionItemsValue = string | CollectionPage | Link;
export type CollectionPagePartOfValue = string | Collection | Link;
export type CollectionPageNextValue = string | Collection | Link;
export type CollectionPagePrevValue = string | Collection | Link;
export type OrderedCollectionCurrentValue = string | OrderedCollectionPage | Link;
export type OrderedCollectionFirstValue = string | OrderedCollectionPage | Link;
export type OrderedCollectionLastValue = string | OrderedCollectionPage | Link;
export type OrderedCollectionItemsValue = string | OrderedCollectionPage | Link;
export type OrderedCollectionPagePartOfValue = string | OrderedCollection | Link;
export type OrderedCollectionPageNextValue = string | OrderedCollection | Link;
export type OrderedCollectionPagePrevValue = string | OrderedCollection | Link;
export type StartIndexValue = number;

Wyświetl plik

@ -0,0 +1 @@
export type Modify<T, R> = Omit<T, keyof R> & R;

Wyświetl plik

@ -1,12 +1 @@
import { ASObject } from './models/ASObject.model';
const obj = new ASObject({
id: 'someId',
});
const obj2 = new ASObject({
cc: '123',
content: obj,
}).addContext();
console.log(obj2.plain());
console.log(obj2.json());

Wyświetl plik

@ -1,16 +0,0 @@
import { ASObject, ASObjectFields } from "./ASObject.model";
// TODO: types
// https://www.w3.org/TR/activitystreams-core/#collection
export interface ASCollectionBaseFields extends ASObjectFields {
totalItems?: any;
first?: any;
last?: any;
current?: any;
}
export class ASCollectionBase extends ASObject {
constructor(fields: ASCollectionBaseFields) {
super(fields);
}
}

Wyświetl plik

@ -1,41 +0,0 @@
import {ASBase} from "./ASBase.model";
// TODO: types
// https://www.w3.org/TR/activitystreams-core/#object
export interface ASObjectFields {
/** @remarks Example remark for id */
id?: any;
type?: any;
attachment?: any;
attributedTo?: any;
audience?: any;
content?: any;
name?: any;
endTime?: any;
generator?: any;
icon?: any;
image?: any; // Link?
inReplyTo?: any;
location?: any;
preview?: any;
published?: any;
replies?: any;
startTime?: any;
summary?: any;
tag?: any;
updated?: any;
url?: any;
to?: any;
bto?: any;
cc?: any;
bcc?: any;
mediaType?: any;
duration?: any;
}
export class ASObject extends ASBase<ASObjectFields>{
constructor(fields: ASObjectFields) {
super(fields);
}
}

Wyświetl plik

@ -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);
}
}

Wyświetl plik

@ -1,22 +0,0 @@
import {ASBase} from "./ASBase.model";
import {ASObjectFields} from "./ASObject.model";
export enum ActorTypes {
Application = 'Application',
Group = 'Group',
Organization = 'Organization',
Person = 'Person',
Service = 'Service'
}
// TODO: types
// https://www.w3.org/TR/activitystreams-core/#actors
export interface ActorFields extends ASObjectFields {
type?: any | ActorTypes; // ?
}
export class Actor extends ASBase<ActorFields>{
constructor(fields: ActorFields) {
super(fields);
}
}

Wyświetl plik

@ -1,13 +0,0 @@
import {ASCollectionBase, ASCollectionBaseFields} from "./ASCollectionBase.model";
// TODO: types
// https://www.w3.org/TR/activitystreams-core/#collection
export interface CollectionFields extends ASCollectionBaseFields {
items?: any; // Objects? Links?
}
export class Collection extends ASCollectionBase {
constructor(fields: CollectionFields) {
super(fields);
}
}

Wyświetl plik

@ -1,18 +0,0 @@
import {ASCollectionBase, ASCollectionBaseFields} from "./ASCollectionBase.model";
// TODO: types
// https://www.w3.org/TR/activitystreams-core/#collection
export interface CollectionPageFields extends ASCollectionBaseFields {
partOf?: any;
first?: any;
next?: any;
prev?: any;
last?: any;
current?: any;
}
export class CollectionPage extends ASCollectionBase {
constructor(fields: CollectionPageFields) {
super(fields);
}
}

Wyświetl plik

@ -1,18 +0,0 @@
import {ASBase} from "./ASBase.model";
import {ASObjectFields} from "./ASObject.model";
// TODO: types
// https://www.w3.org/TR/activitystreams-core/#intransitiveactivities
export interface IntransitiveActivityFields extends ASObjectFields {
actor?: any; // Actor?
target?: any;
origin?: any;
result?: any;
instrument?: any;
}
export class IntransitiveActivity extends ASBase<IntransitiveActivityFields>{
constructor(fields: IntransitiveActivityFields) {
super(fields);
}
}

Wyświetl plik

@ -1,19 +0,0 @@
import {ASBase} from "./ASBase.model";
// TODO: types
// https://www.w3.org/TR/activitystreams-core/#dfn-link
export interface LinkFields {
id?: any;
name?: any;
hreflang?: any;
mediaType?: any;
rel?: any;
height?: any;
width?: any;
}
export class Link extends ASBase<LinkFields>{
constructor(fields: LinkFields) {
super(fields);
}
}

Wyświetl plik

@ -1,14 +0,0 @@
import {ASCollectionBase, ASCollectionBaseFields} from "./ASCollectionBase.model";
// TODO: types
// https://www.w3.org/TR/activitystreams-core/#collection
export interface OrderedCollectionFields extends ASCollectionBaseFields {
orderedItems?: any; // Objects? Links?
}
// TODO: sort method?
export class OrderedCollection extends ASCollectionBase {
constructor(fields: OrderedCollectionFields) {
super(fields);
}
}

Wyświetl plik

@ -1,14 +0,0 @@
import {CollectionPage, CollectionPageFields} from "./CollectionPage.model";
// TODO: types
// TODO: is it correct?
// https://www.w3.org/TR/activitystreams-core/#collection
export interface OrderedCollectionPageFields extends CollectionPageFields {
startIndex?: any;
}
export class OrderedCollectionPage extends CollectionPage {
constructor(fields: OrderedCollectionPageFields) {
super(fields);
}
}

Wyświetl plik

@ -0,0 +1,20 @@
import {ASBase} from "../asBase/ASBase.model";
import { ActivityFields } from "./Activity.types";
import {ASModelType} from "../../common/common.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({
type: ASModelType.Activity,
...fields
})
}
}

Wyświetl plik

@ -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[];
}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {ApplicationFields} from "./Application.types";
/**
* Describes a software application
*
* {@link https://www.w3.org/ns/activitystreams#Application Docs}
*/
export class Application extends ASBase<ApplicationFields>{
constructor(fields: ApplicationFields) {
super({
type: ASModelType.Application,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface ApplicationFields extends ASObjectFields {}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {ArticleFields} from "./Article.types";
/**
* Represents any kind of multi-paragraph written work
*
* {@link https://www.w3.org/ns/activitystreams#Article Docs}
*/
export class Article extends ASBase<ArticleFields>{
constructor(fields: ArticleFields) {
super({
type: ASModelType.Article,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface ArticleFields extends ASObjectFields {}

Wyświetl plik

@ -1,3 +1,5 @@
import { contexts } from "../../common/common.constants";
// TODO: types
// TODO: renaming/refactor
export type Context = string | any[];
@ -17,9 +19,10 @@ export class ASBase<T> {
}
// TODO: rewrite (better option to handle multiple contexts)
public addContext(context?: Context): this {
// some comment
public setContext(context?: Context): this {
this.fields = {
['@context']: context || 'https://www.w3.org/ns/activitystreams',
['@context']: context || contexts.activityStreamsV2,
...this.fields
}
return this;

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {ASEventFields} from "./ASEvent.types";
/**
* Represents any kind of event
*
* {@link https://www.w3.org/ns/activitystreams#Event Docs}
*/
export class ASEvent extends ASBase<ASEventFields>{
constructor(fields: ASEventFields) {
super({
type: ASModelType.Event,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface ASEventFields extends ASObjectFields {}

Wyświetl plik

@ -0,0 +1,19 @@
import {ASBase} from "../asBase/ASBase.model";
import { ASObjectFields } from "./ASObject.types";
import {ASModelType} from "../../common/common.types";
/**
* 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.
*
* {@link https://www.w3.org/ns/activitystreams#Object Docs}
*/
export class ASObject extends ASBase<ASObjectFields>{
constructor(fields: ASObjectFields) {
super({
type: ASModelType.Object,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,326 @@
import {
UrlValue,
IconValue,
ImageValue,
AttachmentValue,
AudienceValue,
InReplyToValue,
LocationValue,
PreviewValue,
ToValue,
BtoValue,
CcValue,
BccValue,
AttributedToValue,
TagValue,
GeneratorValue,
IdValue,
TypeValue,
ContentValue,
ContentMapValue,
MediaTypeValue,
NameValue,
NameMapValue,
EndTimeValue,
StartTimeValue,
PublishedValue,
RepliesValue,
SummaryValue,
SummaryMapValue,
UpdatedValue,
DurationValue,
} from "../../common/common.types";
export interface ASObjectFields {
/**
* Provides the globally unique identifier for
* an {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Object}
*
* {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Docs (@id)}
*/
id?: IdValue;
/**
* Identifies the {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Object}
* type. Multiple values may be specified.
*
* {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Docs (@type)}
*/
type?: TypeValue | TypeValue[];
/**
* Identifies resources 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.
*
* {@link https://www.w3.org/ns/activitystreams#attachment Docs}
*/
attachment?: AttachmentValue | AttachmentValue[];
/**
* 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.
*
* {@link https://www.w3.org/ns/activitystreams#attributedTo Docs}
*/
attributedTo?: AttributedToValue | AttributedToValue[];
/**
* Identifies one or more entities that represent the total population of entities
* for which the object can be considered to be relevant.
*
* {@link https://www.w3.org/ns/activitystreams#audience Docs}
*/
audience?: AudienceValue | AudienceValue[];
// TODO: only content or contentMap at one time
/**
* 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.
* [For multiple language-tagged values use contentMap property].
*
* {@link https://www.w3.org/ns/activitystreams#content Docs}
*/
content?: ContentValue;
/**
* 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.
* [For a single value use content property].
*
* {@link https://www.w3.org/ns/activitystreams#content Docs}
*/
contentMap?: ContentMapValue;
/**
* 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.
* Works different with Link
*
* {@link https://www.w3.org/ns/activitystreams#mediaType Docs}
*/
mediaType?: MediaTypeValue;
// TODO: only name or nameMap at one time
/**
* A simple, human-readable, plain-text name for the object.
* HTML markup MUST NOT be included.
* [For multiple language-tagged values use nameMap property]
*
* {@link https://www.w3.org/ns/activitystreams#name Docs}
*/
name?: NameValue;
/**
* A simple, human-readable, plain-text name for the object.
* HTML markup MUST NOT be included.
* [For a single value use name property]
*
* {@link https://www.w3.org/ns/activitystreams#name Docs}
*/
nameMap?: NameMapValue;
/**
* 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.
*
* Must be provided in {@link https://www.w3schools.blog/xsd-date-and-time-data-types xsd:dateTime}
*
* {@link https://www.w3.org/ns/activitystreams#endTime Docs}
*
* @example
* 2020-08-08T08:30:11-03:00Z
* 2020-08-08T08:30:11-03:00
* 2020-08-08T08:30:11Z
* 2020-08-08T08:30:11
* 2020-08-08
*/
endTime?: EndTimeValue;
/**
* 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.
*
* Must be provided in {@link https://www.w3schools.blog/xsd-date-and-time-data-types xsd:dateTime}
*
* {@link https://www.w3.org/ns/activitystreams#startTime Docs}
*
* @example
* 2020-08-08T08:30:11-03:00Z
* 2020-08-08T08:30:11-03:00
* 2020-08-08T08:30:11Z
* 2020-08-08T08:30:11
* 2020-08-08
*/
startTime?: StartTimeValue;
/**
* Identifies the entity (e.g. an application) that generated the object.
*
* {@link https://www.w3.org/ns/activitystreams#generator Docs}
*/
generator?: GeneratorValue;
/**
* Indicates an entity (or entities) that describes an icon for this object.
* Unlike image property, the icon should have an aspect ratio of one (horizontal)
* to one (vertical) and should be suitable for presentation at a small size.
*
* {@link https://www.w3.org/ns/activitystreams#icon Docs}
*/
icon?: IconValue | IconValue[];
/**
* Indicates an entity that describes an image for this object.
* Unlike the icon property, there are no aspect ratio or display size limitations assumed.
*
* {@link https://www.w3.org/ns/activitystreams#image Docs}
*/
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?: InReplyToValue | InReplyToValue[];
/**
* Indicates one or more physical or logical locations associated with the object.
*
* {@link https://www.w3.org/ns/activitystreams#location Docs}
*/
location?: LocationValue | LocationValue[];
/**
* Identifies an entity that provides a preview of this object.
*
* {@link https://www.w3.org/ns/activitystreams#preview Docs}
*/
preview?: PreviewValue;
/**
* The date and time at which the object was published.
*
* Must be provided in {@link https://www.w3schools.blog/xsd-date-and-time-data-types xsd:dateTime}
*
* {@link https://www.w3.org/ns/activitystreams#published Docs}
*
* @example
* 2020-08-08T08:30:11-03:00Z
* 2020-08-08T08:30:11-03:00
* 2020-08-08T08:30:11Z
* 2020-08-08T08:30:11
* 2020-08-08
*/
published?: PublishedValue;
/**
* Identifies a Collection containing objects considered to be responses to this object.
*
* {@link https://www.w3.org/ns/activitystreams#replies Docs}
*/
replies?: RepliesValue;
// TODO: only summary or summaryMap at one time
/**
* A natural language summarization of the object encoded as HTML.
* Multiple language tagged summaries MAY be provided.
* [For multiple language-tagged values use summaryMap property]
*
* {@link https://www.w3.org/ns/activitystreams#summary Docs}
*/
summary?: SummaryValue;
/**
* A natural language summarization of the object encoded as HTML.
* Multiple language tagged summaries MAY be provided.
* [For a single value use summary property]
*
* {@link https://www.w3.org/ns/activitystreams#summary Docs}
*/
summaryMap?: SummaryMapValue;
/**
* 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.
*
* {@link https://www.w3.org/ns/activitystreams#tag Docs}
*/
tag?: TagValue | TagValue[];
/**
* The date and time at which the object was updated.
*
* Must be provided in {@link https://www.w3schools.blog/xsd-date-and-time-data-types xsd:dateTime}
*
* {@link https://www.w3.org/ns/activitystreams#published Docs}
*
* @example
* 2020-08-08T08:30:11-03:00Z
* 2020-08-08T08:30:11-03:00
* 2020-08-08T08:30:11Z
* 2020-08-08T08:30:11
* 2020-08-08
*/
updated?: UpdatedValue;
/**
* Identifies one or more links to representations of the object.
*
* {@link https://www.w3.org/ns/activitystreams#url Docs}
*/
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?: 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?: 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?: 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?: BccValue | BccValue[];
/**
* 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.
*
* {@link https://www.w3.org/ns/activitystreams#duration Docs}
*
* Must be provided in {@link http://www.datypic.com/sc/xsd/t-xsd_duration.html xsd:duration}
*
* @example
* PT20M (20 minutes)
* P1DT2H (1 day, 2 hours)
* P2Y6M5DT12H35M30S (2 years, 6 months, 5 days, 12 hours, 35 minutes, 30 seconds)
*/
duration?: DurationValue;
}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {AudioFields} from "./Audio.types";
/**
* Represents an audio document of any kind
*
* {@link https://www.w3.org/ns/activitystreams#Audio Docs}
*/
export class Audio extends ASBase<AudioFields>{
constructor(fields: AudioFields) {
super({
type: ASModelType.Audio,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import { DocumentFields } from "../document/Document.types";
export interface AudioFields extends DocumentFields {}

Wyświetl plik

@ -0,0 +1,18 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {CollectionFields} from "./Collection.types";
/**
* A Collection is a subtype of Object that represents
* ordered or unordered sets of Object or Link instances.
*
* {@link https://www.w3.org/ns/activitystreams#Collection Docs}
*/
export class Collection extends ASBase<CollectionFields>{
constructor(fields: CollectionFields) {
super({
type: ASModelType.Collection,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,51 @@
import {ASObjectFields} from "../asObject/ASObject.types";
import {
CollectionCurrentValue,
CollectionFirstValue, CollectionItemsValue,
CollectionLastValue,
TotalItemsValue
} from "../../common/common.types";
export interface CollectionFields extends ASObjectFields {
/**
* A non-negative integer specifying the total number of objects contained by
* the logical view of the collection. This number might not reflect the actual
* number of items serialized within the Collection object instance.
*
* {@link https://www.w3.org/ns/activitystreams#totalItems Docs}
*/
totalItems?: TotalItemsValue;
/**
* In a paged Collection, indicates the page that contains
* the most recently updated member items.
*
* {@link https://www.w3.org/ns/activitystreams#current Docs}
*/
current?: CollectionCurrentValue;
/**
* In a paged Collection,indicates the furthest proceeding
* page of items in the collection.
*
* {@link https://www.w3.org/ns/activitystreams#first Docs}
*/
first?: CollectionFirstValue;
/**
* In a paged Collection, indicates the furthest proceeding
* page of the collection.
*
* {@link https://www.w3.org/ns/activitystreams#last Docs}
*/
last?: CollectionLastValue;
/**
* Identifies the items contained in a collection.
* The items might be ordered or unordered.
*
* {@link https://www.w3.org/ns/activitystreams#items Docs}
*/
items?: CollectionItemsValue[];
}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {CollectionPageFields} from "./CollectionPage.types";
/**
* Used to represent distinct subsets of items from a Collection.
*
* {@link https://www.w3.org/ns/activitystreams#CollectionPage Docs}
*/
export class CollectionPage extends ASBase<CollectionPageFields>{
constructor(fields: CollectionPageFields) {
super({
type: ASModelType.CollectionPage,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,26 @@
import {CollectionFields} from "../collection/Collection.types";
import {CollectionPageNextValue, CollectionPagePartOfValue, CollectionPagePrevValue} from "../../common/common.types";
export interface CollectionPageFields extends CollectionFields {
/**
* Identifies the Collection to which a CollectionPage objects items belong.
*
* {@link https://www.w3.org/ns/activitystreams#partOf Docs}
*/
partOf?: CollectionPagePartOfValue;
/**
* In a paged Collection, indicates the next page of items.
*
* {@link https://www.w3.org/ns/activitystreams#next Docs}
*/
next?: CollectionPageNextValue;
/**
* In a paged Collection, identifies the previous page of items.
*
* {@link https://www.w3.org/ns/activitystreams#prev Docs}
*/
prev?: CollectionPagePrevValue;
}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {DocumentFields} from "./Document.types";
/**
* Represents a document of any kind
*
* {@link https://www.w3.org/ns/activitystreams#Document Docs}
*/
export class Document extends ASBase<DocumentFields>{
constructor(fields: DocumentFields) {
super({
type: ASModelType.Document,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface DocumentFields extends ASObjectFields {}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {GroupFields} from "./Group.types";
/**
* Represents a formal or informal collective of Actors
*
* {@link https://www.w3.org/ns/activitystreams#Group Docs}
*/
export class Group extends ASBase<GroupFields>{
constructor(fields: GroupFields) {
super({
type: ASModelType.Group,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface GroupFields extends ASObjectFields {}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {ImageFields} from "./Image.types";
/**
* An image document of any kind
*
* {@link https://www.w3.org/ns/activitystreams#Image Docs}
*/
export class Image extends ASBase<ImageFields>{
constructor(fields: ImageFields) {
super({
type: ASModelType.Image,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import { DocumentFields } from "../document/Document.types";
export interface ImageFields extends DocumentFields {}

Wyświetl plik

@ -0,0 +1,19 @@
import {ASBase} from "../asBase/ASBase.model";
import {IntransitiveActivityFields} from './IntransitiveActivity.types';
import {ASModelType} from "../../common/common.types";
/**
* Instances of intransitiveActivity are a subtype of
* Activity representing intransitive actions. The
* object property is therefore inappropriate for these activities.
*
* {@link https://www.w3.org/ns/activitystreams#IntransitiveActivity Docs}
*/
export class IntransitiveActivity extends ASBase<IntransitiveActivityFields>{
constructor(fields: IntransitiveActivityFields) {
super({
type: ASModelType.Activity,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ActivityFields} from "../activity/Activity.types";
export interface IntransitiveActivityFields extends Omit<ActivityFields, 'object'> {}

Wyświetl plik

@ -0,0 +1,22 @@
import {ASBase} from "../asBase/ASBase.model";
import { LinkFields } from "./Link.types";
import {ASModelType} from "../../common/common.types";
/**
* A Link is an indirect, qualified reference to a resource identified by a URL.
* The fundamental model for links is established by [RFC5988]. 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.
*
* {@link https://www.w3.org/ns/activitystreams#Link Docs}
*/
export class Link extends ASBase<LinkFields>{
constructor(fields: LinkFields) {
super({
type: ASModelType.Link,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,96 @@
import {
HeightValue,
HreflangValue,
HrefValue,
IdValue,
MediaTypeValue,
NameMapValue,
NameValue, PreviewValue,
RelValue, TypeValue, WidthValue
} from "../../common/common.types";
export interface LinkFields {
/**
* Identifies the {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Object}
* type. Multiple values may be specified.
*
* {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Docs (@type)}
*/
type?: TypeValue | TypeValue[];
/**
* A simple, human-readable, plain-text name for the object.
* HTML markup MUST NOT be included.
* [For multiple language-tagged values use nameMap property]
*
* {@link https://www.w3.org/ns/activitystreams#name Docs}
*/
name?: NameValue;
/**
* A simple, human-readable, plain-text name for the object.
* HTML markup MUST NOT be included.
* [For a single value use name property]
*
* {@link https://www.w3.org/ns/activitystreams#name Docs}
*/
nameMap?: NameMapValue;
/**
* The target resource pointed to by a Link.
*
* {@link https://www.w3.org/ns/activitystreams#href Docs}
*/
href?: HrefValue;
/**
* Hints as to the language used by the target resource.
* Value MUST be a [BCP47] Language-Tag.
*
* {@link https://www.w3.org/ns/activitystreams#hreflang Docs}
*/
hreflang?: HreflangValue;
/**
* When used on a Link, identifies the MIME media type of the referenced resource
*
* {@link https://www.w3.org/ns/activitystreams#mediaType Docs}
*/
mediaType?: MediaTypeValue;
/**
* A link relation associated with a Link. The value MUST conform to both
* the [HTML5] and [RFC5988] "link relation" definitions. In the [HTML5],
* any string not containing the "space" U+0020, "tab" (U+0009), "LF" (U+000A), "FF" (U+000C), "CR" (U+000D) or "," (U+002C)
* characters can be used as a valid link relation.
*
* {@link https://www.w3.org/ns/activitystreams#rel Docs}
*/
rel?: RelValue | RelValue[];
/**
* On a Link, specifies a hint as to the rendering height in
* device-independent pixels of the linked resource.
* Type: Non negative integer
*
* {@link https://www.w3.org/ns/activitystreams#height Docs}
*/
height?: HeightValue;
/**
* On a Link, specifies a hint as to the rendering width in
* device-independent pixels of the linked resource.
* Type: Non negative integer
*
* {@link https://www.w3.org/ns/activitystreams#width Docs}
*/
width?: WidthValue;
/**
* Identifies an entity that provides a preview of this object.
*
* {@link https://www.w3.org/ns/activitystreams#preview Docs}
*/
preview?: PreviewValue;
}

Wyświetl plik

@ -0,0 +1,16 @@
import {ASBase} from "../asBase/ASBase.model";
import {MentionFields} from "./Mention.types";
import {ASModelType} from "../../common/common.types";
/**
* A specialized Link that represents an @mention.
*
* {@link https://www.w3.org/ns/activitystreams#Mention Docs}
*/
export class Mention extends ASBase<MentionFields>{
constructor(fields: MentionFields) {
super({
type: ASModelType.Mention,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {LinkFields} from "../link/Link.types";
export interface MentionFields extends LinkFields {}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {NoteFields} from "./Note.types";
/**
* Represents a short written work typically less than a single paragraph in length.
*
* {@link https://www.w3.org/ns/activitystreams#Note Docs}
*/
export class Note extends ASBase<NoteFields>{
constructor(fields: NoteFields) {
super({
type: ASModelType.Note,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface NoteFields extends ASObjectFields {}

Wyświetl plik

@ -0,0 +1,18 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {OrderedCollectionFields} from "./OrderedCollection.types";
/**
* A subtype of Collection in which members of
* the logical collection are assumed to always be strictly ordered.
*
* {@link https://www.w3.org/ns/activitystreams#OrderedCollection Docs}
*/
export class OrderedCollection extends ASBase<OrderedCollectionFields>{
constructor(fields: OrderedCollectionFields) {
super({
type: ASModelType.OrderedCollection,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,42 @@
import {
OrderedCollectionCurrentValue,
OrderedCollectionFirstValue, OrderedCollectionItemsValue,
OrderedCollectionLastValue
} from "../../common/common.types";
import {CollectionFields} from "../collection/Collection.types";
import {Modify} from "../../common/utils";
export interface OrderedCollectionFields extends Modify<CollectionFields, {
/**
* In a paged OrderedCollection, indicates the page that contains
* the most recently updated member items.
*
* {@link https://www.w3.org/ns/activitystreams#current Docs}
*/
current?: OrderedCollectionCurrentValue;
/**
* In a paged OrderedCollection, indicates the furthest proceeding
* page of items in the collection.
*
* {@link https://www.w3.org/ns/activitystreams#first Docs}
*/
first?: OrderedCollectionFirstValue;
/**
* In a paged OrderedCollection, indicates the furthest proceeding
* page of the collection.
*
* {@link https://www.w3.org/ns/activitystreams#last Docs}
*/
last?: OrderedCollectionLastValue;
/**
* Identifies the items contained in a collection.
* The items might be ordered or unordered.
*
* {@link https://www.w3.org/ns/activitystreams#items Docs}
*/
items?: OrderedCollectionItemsValue[];
}> {}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {OrderedCollectionPageFields} from "./OrderedCollectionPage.types";
/**
* Used to represent ordered subsets of items from an OrderedCollection.
*
* {@link https://www.w3.org/ns/activitystreams#OrderedCollectionPage Docs}
*/
export class OrderedCollectionPage extends ASBase<OrderedCollectionPageFields>{
constructor(fields: OrderedCollectionPageFields) {
super({
type: ASModelType.OrderedCollectionPage,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,47 @@
import {OrderedCollectionFields} from "../orderedCollection/OrderedCollection.types";
import {
OrderedCollectionPageNextValue,
OrderedCollectionPagePartOfValue,
OrderedCollectionPagePrevValue,
StartIndexValue
} from "../../common/common.types";
import {CollectionPageFields} from "../collectionPage/CollectionPage.types";
import {Modify} from "../../common/utils";
interface OmittedCollectionPageFields extends Omit<CollectionPageFields, 'current' | 'first' | 'items' | 'last'> {}
export interface OrderedCollectionPageFields
extends
OrderedCollectionFields,
Modify<OmittedCollectionPageFields, {
/**
* Identifies the OrderedCollection to which a OrderedCollectionPage objects items belong.
*
* {@link https://www.w3.org/ns/activitystreams#partOf Docs}
*/
partOf?: OrderedCollectionPagePartOfValue;
/**
* In a paged OrderedCollection, indicates the next page of items.
*
* {@link https://www.w3.org/ns/activitystreams#next Docs}
*/
next?: OrderedCollectionPageNextValue;
/**
* In a paged OrderedCollection, identifies the previous page of items.
*
* {@link https://www.w3.org/ns/activitystreams#prev Docs}
*/
prev?: OrderedCollectionPagePrevValue;
}> {
/**
* A non-negative integer value identifying the relative position
* within the logical view of a strictly ordered collection.
*
* {@link https://www.w3.org/ns/activitystreams#startIndex Docs}
*/
startIndex?: StartIndexValue;
}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {OrganizationFields} from "./Organization.types";
/**
* Represents an organization
*
* {@link https://www.w3.org/ns/activitystreams#Organization Docs}
*/
export class Organization extends ASBase<OrganizationFields>{
constructor(fields: OrganizationFields) {
super({
type: ASModelType.Organization,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface OrganizationFields extends ASObjectFields {}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {PageFields} from "./Page.types";
/**
* Represents a Web Page
*
* {@link https://www.w3.org/ns/activitystreams#Page Docs}
*/
export class Page extends ASBase<PageFields>{
constructor(fields: PageFields) {
super({
type: ASModelType.Page,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import { DocumentFields } from "../document/Document.types";
export interface PageFields extends DocumentFields {}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {PersonFields} from "./Person.types";
/**
* Represents an individual person
*
* {@link https://www.w3.org/ns/activitystreams#Person Docs}
*/
export class Person extends ASBase<PersonFields>{
constructor(fields: PersonFields) {
super({
type: ASModelType.Person,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface PersonFields extends ASObjectFields {}

Wyświetl plik

@ -0,0 +1,19 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {PlaceFields} from "./Place.types";
/**
* Represents a logical or physical location. See
* {@link https://www.w3.org/TR/activitystreams-vocabulary/#places 5.3 Representing Places}
* for additional information.
*
* {@link https://www.w3.org/ns/activitystreams#Place Docs}
*/
export class Place extends ASBase<PlaceFields>{
constructor(fields: PlaceFields) {
super({
type: ASModelType.Place,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,60 @@
import {ASObjectFields} from "../asObject/ASObject.types";
import {
AccuracyValue,
AltitudeValue,
LatitudeValue,
LongitudeValue,
RadiusValue,
UnitsValue
} from "../../common/common.types";
export interface PlaceFields extends ASObjectFields {
/**
* Indicates the accuracy of position coordinates on a Place objects.
* Expressed in properties of percentage. e.g. "94.0" means "94.0% accurate".
*
* {@link https://www.w3.org/ns/activitystreams#accuracy Docs}
*/
accuracy?: AccuracyValue;
/**
* Indicates the altitude of a place. The measurement units is indicated using the "units" property.
* If units is not specified, the default is assumed to be "m" indicating "meters".
*
* {@link https://www.w3.org/ns/activitystreams#altitude Docs}
*/
altitude?: AltitudeValue;
/**
* The latitude of a place
*
* {@link https://www.w3.org/ns/activitystreams#latitude Docs}
*/
latitude?: LatitudeValue;
/**
* The longitude of a place
*
* {@link https://www.w3.org/ns/activitystreams#longitude Docs}
*/
longitude?: LongitudeValue;
/**
* The radius from the given latitude and longitude for a Place.
* The units are expressed by the "units" property. If units is not specified,
* the default is assumed to be "m" indicating "meters".
*
* {@link https://www.w3.org/ns/activitystreams#radius Docs}
*/
radius?: RadiusValue;
/**
* Specifies the measurement units for the radius and altitude properties
* on a Place object. If not specified, the default is assumed to be "m" for "meters".
*
* {@link https://www.w3.org/ns/activitystreams#units Docs}
*/
units?: UnitsValue;
}

Wyświetl plik

@ -0,0 +1,19 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {ProfileFields} from "./Profile.types";
/**
* A Profile is a content object that describes another Object,
* typically used to describe Actor Type objects. The describes property
* is used to reference the object being described by the profile.
*
* {@link https://www.w3.org/ns/activitystreams#Profile Docs}
*/
export class Profile extends ASBase<ProfileFields>{
constructor(fields: ProfileFields) {
super({
type: ASModelType.Profile,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,14 @@
import {ASObjectFields} from "../asObject/ASObject.types";
import {DescribesValue} from "../../common/common.types";
export interface ProfileFields extends ASObjectFields {
/**
* On a Profile object, the describes property identifies
* the object described by the Profile.
*
* {@link https://www.w3.org/ns/activitystreams#describes Docs}
*/
describes?: DescribesValue;
}

Wyświetl plik

@ -0,0 +1,23 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {QuestionFields} from "./Question.types";
/**
* 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.
*
* Either of the anyOf and oneOf properties MAY be used to express possible
* answers, but a Question object MUST NOT have both properties.
*
* {@link https://www.w3.org/ns/activitystreams#Question Docs}
*/
export class Question extends ASBase<QuestionFields>{
constructor(fields: QuestionFields) {
super({
type: ASModelType.Question,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,31 @@
import {IntransitiveActivityFields} from "../intransitiveActivity/IntransitiveActivity.types";
import {AnyOfValue, ClosedValue, OneOfValue} from "../../common/common.types";
export interface QuestionFields extends IntransitiveActivityFields {
// TODO: only oneOf or anyOf at one time
/**
* Identifies an exclusive option for a Question.
* Use of oneOf implies that the Question can have only a single answer.
* To indicate that a Question can have multiple answers, use anyOf.
*
* {@link https://www.w3.org/ns/activitystreams#oneOf Docs}
*/
oneOf?: OneOfValue[];
/**
* Identifies an inclusive option for a Question.
* Use of anyOf implies that the Question can have multiple answers.
* To indicate that a Question can have only one answer, use oneOf.
*
* {@link https://www.w3.org/ns/activitystreams#anyOf Docs}
*/
anyOf?: AnyOfValue[];
/**
* Indicates that a question has been closed, and answers are no longer accepted.
*
* {@link https://www.w3.org/ns/activitystreams#closed Docs}
*/
closed?: ClosedValue;
}

Wyświetl plik

@ -0,0 +1,20 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {RelationshipFields} from "./Relationship.types";
/**
* Describes a relationship between two individuals. The subject and
* object properties are used to identify the connected individuals.
* See {@link https://www.w3.org/TR/activitystreams-vocabulary/#connections 5.2 Representing Relationships Between Entities}
* for additional information.
*
* {@link https://www.w3.org/ns/activitystreams#Relationship Docs}
*/
export class Relationship extends ASBase<RelationshipFields>{
constructor(fields: RelationshipFields) {
super({
type: ASModelType.Relationship,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,29 @@
import {ASObjectFields} from "../asObject/ASObject.types";
import {SubjectValue, ObjectValue, RelationshipValue} from "../../common/common.types";
export interface RelationshipFields extends ASObjectFields {
/**
* On a Relationship object, the subject property identifies one of the connected individuals.
* For instance, for a Relationship object describing "John is related to Sally",
* subject would refer to John.
*
* {@link https://www.w3.org/ns/activitystreams#subject Docs}
*/
subject?: SubjectValue;
/**
* When used within a Relationship describes the entity to which the subject is related.
*
* {@link https://www.w3.org/ns/activitystreams#object Docs}
*/
object?: ObjectValue | ObjectValue[];
/**
* On a Relationship object, the relationship property
* identifies the kind of relationship that exists between subject and object.
*
* {@link https://www.w3.org/ns/activitystreams#relationship Docs}
*/
relationship?: RelationshipValue;
}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {ServiceFields} from "./Service.types";
/**
* Represents a service of any kind
*
* {@link https://www.w3.org/ns/activitystreams#Service Docs}
*/
export class Service extends ASBase<ServiceFields>{
constructor(fields: ServiceFields) {
super({
type: ASModelType.Service,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import {ASObjectFields} from "../asObject/ASObject.types";
export interface ServiceFields extends ASObjectFields {}

Wyświetl plik

@ -0,0 +1,19 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {TombstoneFields} from "./Tombstone.types";
/**
* 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.
*
* {@link https://www.w3.org/ns/activitystreams#Tombstone Docs}
*/
export class Tombstone extends ASBase<TombstoneFields>{
constructor(fields: TombstoneFields) {
super({
type: ASModelType.Tombstone,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,23 @@
import {DeletedValue, FormerTypeValue} from "../../common/common.types";
import {ASObjectFields} from "../asObject/ASObject.types";
export interface TombstoneFields extends ASObjectFields {
/**
* On a Tombstone object, the formerType property identifies
* the type of the object that was deleted.
*
* {@link https://www.w3.org/ns/activitystreams#formerType Docs}
*/
formerType?: FormerTypeValue;
/**
* On a Tombstone object, the deleted property is a timestamp
* for when the object was deleted.
*
* If time must be specified - use {@link https://www.w3schools.blog/xsd-date-and-time-data-types xsd:dateTime}
*
* {@link https://www.w3.org/ns/activitystreams#deleted Docs}
*/
deleted?: DeletedValue;
}

Wyświetl plik

@ -0,0 +1,17 @@
import {ASBase} from "../asBase/ASBase.model";
import {ASModelType} from "../../common/common.types";
import {VideoFields} from "./Video.types";
/**
* Represents a video document of any kind
*
* {@link https://www.w3.org/ns/activitystreams#Video Docs}
*/
export class Video extends ASBase<VideoFields>{
constructor(fields: VideoFields) {
super({
type: ASModelType.Video,
...fields
})
}
}

Wyświetl plik

@ -0,0 +1,3 @@
import { DocumentFields } from "../document/Document.types";
export interface VideoFields extends DocumentFields {}