Delete SimpleSchema/SimpleObj
and Move schemas to dedicated files
This commit is contained in:
parent
21b6176d97
commit
59a5d00d6b
|
@ -1,27 +1,26 @@
|
||||||
import { SimpleObj, SimpleSchema } from './simple-schema';
|
import { packedUserSchema } from '@/models/schema/user';
|
||||||
import { packedUserSchema } from '@/models/repositories/user';
|
import { packedNoteSchema } from '@/models/schema/note';
|
||||||
import { packedNoteSchema } from '@/models/repositories/note';
|
import { packedUserListSchema } from '@/models/schema/user-list';
|
||||||
import { packedUserListSchema } from '@/models/repositories/user-list';
|
import { packedAppSchema } from '@/models/schema/app';
|
||||||
import { packedAppSchema } from '@/models/repositories/app';
|
import { packedMessagingMessageSchema } from '@/models/schema/messaging-message';
|
||||||
import { packedMessagingMessageSchema } from '@/models/repositories/messaging-message';
|
import { packedNotificationSchema } from '@/models/schema/notification';
|
||||||
import { packedNotificationSchema } from '@/models/repositories/notification';
|
import { packedDriveFileSchema } from '@/models/schema/drive-file';
|
||||||
import { packedDriveFileSchema } from '@/models/repositories/drive-file';
|
import { packedDriveFolderSchema } from '@/models/schema/drive-folder';
|
||||||
import { packedDriveFolderSchema } from '@/models/repositories/drive-folder';
|
import { packedFollowingSchema } from '@/models/schema/following';
|
||||||
import { packedFollowingSchema } from '@/models/repositories/following';
|
import { packedMutingSchema } from '@/models/schema/muting';
|
||||||
import { packedMutingSchema } from '@/models/repositories/muting';
|
import { packedBlockingSchema } from '@/models/schema/blocking';
|
||||||
import { packedBlockingSchema } from '@/models/repositories/blocking';
|
import { packedNoteReactionSchema } from '@/models/schema/note-reaction';
|
||||||
import { packedNoteReactionSchema } from '@/models/repositories/note-reaction';
|
import { packedHashtagSchema } from '@/models/schema/hashtag';
|
||||||
import { packedHashtagSchema } from '@/models/repositories/hashtag';
|
import { packedPageSchema } from '@/models/schema/page';
|
||||||
import { packedPageSchema } from '@/models/repositories/page';
|
import { packedUserGroupSchema } from '@/models/schema/user-group';
|
||||||
import { packedUserGroupSchema } from '@/models/repositories/user-group';
|
import { packedNoteFavoriteSchema } from '@/models/schema/note-favorite';
|
||||||
import { packedNoteFavoriteSchema } from '@/models/repositories/note-favorite';
|
import { packedChannelSchema } from '@/models/schema/channel';
|
||||||
import { packedChannelSchema } from '@/models/repositories/channel';
|
import { packedAntennaSchema } from '@/models/schema/antenna';
|
||||||
import { packedAntennaSchema } from '@/models/repositories/antenna';
|
import { packedClipSchema } from '@/models/schema/clip';
|
||||||
import { packedClipSchema } from '@/models/repositories/clip';
|
import { packedFederationInstanceSchema } from '@/models/schema/federation-instance';
|
||||||
import { packedFederationInstanceSchema } from '@/models/repositories/federation-instance';
|
import { packedQueueCountSchema } from '@/models/schema/queue';
|
||||||
import { packedQueueCountSchema } from '@/models/repositories/queue';
|
import { packedGalleryPostSchema } from '@/models/schema/gallery-post';
|
||||||
import { packedGalleryPostSchema } from '@/models/repositories/gallery-post';
|
import { packedEmojiSchema } from '@/models/schema/emoji';
|
||||||
import { packedEmojiSchema } from '@/models/repositories/emoji';
|
|
||||||
|
|
||||||
export const refs = {
|
export const refs = {
|
||||||
User: packedUserSchema,
|
User: packedUserSchema,
|
||||||
|
@ -51,10 +50,18 @@ export const refs = {
|
||||||
|
|
||||||
export type Packed<x extends keyof typeof refs> = ObjType<(typeof refs[x])['properties']>;
|
export type Packed<x extends keyof typeof refs> = ObjType<(typeof refs[x])['properties']>;
|
||||||
|
|
||||||
export interface Schema extends SimpleSchema {
|
export interface Schema {
|
||||||
|
type: 'boolean' | 'number' | 'string' | 'array' | 'object' | 'any';
|
||||||
|
nullable: boolean;
|
||||||
|
optional: boolean;
|
||||||
items?: Schema;
|
items?: Schema;
|
||||||
properties?: Obj;
|
properties?: Obj;
|
||||||
|
description?: string;
|
||||||
|
example?: any;
|
||||||
|
format?: string;
|
||||||
ref?: keyof typeof refs;
|
ref?: keyof typeof refs;
|
||||||
|
enum?: string[];
|
||||||
|
default?: boolean | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
type NonUndefinedPropertyNames<T extends Obj> = {
|
type NonUndefinedPropertyNames<T extends Obj> = {
|
||||||
|
@ -68,7 +75,7 @@ type UndefinedPropertyNames<T extends Obj> = {
|
||||||
type OnlyRequired<T extends Obj> = Pick<T, NonUndefinedPropertyNames<T>>;
|
type OnlyRequired<T extends Obj> = Pick<T, NonUndefinedPropertyNames<T>>;
|
||||||
type OnlyOptional<T extends Obj> = Pick<T, UndefinedPropertyNames<T>>;
|
type OnlyOptional<T extends Obj> = Pick<T, UndefinedPropertyNames<T>>;
|
||||||
|
|
||||||
export interface Obj extends SimpleObj { [key: string]: Schema; }
|
export interface Obj { [key: string]: Schema; }
|
||||||
|
|
||||||
export type ObjType<s extends Obj> =
|
export type ObjType<s extends Obj> =
|
||||||
{ [P in keyof OnlyOptional<s>]?: SchemaType<s[P]> } &
|
{ [P in keyof OnlyOptional<s>]?: SchemaType<s[P]> } &
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
export interface SimpleSchema {
|
|
||||||
type: 'boolean' | 'number' | 'string' | 'array' | 'object' | 'any';
|
|
||||||
nullable: boolean;
|
|
||||||
optional: boolean;
|
|
||||||
items?: SimpleSchema;
|
|
||||||
properties?: SimpleObj;
|
|
||||||
description?: string;
|
|
||||||
example?: any;
|
|
||||||
format?: string;
|
|
||||||
ref?: string;
|
|
||||||
enum?: string[];
|
|
||||||
default?: boolean | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SimpleObj { [key: string]: SimpleSchema; }
|
|
|
@ -31,94 +31,3 @@ export class AntennaRepository extends Repository<Antenna> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedAntennaSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
keywords: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
excludeKeywords: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
src: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
enum: ['home', 'all', 'users', 'list', 'group'],
|
|
||||||
},
|
|
||||||
userListId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
userGroupId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
users: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
caseSensitive: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
notify: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
withReplies: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
withFile: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
hasUnreadNote: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -38,38 +38,3 @@ export class AppRepository extends Repository<App> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedAppSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
callbackUrl: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
permission: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
secret: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
isAuthorized: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -30,31 +30,3 @@ export class BlockingRepository extends Repository<Blocking> {
|
||||||
return Promise.all(blockings.map(x => this.pack(x, me)));
|
return Promise.all(blockings.map(x => this.pack(x, me)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedBlockingSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
blockeeId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
blockee: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -40,56 +40,3 @@ export class ChannelRepository extends Repository<Channel> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedChannelSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
lastNotedAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: false as const,
|
|
||||||
},
|
|
||||||
bannerUrl: {
|
|
||||||
type: 'string' as const,
|
|
||||||
format: 'url',
|
|
||||||
nullable: true as const, optional: false as const,
|
|
||||||
},
|
|
||||||
notesCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
},
|
|
||||||
usersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
},
|
|
||||||
isFollowing: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -29,42 +29,3 @@ export class ClipRepository extends Repository<Clip> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedClipSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: 'object' as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
isPublic: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -156,112 +156,3 @@ export class DriveFileRepository extends Repository<DriveFile> {
|
||||||
return items.filter(x => x != null);
|
return items.filter(x => x != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedDriveFileSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
example: 'lenna.jpg',
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
example: 'image/jpeg',
|
|
||||||
},
|
|
||||||
md5: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'md5',
|
|
||||||
example: '15eca7fba0480996e2245f5185bf39f2',
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
example: 51469,
|
|
||||||
},
|
|
||||||
isSensitive: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
blurhash: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
width: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
example: 1280,
|
|
||||||
},
|
|
||||||
height: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
example: 720,
|
|
||||||
},
|
|
||||||
orientation: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
example: 8,
|
|
||||||
},
|
|
||||||
avgColor: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
example: 'rgb(40,65,87)',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'url',
|
|
||||||
},
|
|
||||||
thumbnailUrl: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'url',
|
|
||||||
},
|
|
||||||
comment: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
folderId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
folder: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
ref: 'DriveFolder' as const,
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -48,44 +48,3 @@ export class DriveFolderRepository extends Repository<DriveFolder> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedDriveFolderSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
foldersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
filesCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
parentId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
parent: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
ref: 'DriveFolder' as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -25,41 +25,3 @@ export class EmojiRepository extends Repository<Emoji> {
|
||||||
return Promise.all(emojis.map(x => this.pack(x)));
|
return Promise.all(emojis.map(x => this.pack(x)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedEmojiSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
aliases: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
category: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
host: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,106 +1,2 @@
|
||||||
import config from '@/config/index';
|
import config from '@/config/index';
|
||||||
|
|
||||||
export const packedFederationInstanceSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
caughtAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
host: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
example: 'misskey.example.com',
|
|
||||||
},
|
|
||||||
usersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
notesCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
followingCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
followersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
driveUsage: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
driveFiles: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
latestRequestSentAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
lastCommunicatedAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
isNotResponding: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
isSuspended: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
softwareName: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
example: 'misskey',
|
|
||||||
},
|
|
||||||
softwareVersion: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
example: config.version,
|
|
||||||
},
|
|
||||||
openRegistrations: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
example: true,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
maintainerName: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
maintainerEmail: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
iconUrl: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'url',
|
|
||||||
},
|
|
||||||
infoUpdatedAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -84,41 +84,3 @@ export class FollowingRepository extends Repository<Following> {
|
||||||
return Promise.all(followings.map(x => this.pack(x, me, opts)));
|
return Promise.all(followings.map(x => this.pack(x, me, opts)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedFollowingSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
followeeId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
followee: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
},
|
|
||||||
followerId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
follower: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -38,74 +38,3 @@ export class GalleryPostRepository extends Repository<GalleryPost> {
|
||||||
return Promise.all(posts.map(x => this.pack(x, me)));
|
return Promise.all(posts.map(x => this.pack(x, me)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedGalleryPostSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
updatedAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: 'object' as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
fileIds: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
ref: 'DriveFile' as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tags: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
isSensitive: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -24,39 +24,3 @@ export class HashtagRepository extends Repository<Hashtag> {
|
||||||
return Promise.all(hashtags.map(x => this.pack(x)));
|
return Promise.all(hashtags.map(x => this.pack(x)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedHashtagSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
tag: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
example: 'misskey',
|
|
||||||
},
|
|
||||||
mentionedUsersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
mentionedLocalUsersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
mentionedRemoteUsersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
attachedUsersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
attachedLocalUsersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
attachedRemoteUsersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -42,78 +42,3 @@ export class MessagingMessageRepository extends Repository<MessagingMessage> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedMessagingMessageSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: 'object' as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
fileId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
file: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
ref: 'DriveFile' as const,
|
|
||||||
},
|
|
||||||
recipientId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
recipient: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
},
|
|
||||||
groupId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
group: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
ref: 'UserGroup' as const,
|
|
||||||
},
|
|
||||||
isRead: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
reads: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -30,31 +30,3 @@ export class MutingRepository extends Repository<Muting> {
|
||||||
return Promise.all(mutings.map(x => this.pack(x, me)));
|
return Promise.all(mutings.map(x => this.pack(x, me)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedMutingSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
muteeId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
mutee: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -26,31 +26,3 @@ export class NoteFavoriteRepository extends Repository<NoteFavorite> {
|
||||||
return Promise.all(favorites.map(x => this.pack(x, me)));
|
return Promise.all(favorites.map(x => this.pack(x, me)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedNoteFavoriteSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
note: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
ref: 'Note' as const,
|
|
||||||
},
|
|
||||||
noteId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -31,30 +31,3 @@ export class NoteReactionRepository extends Repository<NoteReaction> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedNoteReactionSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -320,188 +320,3 @@ export class NoteRepository extends Repository<Note> {
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedNoteSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
cw: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: 'object' as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
replyId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
renoteId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
reply: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
ref: 'Note' as const,
|
|
||||||
},
|
|
||||||
renote: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
ref: 'Note' as const,
|
|
||||||
},
|
|
||||||
isHidden: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
visibility: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
mentions: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
visibleUserIds: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
fileIds: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
ref: 'DriveFile' as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tags: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
poll: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
channelId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
channel: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
items: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
localOnly: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
emojis: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
reactions: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
renoteCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
repliesCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
uri: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
|
|
||||||
myReaction: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -107,69 +107,3 @@ export class NotificationRepository extends Repository<Notification> {
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedNotificationSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
isRead: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
enum: [...notificationTypes],
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: 'object' as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
note: {
|
|
||||||
type: 'object' as const,
|
|
||||||
ref: 'Note' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
reaction: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
choice: {
|
|
||||||
type: 'number' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
invitation: {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
icon: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: true as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -87,56 +87,3 @@ export class PageRepository extends Repository<Page> {
|
||||||
return Promise.all(pages.map(x => this.pack(x, me)));
|
return Promise.all(pages.map(x => this.pack(x, me)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedPageSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
updatedAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
summary: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: true as const,
|
|
||||||
},
|
|
||||||
content: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
variables: {
|
|
||||||
type: 'array' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: 'object' as const,
|
|
||||||
ref: 'User' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -23,39 +23,3 @@ export class UserGroupRepository extends Repository<UserGroup> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedUserGroupSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
ownerId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
userIds: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -22,34 +22,3 @@ export class UserListRepository extends Repository<UserList> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedUserListSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
optional: false as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
userIds: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -352,313 +352,3 @@ export class UserRepository extends Repository<User> {
|
||||||
public validateBirthday = $.str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/);
|
public validateBirthday = $.str.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/);
|
||||||
//#endregion
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
export const packedUserSchema = {
|
|
||||||
type: 'object' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: false as const,
|
|
||||||
example: '藍',
|
|
||||||
},
|
|
||||||
username: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
example: 'ai',
|
|
||||||
},
|
|
||||||
host: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: false as const,
|
|
||||||
example: 'misskey.example.com',
|
|
||||||
},
|
|
||||||
avatarUrl: {
|
|
||||||
type: 'string' as const,
|
|
||||||
format: 'url',
|
|
||||||
nullable: true as const, optional: false as const,
|
|
||||||
},
|
|
||||||
avatarBlurhash: {
|
|
||||||
type: 'any' as const,
|
|
||||||
nullable: true as const, optional: false as const,
|
|
||||||
},
|
|
||||||
avatarColor: {
|
|
||||||
type: 'any' as const,
|
|
||||||
nullable: true as const, optional: false as const,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
isAdmin: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
isModerator: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
isBot: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
isCat: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
emojis: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
items: {
|
|
||||||
type: 'object' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
properties: {
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
format: 'url',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: 'string' as const,
|
|
||||||
format: 'url',
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
updatedAt: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
bannerUrl: {
|
|
||||||
type: 'string' as const,
|
|
||||||
format: 'url',
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
},
|
|
||||||
bannerBlurhash: {
|
|
||||||
type: 'any' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
},
|
|
||||||
bannerColor: {
|
|
||||||
type: 'any' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
isLocked: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
isSuspended: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
example: false,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
example: 'Hi masters, I am Ai!',
|
|
||||||
},
|
|
||||||
location: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
},
|
|
||||||
birthday: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
example: '2018-03-12',
|
|
||||||
},
|
|
||||||
fields: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
items: {
|
|
||||||
type: 'object' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
properties: {
|
|
||||||
name: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
maxLength: 4,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
followersCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
followingCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
notesCount: {
|
|
||||||
type: 'number' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
pinnedNoteIds: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
items: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
pinnedNotes: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
items: {
|
|
||||||
type: 'object' as const,
|
|
||||||
nullable: false as const, optional: false as const,
|
|
||||||
ref: 'Note' as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
pinnedPageId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
},
|
|
||||||
pinnedPage: {
|
|
||||||
type: 'object' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
ref: 'Page' as const,
|
|
||||||
},
|
|
||||||
twoFactorEnabled: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
usePasswordLessLogin: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
securityKeys: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
avatarId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
bannerId: {
|
|
||||||
type: 'string' as const,
|
|
||||||
nullable: true as const, optional: true as const,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
autoWatch: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
injectFeaturedNote: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
alwaysMarkNsfw: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
carefulBot: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
autoAcceptFollowed: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
hasUnreadSpecifiedNotes: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
hasUnreadMentions: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
hasUnreadAnnouncement: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
hasUnreadAntenna: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
hasUnreadChannel: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
hasUnreadMessagingMessage: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
hasUnreadNotification: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
hasPendingReceivedFollowRequest: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
integrations: {
|
|
||||||
type: 'object' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
mutedWords: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
mutedInstances: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
mutingNotificationTypes: {
|
|
||||||
type: 'array' as const,
|
|
||||||
nullable: false as const, optional: true as const,
|
|
||||||
},
|
|
||||||
isFollowing: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
hasPendingFollowRequestFromYou: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
hasPendingFollowRequestToYou: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
isFollowed: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
isBlocking: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
isBlocked: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
isMuted: {
|
|
||||||
type: 'boolean' as const,
|
|
||||||
optional: true as const, nullable: false as const,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
export const packedAntennaSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
keywords: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
excludeKeywords: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
src: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
enum: ['home', 'all', 'users', 'list', 'group'],
|
||||||
|
},
|
||||||
|
userListId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
userGroupId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
users: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
caseSensitive: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
notify: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
withReplies: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
withFile: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
hasUnreadNote: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,34 @@
|
||||||
|
export const packedAppSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
callbackUrl: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
permission: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
secret: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
isAuthorized: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
export const packedBlockingSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
blockeeId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
blockee: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,52 @@
|
||||||
|
export const packedChannelSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
lastNotedAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: false as const,
|
||||||
|
},
|
||||||
|
bannerUrl: {
|
||||||
|
type: 'string' as const,
|
||||||
|
format: 'url',
|
||||||
|
nullable: true as const, optional: false as const,
|
||||||
|
},
|
||||||
|
notesCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
},
|
||||||
|
usersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
},
|
||||||
|
isFollowing: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,39 @@
|
||||||
|
export const packedClipSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: 'object' as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
isPublic: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,108 @@
|
||||||
|
export const packedDriveFileSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
example: 'lenna.jpg',
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
example: 'image/jpeg',
|
||||||
|
},
|
||||||
|
md5: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'md5',
|
||||||
|
example: '15eca7fba0480996e2245f5185bf39f2',
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
example: 51469,
|
||||||
|
},
|
||||||
|
isSensitive: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
blurhash: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
properties: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
width: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
example: 1280,
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
example: 720,
|
||||||
|
},
|
||||||
|
orientation: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
example: 8,
|
||||||
|
},
|
||||||
|
avgColor: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
example: 'rgb(40,65,87)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'url',
|
||||||
|
},
|
||||||
|
thumbnailUrl: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'url',
|
||||||
|
},
|
||||||
|
comment: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
folderId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
folder: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
ref: 'DriveFolder' as const,
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,40 @@
|
||||||
|
export const packedDriveFolderSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
foldersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
filesCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
parentId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
parent: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
ref: 'DriveFolder' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,37 @@
|
||||||
|
export const packedEmojiSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
aliases: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
category: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
host: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,106 @@
|
||||||
|
import config from "@/config";
|
||||||
|
|
||||||
|
export const packedFederationInstanceSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
caughtAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
host: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
example: 'misskey.example.com',
|
||||||
|
},
|
||||||
|
usersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
notesCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
followingCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
followersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
driveUsage: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
driveFiles: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
latestRequestSentAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
lastCommunicatedAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
isNotResponding: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
isSuspended: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
softwareName: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
example: 'misskey',
|
||||||
|
},
|
||||||
|
softwareVersion: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
example: config.version,
|
||||||
|
},
|
||||||
|
openRegistrations: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
example: true,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
maintainerName: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
maintainerEmail: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
iconUrl: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'url',
|
||||||
|
},
|
||||||
|
infoUpdatedAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,37 @@
|
||||||
|
export const packedFollowingSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
followeeId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
followee: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
},
|
||||||
|
followerId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
follower: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,70 @@
|
||||||
|
export const packedGalleryPostSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
updatedAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: 'object' as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
fileIds: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
files: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
ref: 'DriveFile' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tags: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
isSensitive: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,35 @@
|
||||||
|
export const packedHashtagSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
tag: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
example: 'misskey',
|
||||||
|
},
|
||||||
|
mentionedUsersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
mentionedLocalUsersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
mentionedRemoteUsersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
attachedUsersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
attachedLocalUsersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
attachedRemoteUsersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,74 @@
|
||||||
|
export const packedMessagingMessageSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: 'object' as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
fileId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
file: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
ref: 'DriveFile' as const,
|
||||||
|
},
|
||||||
|
recipientId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
recipient: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
},
|
||||||
|
groupId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
group: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
ref: 'UserGroup' as const,
|
||||||
|
},
|
||||||
|
isRead: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
reads: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
export const packedMutingSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
muteeId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
mutee: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
export const packedNoteFavoriteSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
ref: 'Note' as const,
|
||||||
|
},
|
||||||
|
noteId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,26 @@
|
||||||
|
export const packedNoteReactionSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,184 @@
|
||||||
|
export const packedNoteSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
cw: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: 'object' as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
replyId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
renoteId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
reply: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
ref: 'Note' as const,
|
||||||
|
},
|
||||||
|
renote: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
ref: 'Note' as const,
|
||||||
|
},
|
||||||
|
isHidden: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
visibility: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
mentions: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
visibleUserIds: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fileIds: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
files: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
ref: 'DriveFile' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tags: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
poll: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
channelId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
channel: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
items: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
localOnly: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
emojis: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
reactions: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
renoteCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
repliesCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
uri: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
|
||||||
|
myReaction: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,67 @@
|
||||||
|
import { notificationTypes } from "@/types";
|
||||||
|
|
||||||
|
export const packedNotificationSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
isRead: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
enum: [...notificationTypes],
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: 'object' as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
note: {
|
||||||
|
type: 'object' as const,
|
||||||
|
ref: 'Note' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
reaction: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
choice: {
|
||||||
|
type: 'number' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
invitation: {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: true as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,52 @@
|
||||||
|
export const packedPageSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
updatedAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
summary: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: true as const,
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
variables: {
|
||||||
|
type: 'array' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
user: {
|
||||||
|
type: 'object' as const,
|
||||||
|
ref: 'User' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,35 @@
|
||||||
|
export const packedUserGroupSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
ownerId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
userIds: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,30 @@
|
||||||
|
export const packedUserListSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
optional: false as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
userIds: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,309 @@
|
||||||
|
export const packedUserSchema = {
|
||||||
|
type: 'object' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
format: 'id',
|
||||||
|
example: 'xxxxxxxxxx',
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: false as const,
|
||||||
|
example: '藍',
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
example: 'ai',
|
||||||
|
},
|
||||||
|
host: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: false as const,
|
||||||
|
example: 'misskey.example.com',
|
||||||
|
},
|
||||||
|
avatarUrl: {
|
||||||
|
type: 'string' as const,
|
||||||
|
format: 'url',
|
||||||
|
nullable: true as const, optional: false as const,
|
||||||
|
},
|
||||||
|
avatarBlurhash: {
|
||||||
|
type: 'any' as const,
|
||||||
|
nullable: true as const, optional: false as const,
|
||||||
|
},
|
||||||
|
avatarColor: {
|
||||||
|
type: 'any' as const,
|
||||||
|
nullable: true as const, optional: false as const,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
isAdmin: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
isModerator: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
isBot: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
isCat: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
emojis: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
items: {
|
||||||
|
type: 'object' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
properties: {
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
format: 'url',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: 'string' as const,
|
||||||
|
format: 'url',
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
updatedAt: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
format: 'date-time',
|
||||||
|
},
|
||||||
|
bannerUrl: {
|
||||||
|
type: 'string' as const,
|
||||||
|
format: 'url',
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
},
|
||||||
|
bannerBlurhash: {
|
||||||
|
type: 'any' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
},
|
||||||
|
bannerColor: {
|
||||||
|
type: 'any' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
isLocked: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
isSuspended: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
example: false,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
example: 'Hi masters, I am Ai!',
|
||||||
|
},
|
||||||
|
location: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
},
|
||||||
|
birthday: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
example: '2018-03-12',
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
items: {
|
||||||
|
type: 'object' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
properties: {
|
||||||
|
name: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
maxLength: 4,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
followersCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
followingCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
notesCount: {
|
||||||
|
type: 'number' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
pinnedNoteIds: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
items: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pinnedNotes: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
items: {
|
||||||
|
type: 'object' as const,
|
||||||
|
nullable: false as const, optional: false as const,
|
||||||
|
ref: 'Note' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pinnedPageId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
},
|
||||||
|
pinnedPage: {
|
||||||
|
type: 'object' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
ref: 'Page' as const,
|
||||||
|
},
|
||||||
|
twoFactorEnabled: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
usePasswordLessLogin: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
securityKeys: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
avatarId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
bannerId: {
|
||||||
|
type: 'string' as const,
|
||||||
|
nullable: true as const, optional: true as const,
|
||||||
|
format: 'id',
|
||||||
|
},
|
||||||
|
autoWatch: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
injectFeaturedNote: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
alwaysMarkNsfw: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
carefulBot: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
autoAcceptFollowed: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
hasUnreadSpecifiedNotes: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
hasUnreadMentions: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
hasUnreadAnnouncement: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
hasUnreadAntenna: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
hasUnreadChannel: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
hasUnreadMessagingMessage: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
hasUnreadNotification: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
hasPendingReceivedFollowRequest: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
integrations: {
|
||||||
|
type: 'object' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
mutedWords: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
mutedInstances: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
mutingNotificationTypes: {
|
||||||
|
type: 'array' as const,
|
||||||
|
nullable: false as const, optional: true as const,
|
||||||
|
},
|
||||||
|
isFollowing: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
hasPendingFollowRequestFromYou: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
hasPendingFollowRequestToYou: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
isFollowed: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
isBlocking: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
isBlocked: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
isMuted: {
|
||||||
|
type: 'boolean' as const,
|
||||||
|
optional: true as const, nullable: false as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -7,7 +7,7 @@
|
||||||
import * as nestedProperty from 'nested-property';
|
import * as nestedProperty from 'nested-property';
|
||||||
import autobind from 'autobind-decorator';
|
import autobind from 'autobind-decorator';
|
||||||
import Logger from '../logger';
|
import Logger from '../logger';
|
||||||
import { SimpleSchema } from '@/misc/simple-schema';
|
import { Schema } from '@/misc/schema';
|
||||||
import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm';
|
import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm';
|
||||||
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '@/prelude/time';
|
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '@/prelude/time';
|
||||||
import { getChartInsertLock } from '@/misc/app-lock';
|
import { getChartInsertLock } from '@/misc/app-lock';
|
||||||
|
@ -57,7 +57,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
diff: DeepPartial<T>;
|
diff: DeepPartial<T>;
|
||||||
group: string | null;
|
group: string | null;
|
||||||
}[] = [];
|
}[] = [];
|
||||||
public schema: SimpleSchema;
|
public schema: Schema;
|
||||||
protected repositoryForHour: Repository<Log>;
|
protected repositoryForHour: Repository<Log>;
|
||||||
protected repositoryForDay: Repository<Log>;
|
protected repositoryForDay: Repository<Log>;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
protected abstract fetchActual(group: string | null): Promise<DeepPartial<T>>;
|
protected abstract fetchActual(group: string | null): Promise<DeepPartial<T>>;
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
private static convertSchemaToFlatColumnDefinitions(schema: SimpleSchema) {
|
private static convertSchemaToFlatColumnDefinitions(schema: Schema) {
|
||||||
const columns = {} as Record<string, unknown>;
|
const columns = {} as Record<string, unknown>;
|
||||||
const flatColumns = (x: Obj, path?: string) => {
|
const flatColumns = (x: Obj, path?: string) => {
|
||||||
for (const [k, v] of Object.entries(x)) {
|
for (const [k, v] of Object.entries(x)) {
|
||||||
|
@ -183,7 +183,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public static schemaToEntity(name: string, schema: SimpleSchema, grouped = false): {
|
public static schemaToEntity(name: string, schema: Schema, grouped = false): {
|
||||||
hour: EntitySchema,
|
hour: EntitySchema,
|
||||||
day: EntitySchema,
|
day: EntitySchema,
|
||||||
} {
|
} {
|
||||||
|
@ -233,7 +233,7 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(name: string, schema: SimpleSchema, grouped = false) {
|
constructor(name: string, schema: Schema, grouped = false) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.schema = schema;
|
this.schema = schema;
|
||||||
|
|
||||||
|
@ -573,8 +573,8 @@ export default abstract class Chart<T extends Record<string, any>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertLog(logSchema: SimpleSchema): SimpleSchema {
|
export function convertLog(logSchema: Schema): Schema {
|
||||||
const v: SimpleSchema = JSON.parse(JSON.stringify(logSchema)); // copy
|
const v: Schema = JSON.parse(JSON.stringify(logSchema)); // copy
|
||||||
if (v.type === 'number') {
|
if (v.type === 'number') {
|
||||||
v.type = 'array';
|
v.type = 'array';
|
||||||
v.items = {
|
v.items = {
|
||||||
|
|
Loading…
Reference in New Issue