kopia lustrzana https://github.com/activitypub-js/activitypub-models
APBase Improvements (#4)
* update base model & refactor * implement proxy * update Person model * fix APBase toPlainmain
rodzic
1be5e6a340
commit
7484e2b62a
|
@ -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',
|
||||||
|
@ -55,6 +56,7 @@ export type LanguageTag = string;
|
||||||
export type MediaType = string;
|
export type MediaType = string;
|
||||||
export type Duration = string;
|
export type Duration = string;
|
||||||
|
|
||||||
|
export type ContextValue = string | Record<string, string>;
|
||||||
export type UrlValue = string | Link;
|
export type UrlValue = string | Link;
|
||||||
export type IdValue = string;
|
export type IdValue = string;
|
||||||
export type TypeValue = string;
|
export type TypeValue = string;
|
||||||
|
@ -145,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 +1,15 @@
|
||||||
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 => {
|
||||||
|
const duplicateObj = {} as T;
|
||||||
|
for (const key in obj) {
|
||||||
|
if(typeof obj[key] === 'object') {
|
||||||
|
duplicateObj[key] = cloneObjDeep(obj[key]);
|
||||||
|
} else {
|
||||||
|
duplicateObj[key] = obj[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return duplicateObj;
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import { ActivityFields } from "./Activity.types";
|
import { ActivityFields } from "./Activity.types";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Activity is a subtype of Object that describes some form of action that may happen,
|
* An Activity is a subtype of Object that describes some form of action that may happen,
|
||||||
|
@ -11,10 +11,10 @@ import {ASModelType} from "../../common/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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ import {
|
||||||
OriginValue,
|
OriginValue,
|
||||||
ResultValue,
|
ResultValue,
|
||||||
TargetValue
|
TargetValue
|
||||||
} from "../../common/common.types";
|
} from "../../common/types";
|
||||||
|
|
||||||
export interface ActivityFields extends APObjectFields {
|
export interface ActivityFields extends APObjectFields {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {ActorFields} from "./Actor.types";
|
import {ActorFields} from "./Actor.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ import {
|
||||||
ProxyUrlValue, SharedInboxValue,
|
ProxyUrlValue, SharedInboxValue,
|
||||||
SignClientKeyValue,
|
SignClientKeyValue,
|
||||||
StreamsValue
|
StreamsValue
|
||||||
} from "../../common/common.types";
|
} from "../../common/types";
|
||||||
|
|
||||||
export interface EndpointsValue {
|
export interface EndpointsValue {
|
||||||
|
|
||||||
|
|
|
@ -1,47 +1,65 @@
|
||||||
import { contexts } from "../../common/common.constants";
|
import {cloneObjDeep, hasKey} from "../../common/utils";
|
||||||
|
import { WithContext } from "../../common/types";
|
||||||
|
|
||||||
// TODO: types
|
|
||||||
// TODO: renaming/refactor
|
|
||||||
export type Context = string | any[];
|
|
||||||
|
|
||||||
export interface ModelBaseAPWithContext {
|
export class APBase<T extends WithContext> {
|
||||||
'@context'?: Context;
|
public fields: T;
|
||||||
}
|
|
||||||
|
|
||||||
export class APBase<T> {
|
protected constructor(fields: T) {
|
||||||
public fields: T & ModelBaseAPWithContext;
|
|
||||||
|
|
||||||
constructor(fields: T) {
|
|
||||||
// TODO: make recursive copy
|
|
||||||
this.fields = {
|
this.fields = {
|
||||||
...fields,
|
...cloneObjDeep<T>(fields),
|
||||||
} as T & ModelBaseAPWithContext;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: rewrite (better option to handle multiple contexts)
|
protected static _create<T extends WithContext>(fields: T) {
|
||||||
// some comment
|
const data = new APBase<T>(fields);
|
||||||
public setContext(context?: Context): this {
|
return new Proxy(data, {
|
||||||
this.fields = {
|
get(target: APBase<T>, p: keyof APBase<T> & keyof T) {
|
||||||
['@context']: context || contexts.activityStreamsV2,
|
return hasKey(target, p) ? target[p] : target.fields[p];
|
||||||
...this.fields
|
},
|
||||||
}
|
set(target: APBase<T>, p: keyof APBase<T> & keyof T, newValue: any): boolean {
|
||||||
return this;
|
target.fields[p] = newValue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}) as APBase<T> & T & WithContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public plain(): Record<string, any> {
|
protected parseValue(value: any): any {
|
||||||
|
return value instanceof APBase ? value.toPlain() : value.toValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public toPlain(): Record<string, any> {
|
||||||
const result = {} as Record<string, any>;
|
const result = {} as Record<string, any>;
|
||||||
for (const [key, node] of Object.entries(this.fields)) {
|
if ('@context' in this.fields) {
|
||||||
if (node instanceof APBase) {
|
result['@context'] = this.fields['@context'];
|
||||||
result[key] = node.plain();
|
}
|
||||||
|
for (const [key, value] of Object.entries(this.fields)) {
|
||||||
|
if (key === '@context') continue;
|
||||||
|
|
||||||
|
const isFunction = typeof value === 'function';
|
||||||
|
const isArray = Array.isArray(value);
|
||||||
|
const isNull = value === null;
|
||||||
|
const isUndefined = value === undefined;
|
||||||
|
const isObject = !isArray && !isNull && typeof value === 'object';
|
||||||
|
const isPlain = !isArray && !isNull && !isUndefined && !isObject && !isFunction;
|
||||||
|
|
||||||
|
if (isArray) {
|
||||||
|
result[key] = value.map(v => this.parseValue(v));
|
||||||
|
} else if (isNull || isUndefined) {
|
||||||
|
result[key] = null;
|
||||||
|
} else if (isObject) {
|
||||||
|
result[key] = {};
|
||||||
|
Object.entries(value).forEach(([k, v]) => result[key][k] = this.parseValue(v));
|
||||||
|
} else if (isPlain) {
|
||||||
|
result[key] = this.parseValue(value);
|
||||||
} else {
|
} else {
|
||||||
result[key] = node;
|
throw new Error(`Unable to convert key ${key} with value ${value}. Type of value: ${typeof value}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO make recursive copy
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public json() {
|
public toJSON(): string {
|
||||||
return JSON.stringify(this.plain());
|
return JSON.stringify(this.toPlain());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {APEventFields} from "./APEvent.types";
|
import {APEventFields} from "./APEvent.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import { APObjectFields } from "./APObject.types";
|
import { APObjectFields } from "./APObject.types";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes an object of any kind. The Object type serves as the base type for most of
|
* Describes an object of any kind. The Object type serves as the base type for most of
|
||||||
|
@ -10,10 +10,10 @@ import {ASModelType} from "../../common/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/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}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {ApplicationFields} from "./Application.types";
|
import {ApplicationFields} from "./Application.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {ArticleFields} from "./Article.types";
|
import {ArticleFields} from "./Article.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {AudioFields} from "./Audio.types";
|
import {AudioFields} from "./Audio.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {CollectionFields} from "./Collection.types";
|
import {CollectionFields} from "./Collection.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ import {
|
||||||
CollectionFirstValue, CollectionItemsValue,
|
CollectionFirstValue, CollectionItemsValue,
|
||||||
CollectionLastValue,
|
CollectionLastValue,
|
||||||
TotalItemsValue
|
TotalItemsValue
|
||||||
} from "../../common/common.types";
|
} from "../../common/types";
|
||||||
|
|
||||||
export interface CollectionFields extends APObjectFields {
|
export interface CollectionFields extends APObjectFields {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {CollectionPageFields} from "./CollectionPage.types";
|
import {CollectionPageFields} from "./CollectionPage.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {CollectionFields} from "../collection/Collection.types";
|
import {CollectionFields} from "../collection/Collection.types";
|
||||||
import {CollectionPageNextValue, CollectionPagePartOfValue, CollectionPagePrevValue} from "../../common/common.types";
|
import {CollectionPageNextValue, CollectionPagePartOfValue, CollectionPagePrevValue} from "../../common/types";
|
||||||
|
|
||||||
export interface CollectionPageFields extends CollectionFields {
|
export interface CollectionPageFields extends CollectionFields {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {DocumentFields} from "./Document.types";
|
import {DocumentFields} from "./Document.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {GroupFields} from "./Group.types";
|
import {GroupFields} from "./Group.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {ImageFields} from "./Image.types";
|
import {ImageFields} from "./Image.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {IntransitiveActivityFields} from './IntransitiveActivity.types';
|
import {IntransitiveActivityFields} from './IntransitiveActivity.types';
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instances of intransitiveActivity are a subtype of
|
* Instances of intransitiveActivity are a subtype of
|
||||||
|
@ -10,10 +10,10 @@ import {ASModelType} from "../../common/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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import { LinkFields } from "./Link.types";
|
import { LinkFields } from "./Link.types";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Link is an indirect, qualified reference to a resource identified by a URL.
|
* A Link is an indirect, qualified reference to a resource identified by a URL.
|
||||||
|
@ -13,10 +13,10 @@ import {ASModelType} from "../../common/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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,14 +2,14 @@ import {
|
||||||
HeightValue,
|
HeightValue,
|
||||||
HreflangValue,
|
HreflangValue,
|
||||||
HrefValue,
|
HrefValue,
|
||||||
IdValue,
|
|
||||||
MediaTypeValue,
|
MediaTypeValue,
|
||||||
NameMapValue,
|
NameMapValue,
|
||||||
NameValue, PreviewValue,
|
NameValue, PreviewValue,
|
||||||
RelValue, TypeValue, WidthValue
|
RelValue, TypeValue, WidthValue
|
||||||
} from "../../common/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/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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {NoteFields} from "./Note.types";
|
import {NoteFields} from "./Note.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {OrderedCollectionFields} from "./OrderedCollection.types";
|
import {OrderedCollectionFields} from "./OrderedCollection.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ import {
|
||||||
OrderedCollectionCurrentValue,
|
OrderedCollectionCurrentValue,
|
||||||
OrderedCollectionFirstValue, OrderedCollectionItemsValue,
|
OrderedCollectionFirstValue, OrderedCollectionItemsValue,
|
||||||
OrderedCollectionLastValue
|
OrderedCollectionLastValue
|
||||||
} from "../../common/common.types";
|
} from "../../common/types";
|
||||||
import {CollectionFields} from "../collection/Collection.types";
|
import {CollectionFields} from "../collection/Collection.types";
|
||||||
import {Modify} from "../../common/utils";
|
import {Modify} from "../../common/utils";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {OrderedCollectionPageFields} from "./OrderedCollectionPage.types";
|
import {OrderedCollectionPageFields} from "./OrderedCollectionPage.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ import {
|
||||||
OrderedCollectionPagePartOfValue,
|
OrderedCollectionPagePartOfValue,
|
||||||
OrderedCollectionPagePrevValue,
|
OrderedCollectionPagePrevValue,
|
||||||
StartIndexValue
|
StartIndexValue
|
||||||
} from "../../common/common.types";
|
} from "../../common/types";
|
||||||
import {CollectionPageFields} from "../collectionPage/CollectionPage.types";
|
import {CollectionPageFields} from "../collectionPage/CollectionPage.types";
|
||||||
import {Modify} from "../../common/utils";
|
import {Modify} from "../../common/utils";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {OrganizationFields} from "./Organization.types";
|
import {OrganizationFields} from "./Organization.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {PageFields} from "./Page.types";
|
import {PageFields} from "./Page.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {PersonFields} from "./Person.types";
|
import {PersonFields} from "./Person.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,10 +8,10 @@ import {PersonFields} from "./Person.types";
|
||||||
* {@link https://www.w3.org/ns/activitystreams#Person Docs}
|
* {@link https://www.w3.org/ns/activitystreams#Person Docs}
|
||||||
*/
|
*/
|
||||||
export class Person extends APBase<PersonFields>{
|
export class Person extends APBase<PersonFields>{
|
||||||
constructor(fields: PersonFields) {
|
static create(fields: PersonFields) {
|
||||||
super({
|
return APBase._create<PersonFields>({
|
||||||
type: ASModelType.Person,
|
type: ASModelType.Person,
|
||||||
...fields
|
...fields,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {PlaceFields} from "./Place.types";
|
import {PlaceFields} from "./Place.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ import {
|
||||||
LongitudeValue,
|
LongitudeValue,
|
||||||
RadiusValue,
|
RadiusValue,
|
||||||
UnitsValue
|
UnitsValue
|
||||||
} from "../../common/common.types";
|
} from "../../common/types";
|
||||||
|
|
||||||
|
|
||||||
export interface PlaceFields extends APObjectFields {
|
export interface PlaceFields extends APObjectFields {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {ProfileFields} from "./Profile.types";
|
import {ProfileFields} from "./Profile.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import {APObjectFields} from "../apObject/APObject.types";
|
import {APObjectFields} from "../apObject/APObject.types";
|
||||||
import {DescribesValue} from "../../common/common.types";
|
import {DescribesValue} from "../../common/types";
|
||||||
|
|
||||||
export interface ProfileFields extends APObjectFields {
|
export interface ProfileFields extends APObjectFields {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {QuestionFields} from "./Question.types";
|
import {QuestionFields} from "./Question.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {IntransitiveActivityFields} from "../intransitiveActivity/IntransitiveActivity.types";
|
import {IntransitiveActivityFields} from "../intransitiveActivity/IntransitiveActivity.types";
|
||||||
import {AnyOfValue, ClosedValue, OneOfValue} from "../../common/common.types";
|
import {AnyOfValue, ClosedValue, OneOfValue} from "../../common/types";
|
||||||
|
|
||||||
export interface QuestionFields extends IntransitiveActivityFields {
|
export interface QuestionFields extends IntransitiveActivityFields {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {RelationshipFields} from "./Relationship.types";
|
import {RelationshipFields} from "./Relationship.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APObjectFields} from "../apObject/APObject.types";
|
import {APObjectFields} from "../apObject/APObject.types";
|
||||||
import {SubjectValue, ObjectValue, RelationshipValue} from "../../common/common.types";
|
import {SubjectValue, ObjectValue, RelationshipValue} from "../../common/types";
|
||||||
|
|
||||||
export interface RelationshipFields extends APObjectFields {
|
export interface RelationshipFields extends APObjectFields {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {ServiceFields} from "./Service.types";
|
import {ServiceFields} from "./Service.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {TombstoneFields} from "./Tombstone.types";
|
import {TombstoneFields} from "./Tombstone.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import {DeletedValue, FormerTypeValue} from "../../common/common.types";
|
import {DeletedValue, FormerTypeValue} from "../../common/types";
|
||||||
import {APObjectFields} from "../apObject/APObject.types";
|
import {APObjectFields} from "../apObject/APObject.types";
|
||||||
|
|
||||||
export interface TombstoneFields extends APObjectFields {
|
export interface TombstoneFields extends APObjectFields {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {APBase} from "../apBase/APBase.model";
|
import {APBase} from "../apBase/APBase.model";
|
||||||
import {ASModelType} from "../../common/common.types";
|
import {ASModelType} from "../../common/types";
|
||||||
import {VideoFields} from "./Video.types";
|
import {VideoFields} from "./Video.types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"target": "es2016",
|
"target": "es2017",
|
||||||
"module": "ES6",
|
"module": "ES6",
|
||||||
"moduleResolution": "Node",
|
"moduleResolution": "Node",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|
Ładowanie…
Reference in New Issue