kopia lustrzana https://github.com/activitypub-js/activitypub-models
implement proxy
rodzic
b806943b70
commit
dda8be976d
|
@ -7,8 +7,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tsc": "tsc -p ./tsconfig.json",
|
"tsc": "tsc -p ./tsconfig.json",
|
||||||
"tsc:watch": "tsc -w -p ./tsconfig.json",
|
"tsc:watch": "tsc -w -p ./tsconfig.json",
|
||||||
"start": "node --es-module-specifier-resolution=node build/index.js",
|
"start": "node --es-module-specifier-resolution=node dist/index.js",
|
||||||
"start:dev": "nodemon --es-module-specifier-resolution=node build/index.js"
|
"start:dev": "nodemon --es-module-specifier-resolution=node dist/index.js"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
|
|
@ -39,6 +39,7 @@ export enum ASModelType {
|
||||||
Question = 'Question',
|
Question = 'Question',
|
||||||
Tombstone = 'Tombstone',
|
Tombstone = 'Tombstone',
|
||||||
Profile = 'Profile',
|
Profile = 'Profile',
|
||||||
|
Actor = 'Actor',
|
||||||
Link = 'Link',
|
Link = 'Link',
|
||||||
Mention = 'Mention',
|
Mention = 'Mention',
|
||||||
Collection = 'Collection',
|
Collection = 'Collection',
|
||||||
|
@ -146,4 +147,14 @@ export type OauthAuthorizationEndpointValue = string;
|
||||||
export type OauthTokenEndpointValue = string;
|
export type OauthTokenEndpointValue = string;
|
||||||
export type ProvideClientKeyValue = string;
|
export type ProvideClientKeyValue = string;
|
||||||
export type SignClientKeyValue = string;
|
export type SignClientKeyValue = string;
|
||||||
export type SharedInboxValue = string;
|
export type SharedInboxValue = string;
|
||||||
|
|
||||||
|
export interface WithContext {
|
||||||
|
/**
|
||||||
|
* JSON-LD uses the special @context property to define the processing context.
|
||||||
|
* The value of the @context property is defined by the [JSON-LD] specification.
|
||||||
|
*
|
||||||
|
* {@link https://www.w3.org/TR/activitystreams-core/#jsonld Docs}
|
||||||
|
*/
|
||||||
|
'@context'?: ContextValue | ContextValue[];
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
export type Modify<T, R> = Omit<T, keyof R> & R;
|
export type Modify<T, R> = Omit<T, keyof R> & R;
|
||||||
|
|
||||||
|
export const hasKey = <T extends object>(obj: T, k: keyof any): k is keyof T => k in obj;
|
||||||
|
|
||||||
export const cloneObjDeep = <T>(obj: T): T => {
|
export const cloneObjDeep = <T>(obj: T): T => {
|
||||||
const duplicateObj = {} as T;
|
const duplicateObj = {} as T;
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -11,10 +11,10 @@ import {ASModelType} from "../../common/types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Activity Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Activity Docs}
|
||||||
*/
|
*/
|
||||||
export class Activity extends APBase<ActivityFields>{
|
export class Activity extends APBase<ActivityFields>{
|
||||||
constructor(fields: ActivityFields) {
|
static create(fields: ActivityFields) {
|
||||||
super({
|
return APBase._create<ActivityFields>({
|
||||||
type: ASModelType.Activity,
|
type: ASModelType.Activity,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,10 +13,10 @@ import {ActorFields} from "./Actor.types";
|
||||||
* {@link https://www.w3.org/TR/activitypub/#actors Docs}
|
* {@link https://www.w3.org/TR/activitypub/#actors Docs}
|
||||||
*/
|
*/
|
||||||
export class Actor extends APBase<ActorFields>{
|
export class Actor extends APBase<ActorFields>{
|
||||||
constructor(fields: ActorFields) {
|
static create(fields: ActorFields) {
|
||||||
super({
|
return APBase._create<ActorFields>({
|
||||||
type: ASModelType.Profile,
|
type: ASModelType.Actor,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,31 +1,43 @@
|
||||||
import { contexts } from "../../common/constants";
|
import {cloneObjDeep, hasKey} from "../../common/utils";
|
||||||
import { ContextValue } from "../../common/types";
|
import { WithContext } from "../../common/types";
|
||||||
import { cloneObjDeep } from "../../common/utils";
|
|
||||||
|
|
||||||
interface ContextField {
|
|
||||||
'@context'?: ContextValue | ContextValue[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class APBase<T> {
|
export class APBase<T extends WithContext> {
|
||||||
public fields: T & ContextField;
|
public fields: T;
|
||||||
|
|
||||||
constructor(fields: T & ContextField) {
|
protected constructor(fields: T) {
|
||||||
const obj = cloneObjDeep<T & ContextField>(fields);
|
// TODO move ordering to toPlain
|
||||||
this.fields = {
|
const obj = cloneObjDeep<T>(fields);
|
||||||
...obj,
|
if ('@context' in obj) {
|
||||||
} as T & ContextField;
|
this.fields = {
|
||||||
}
|
'@context': obj['@context'],
|
||||||
|
} as T;
|
||||||
private parseValue(value: any): any {
|
delete obj["@context"];
|
||||||
return value instanceof APBase ? value.toPlain() : value;
|
} else {
|
||||||
}
|
this.fields = {} as T;
|
||||||
|
|
||||||
public withContext(context?: ContextValue): this {
|
|
||||||
this.fields = {
|
|
||||||
['@context']: context || contexts.activityStreamsV2,
|
|
||||||
...this.fields
|
|
||||||
}
|
}
|
||||||
return this;
|
|
||||||
|
this.fields = {
|
||||||
|
...this.fields,
|
||||||
|
...obj
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static _create<T extends WithContext>(fields: T) {
|
||||||
|
const data = new APBase<T>(fields);
|
||||||
|
return new Proxy(data, {
|
||||||
|
get(target: APBase<T>, p: keyof APBase<T> & keyof T) {
|
||||||
|
return hasKey(target, p) ? target[p] : target.fields[p];
|
||||||
|
},
|
||||||
|
set(target: APBase<T>, p: keyof APBase<T> & keyof T, newValue: any): boolean {
|
||||||
|
target.fields[p] = newValue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}) as APBase<T> & T & WithContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected parseValue(value: any): any {
|
||||||
|
return value instanceof APBase ? value.toPlain() : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public toPlain(): Record<string, any> {
|
public toPlain(): Record<string, any> {
|
||||||
|
|
|
@ -8,10 +8,10 @@ import {APEventFields} from "./APEvent.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Event Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Event Docs}
|
||||||
*/
|
*/
|
||||||
export class APEvent extends APBase<APEventFields>{
|
export class APEvent extends APBase<APEventFields>{
|
||||||
constructor(fields: APEventFields) {
|
static create(fields: APEventFields) {
|
||||||
super({
|
return APBase._create<APEventFields>({
|
||||||
type: ASModelType.Event,
|
type: ASModelType.Event,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,10 +10,10 @@ import {ASModelType} from "../../common/types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Object Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Object Docs}
|
||||||
*/
|
*/
|
||||||
export class APObject extends APBase<APObjectFields>{
|
export class APObject extends APBase<APObjectFields>{
|
||||||
constructor(fields: APObjectFields) {
|
static create(fields: APObjectFields) {
|
||||||
super({
|
return APBase._create<APObjectFields>({
|
||||||
type: ASModelType.Object,
|
type: ASModelType.Object,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,10 +28,10 @@ import {
|
||||||
SummaryValue,
|
SummaryValue,
|
||||||
SummaryMapValue,
|
SummaryMapValue,
|
||||||
UpdatedValue,
|
UpdatedValue,
|
||||||
DurationValue, SourceValue, LikesValue, SharesValue,
|
DurationValue, SourceValue, LikesValue, SharesValue, ContextValue, WithContext,
|
||||||
} from "../../common/types";
|
} from "../../common/types";
|
||||||
|
|
||||||
export interface APObjectFields {
|
export interface APObjectFields extends WithContext {
|
||||||
/**
|
/**
|
||||||
* Provides the globally unique identifier for
|
* Provides the globally unique identifier for
|
||||||
* an {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Object}
|
* an {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Object}
|
||||||
|
|
|
@ -8,10 +8,10 @@ import {ApplicationFields} from "./Application.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Application Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Application Docs}
|
||||||
*/
|
*/
|
||||||
export class Application extends APBase<ApplicationFields>{
|
export class Application extends APBase<ApplicationFields>{
|
||||||
constructor(fields: ApplicationFields) {
|
static create(fields: ApplicationFields) {
|
||||||
super({
|
return APBase._create<ApplicationFields>({
|
||||||
type: ASModelType.Application,
|
type: ASModelType.Application,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {ArticleFields} from "./Article.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Article Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Article Docs}
|
||||||
*/
|
*/
|
||||||
export class Article extends APBase<ArticleFields>{
|
export class Article extends APBase<ArticleFields>{
|
||||||
constructor(fields: ArticleFields) {
|
static create(fields: ArticleFields) {
|
||||||
super({
|
return APBase._create<ArticleFields>({
|
||||||
type: ASModelType.Article,
|
type: ASModelType.Article,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {AudioFields} from "./Audio.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Audio Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Audio Docs}
|
||||||
*/
|
*/
|
||||||
export class Audio extends APBase<AudioFields>{
|
export class Audio extends APBase<AudioFields>{
|
||||||
constructor(fields: AudioFields) {
|
static create(fields: AudioFields) {
|
||||||
super({
|
return APBase._create<AudioFields>({
|
||||||
type: ASModelType.Audio,
|
type: ASModelType.Audio,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,10 +9,10 @@ import {CollectionFields} from "./Collection.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Collection Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Collection Docs}
|
||||||
*/
|
*/
|
||||||
export class Collection extends APBase<CollectionFields>{
|
export class Collection extends APBase<CollectionFields>{
|
||||||
constructor(fields: CollectionFields) {
|
static create(fields: CollectionFields) {
|
||||||
super({
|
return APBase._create<CollectionFields>({
|
||||||
type: ASModelType.Collection,
|
type: ASModelType.Collection,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {CollectionPageFields} from "./CollectionPage.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#CollectionPage Docs}
|
* {@link https://www.w3.org/ns/activitystreams#CollectionPage Docs}
|
||||||
*/
|
*/
|
||||||
export class CollectionPage extends APBase<CollectionPageFields>{
|
export class CollectionPage extends APBase<CollectionPageFields>{
|
||||||
constructor(fields: CollectionPageFields) {
|
static create(fields: CollectionPageFields) {
|
||||||
super({
|
return APBase._create<CollectionPageFields>({
|
||||||
type: ASModelType.CollectionPage,
|
type: ASModelType.CollectionPage,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {DocumentFields} from "./Document.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Document Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Document Docs}
|
||||||
*/
|
*/
|
||||||
export class Document extends APBase<DocumentFields>{
|
export class Document extends APBase<DocumentFields>{
|
||||||
constructor(fields: DocumentFields) {
|
static create(fields: DocumentFields) {
|
||||||
super({
|
return APBase._create<DocumentFields>({
|
||||||
type: ASModelType.Document,
|
type: ASModelType.Document,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {GroupFields} from "./Group.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Group Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Group Docs}
|
||||||
*/
|
*/
|
||||||
export class Group extends APBase<GroupFields>{
|
export class Group extends APBase<GroupFields>{
|
||||||
constructor(fields: GroupFields) {
|
static create(fields: GroupFields) {
|
||||||
super({
|
return APBase._create<GroupFields>({
|
||||||
type: ASModelType.Group,
|
type: ASModelType.Group,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {ImageFields} from "./Image.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Image Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Image Docs}
|
||||||
*/
|
*/
|
||||||
export class Image extends APBase<ImageFields>{
|
export class Image extends APBase<ImageFields>{
|
||||||
constructor(fields: ImageFields) {
|
static create(fields: ImageFields) {
|
||||||
super({
|
return APBase._create<ImageFields>({
|
||||||
type: ASModelType.Image,
|
type: ASModelType.Image,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,10 +10,10 @@ import {ASModelType} from "../../common/types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#IntransitiveActivity Docs}
|
* {@link https://www.w3.org/ns/activitystreams#IntransitiveActivity Docs}
|
||||||
*/
|
*/
|
||||||
export class IntransitiveActivity extends APBase<IntransitiveActivityFields>{
|
export class IntransitiveActivity extends APBase<IntransitiveActivityFields>{
|
||||||
constructor(fields: IntransitiveActivityFields) {
|
static create(fields: IntransitiveActivityFields) {
|
||||||
super({
|
return APBase._create<IntransitiveActivityFields>({
|
||||||
type: ASModelType.Activity,
|
type: ASModelType.Activity,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,10 +13,10 @@ import {ASModelType} from "../../common/types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Link Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Link Docs}
|
||||||
*/
|
*/
|
||||||
export class Link extends APBase<LinkFields>{
|
export class Link extends APBase<LinkFields>{
|
||||||
constructor(fields: LinkFields) {
|
static create(fields: LinkFields) {
|
||||||
super({
|
return APBase._create<LinkFields>({
|
||||||
type: ASModelType.Link,
|
type: ASModelType.Link,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ import {
|
||||||
} from "../../common/types";
|
} from "../../common/types";
|
||||||
|
|
||||||
export interface LinkFields {
|
export interface LinkFields {
|
||||||
|
'@context': never;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies the {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Object}
|
* Identifies the {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Object}
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {MentionFields} from "./Mention.types";
|
import {MentionFields} from "./Mention.types";
|
||||||
import {ASModelType} from "../../common/types";
|
import {ASModelType} from "../../common/types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A specialized Link that represents an @mention.
|
* A specialized Link that represents an @mention.
|
||||||
*
|
*
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Mention Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Mention Docs}
|
||||||
*/
|
*/
|
||||||
export class Mention extends APBase<MentionFields>{
|
export class Mention extends APBase<MentionFields>{
|
||||||
constructor(fields: MentionFields) {
|
static create(fields: MentionFields) {
|
||||||
super({
|
return APBase._create<MentionFields>({
|
||||||
type: ASModelType.Mention,
|
type: ASModelType.Mention,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {NoteFields} from "./Note.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Note Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Note Docs}
|
||||||
*/
|
*/
|
||||||
export class Note extends APBase<NoteFields>{
|
export class Note extends APBase<NoteFields>{
|
||||||
constructor(fields: NoteFields) {
|
static create(fields: NoteFields) {
|
||||||
super({
|
return APBase._create<NoteFields>({
|
||||||
type: ASModelType.Note,
|
type: ASModelType.Note,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,10 +9,10 @@ import {OrderedCollectionFields} from "./OrderedCollection.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#OrderedCollection Docs}
|
* {@link https://www.w3.org/ns/activitystreams#OrderedCollection Docs}
|
||||||
*/
|
*/
|
||||||
export class OrderedCollection extends APBase<OrderedCollectionFields>{
|
export class OrderedCollection extends APBase<OrderedCollectionFields>{
|
||||||
constructor(fields: OrderedCollectionFields) {
|
static create(fields: OrderedCollectionFields) {
|
||||||
super({
|
return APBase._create<OrderedCollectionFields>({
|
||||||
type: ASModelType.OrderedCollection,
|
type: ASModelType.OrderedCollection,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {OrderedCollectionPageFields} from "./OrderedCollectionPage.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#OrderedCollectionPage Docs}
|
* {@link https://www.w3.org/ns/activitystreams#OrderedCollectionPage Docs}
|
||||||
*/
|
*/
|
||||||
export class OrderedCollectionPage extends APBase<OrderedCollectionPageFields>{
|
export class OrderedCollectionPage extends APBase<OrderedCollectionPageFields>{
|
||||||
constructor(fields: OrderedCollectionPageFields) {
|
static create(fields: OrderedCollectionPageFields) {
|
||||||
super({
|
return APBase._create<OrderedCollectionPageFields>({
|
||||||
type: ASModelType.OrderedCollectionPage,
|
type: ASModelType.OrderedCollectionPage,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {OrganizationFields} from "./Organization.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Organization Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Organization Docs}
|
||||||
*/
|
*/
|
||||||
export class Organization extends APBase<OrganizationFields>{
|
export class Organization extends APBase<OrganizationFields>{
|
||||||
constructor(fields: OrganizationFields) {
|
static create(fields: OrganizationFields) {
|
||||||
super({
|
return APBase._create<OrganizationFields>({
|
||||||
type: ASModelType.Organization,
|
type: ASModelType.Organization,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {PageFields} from "./Page.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Page Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Page Docs}
|
||||||
*/
|
*/
|
||||||
export class Page extends APBase<PageFields>{
|
export class Page extends APBase<PageFields>{
|
||||||
constructor(fields: PageFields) {
|
static create(fields: PageFields) {
|
||||||
super({
|
return APBase._create<PageFields>({
|
||||||
type: ASModelType.Page,
|
type: ASModelType.Page,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,10 +10,10 @@ import {PlaceFields} from "./Place.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Place Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Place Docs}
|
||||||
*/
|
*/
|
||||||
export class Place extends APBase<PlaceFields>{
|
export class Place extends APBase<PlaceFields>{
|
||||||
constructor(fields: PlaceFields) {
|
static create(fields: PlaceFields) {
|
||||||
super({
|
return APBase._create<PlaceFields>({
|
||||||
type: ASModelType.Place,
|
type: ASModelType.Place,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,10 +10,10 @@ import {ProfileFields} from "./Profile.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Profile Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Profile Docs}
|
||||||
*/
|
*/
|
||||||
export class Profile extends APBase<ProfileFields>{
|
export class Profile extends APBase<ProfileFields>{
|
||||||
constructor(fields: ProfileFields) {
|
static create(fields: ProfileFields) {
|
||||||
super({
|
return APBase._create<ProfileFields>({
|
||||||
type: ASModelType.Profile,
|
type: ASModelType.Profile,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,10 +14,10 @@ import {QuestionFields} from "./Question.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Question Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Question Docs}
|
||||||
*/
|
*/
|
||||||
export class Question extends APBase<QuestionFields>{
|
export class Question extends APBase<QuestionFields>{
|
||||||
constructor(fields: QuestionFields) {
|
static create(fields: QuestionFields) {
|
||||||
super({
|
return APBase._create<QuestionFields>({
|
||||||
type: ASModelType.Question,
|
type: ASModelType.Question,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,10 +11,10 @@ import {RelationshipFields} from "./Relationship.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Relationship Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Relationship Docs}
|
||||||
*/
|
*/
|
||||||
export class Relationship extends APBase<RelationshipFields>{
|
export class Relationship extends APBase<RelationshipFields>{
|
||||||
constructor(fields: RelationshipFields) {
|
static create(fields: RelationshipFields) {
|
||||||
super({
|
return APBase._create<RelationshipFields>({
|
||||||
type: ASModelType.Relationship,
|
type: ASModelType.Relationship,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {ServiceFields} from "./Service.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Service Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Service Docs}
|
||||||
*/
|
*/
|
||||||
export class Service extends APBase<ServiceFields>{
|
export class Service extends APBase<ServiceFields>{
|
||||||
constructor(fields: ServiceFields) {
|
static create(fields: ServiceFields) {
|
||||||
super({
|
return APBase._create<ServiceFields>({
|
||||||
type: ASModelType.Service,
|
type: ASModelType.Service,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,10 +10,10 @@ import {TombstoneFields} from "./Tombstone.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Tombstone Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Tombstone Docs}
|
||||||
*/
|
*/
|
||||||
export class Tombstone extends APBase<TombstoneFields>{
|
export class Tombstone extends APBase<TombstoneFields>{
|
||||||
constructor(fields: TombstoneFields) {
|
static create(fields: TombstoneFields) {
|
||||||
super({
|
return APBase._create<TombstoneFields>({
|
||||||
type: ASModelType.Tombstone,
|
type: ASModelType.Tombstone,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,10 +8,10 @@ import {VideoFields} from "./Video.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Video Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Video Docs}
|
||||||
*/
|
*/
|
||||||
export class Video extends APBase<VideoFields>{
|
export class Video extends APBase<VideoFields>{
|
||||||
constructor(fields: VideoFields) {
|
static create(fields: VideoFields) {
|
||||||
super({
|
return APBase._create<VideoFields>({
|
||||||
type: ASModelType.Video,
|
type: ASModelType.Video,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
Ładowanie…
Reference in New Issue