kopia lustrzana https://github.com/activitypub-js/activitypub-models
fix and refactor
rodzic
6b9dacb046
commit
d2b060ca22
|
@ -1,4 +1,22 @@
|
||||||
import {ASObject} from "../models/asObject/ASObject.model";
|
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 {
|
export enum ASModelType {
|
||||||
Object = 'Object',
|
Object = 'Object',
|
||||||
|
@ -29,36 +47,18 @@ export enum ASModelType {
|
||||||
OrderedCollectionPage = 'OrderedCollectionPage',
|
OrderedCollectionPage = 'OrderedCollectionPage',
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Modify<T, R> = Omit<T, keyof R> & R;
|
|
||||||
|
|
||||||
// TODO: implement
|
|
||||||
export type Image = 'placeholder';
|
|
||||||
export type Article = 'placeholder';
|
|
||||||
export type Audio = 'placeholder';
|
|
||||||
export type Document = 'placeholder';
|
|
||||||
export type Event = 'placeholder';
|
|
||||||
export type Note = 'placeholder';
|
|
||||||
export type Page = 'placeholder';
|
|
||||||
export type Place = 'placeholder';
|
|
||||||
export type Profile = 'placeholder';
|
|
||||||
export type Relationship = 'placeholder';
|
|
||||||
export type Tombstone = 'placeholder';
|
|
||||||
export type Video = 'placeholder';
|
|
||||||
export type Mention = 'placeholder';
|
|
||||||
export type Link = 'placeholder';
|
|
||||||
export type OrderedCollection = 'placeholder';
|
|
||||||
export type Collection = 'placeholder';
|
|
||||||
export type CollectionPage = 'placeholder';
|
|
||||||
export type OrderedCollectionPage = 'placeholder';
|
|
||||||
export type AnyCollection = Collection | OrderedCollection;
|
export type AnyCollection = Collection | OrderedCollection;
|
||||||
export type AnyASObject = ASObject | Article | Audio | Document | Event | Image | Note | Page | Place | Profile | Relationship | Tombstone | Video | AnyCollection;
|
export type AnyASObject = ASObject | Article | Audio | Document | ASEvent | Image | Note | Page | Place | Profile | Relationship | Tombstone | Video | AnyCollection;
|
||||||
|
|
||||||
export type DateTime = string;
|
export type DateTime = string;
|
||||||
export type LanguageTag = string;
|
export type LanguageTag = string;
|
||||||
export type MediaType = string;
|
export type MediaType = string;
|
||||||
export type Duration = string;
|
export type Duration = 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;
|
||||||
|
export type DurationValue = Duration;
|
||||||
export type ContentValue = string;
|
export type ContentValue = string;
|
||||||
export type ContentMapValue = Record<string, string>;
|
export type ContentMapValue = Record<string, string>;
|
||||||
export type MediaTypeValue = MediaType;
|
export type MediaTypeValue = MediaType;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export type Modify<T, R> = Omit<T, keyof R> & R;
|
|
@ -1,6 +1,4 @@
|
||||||
import {
|
import {
|
||||||
DateTime,
|
|
||||||
Duration,
|
|
||||||
UrlValue,
|
UrlValue,
|
||||||
IconValue,
|
IconValue,
|
||||||
ImageValue,
|
ImageValue,
|
||||||
|
@ -16,7 +14,6 @@ import {
|
||||||
AttributedToValue,
|
AttributedToValue,
|
||||||
TagValue,
|
TagValue,
|
||||||
GeneratorValue,
|
GeneratorValue,
|
||||||
Collection,
|
|
||||||
IdValue,
|
IdValue,
|
||||||
TypeValue,
|
TypeValue,
|
||||||
ContentValue,
|
ContentValue,
|
||||||
|
@ -24,7 +21,14 @@ import {
|
||||||
MediaTypeValue,
|
MediaTypeValue,
|
||||||
NameValue,
|
NameValue,
|
||||||
NameMapValue,
|
NameMapValue,
|
||||||
EndTimeValue, StartTimeValue, PublishedValue, RepliesValue, SummaryValue, SummaryMapValue, UpdatedValue,
|
EndTimeValue,
|
||||||
|
StartTimeValue,
|
||||||
|
PublishedValue,
|
||||||
|
RepliesValue,
|
||||||
|
SummaryValue,
|
||||||
|
SummaryMapValue,
|
||||||
|
UpdatedValue,
|
||||||
|
DurationValue,
|
||||||
} from "../../common/common.types";
|
} from "../../common/common.types";
|
||||||
|
|
||||||
export interface ASObjectFields {
|
export interface ASObjectFields {
|
||||||
|
@ -318,5 +322,5 @@ export interface ASObjectFields {
|
||||||
* P1DT2H (1 day, 2 hours)
|
* P1DT2H (1 day, 2 hours)
|
||||||
* P2Y6M5DT12H35M30S (2 years, 6 months, 5 days, 12 hours, 35 minutes, 30 seconds)
|
* P2Y6M5DT12H35M30S (2 years, 6 months, 5 days, 12 hours, 35 minutes, 30 seconds)
|
||||||
*/
|
*/
|
||||||
duration?: Duration;
|
duration?: DurationValue;
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
import {
|
import {
|
||||||
Modify,
|
|
||||||
OrderedCollectionCurrentValue,
|
OrderedCollectionCurrentValue,
|
||||||
OrderedCollectionFirstValue, OrderedCollectionItemsValue,
|
OrderedCollectionFirstValue, OrderedCollectionItemsValue,
|
||||||
OrderedCollectionLastValue
|
OrderedCollectionLastValue
|
||||||
} from "../../common/common.types";
|
} from "../../common/common.types";
|
||||||
import {CollectionFields} from "../collection/Collection.types";
|
import {CollectionFields} from "../collection/Collection.types";
|
||||||
|
import {Modify} from "../../common/utils";
|
||||||
|
|
||||||
export interface OrderedCollectionFields extends Modify<CollectionFields, {
|
export interface OrderedCollectionFields extends Modify<CollectionFields, {
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
import {OrderedCollectionFields} from "../orderedCollection/OrderedCollection.types";
|
import {OrderedCollectionFields} from "../orderedCollection/OrderedCollection.types";
|
||||||
import {
|
import {
|
||||||
Modify,
|
|
||||||
OrderedCollectionPageNextValue,
|
OrderedCollectionPageNextValue,
|
||||||
OrderedCollectionPagePartOfValue,
|
OrderedCollectionPagePartOfValue,
|
||||||
OrderedCollectionPagePrevValue,
|
OrderedCollectionPagePrevValue,
|
||||||
StartIndexValue
|
StartIndexValue
|
||||||
} from "../../common/common.types";
|
} from "../../common/common.types";
|
||||||
import {CollectionPageFields} from "../collectionPage/CollectionPage.types";
|
import {CollectionPageFields} from "../collectionPage/CollectionPage.types";
|
||||||
|
import {Modify} from "../../common/utils";
|
||||||
|
|
||||||
|
interface OmittedCollectionPageFields extends Omit<CollectionPageFields, 'current' | 'first' | 'items' | 'last'> {}
|
||||||
|
|
||||||
export interface OrderedCollectionPageFields
|
export interface OrderedCollectionPageFields
|
||||||
extends
|
extends
|
||||||
OrderedCollectionFields,
|
OrderedCollectionFields,
|
||||||
Modify<CollectionPageFields, {
|
Modify<OmittedCollectionPageFields, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies the OrderedCollection to which a OrderedCollectionPage objects items belong.
|
* Identifies the OrderedCollection to which a OrderedCollectionPage objects items belong.
|
||||||
|
|
Ładowanie…
Reference in New Issue