Use as const

#5089
This commit is contained in:
syuilo
2019-06-27 18:04:09 +09:00
parent 6b897e562a
commit 952789cc1e
102 changed files with 853 additions and 966 deletions

View File

@@ -5,7 +5,7 @@ import { unique, concat } from '../../prelude/array';
import { nyaize } from '../../misc/nyaize';
import { Emojis, Users, Apps, PollVotes, DriveFiles, NoteReactions, Followings, Polls } from '..';
import { ensure } from '../../prelude/ensure';
import { SchemaType, types, bool } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
import { awaitAll } from '../../prelude/await-all';
export type PackedNote = SchemaType<typeof packedNoteSchema>;
@@ -218,125 +218,125 @@ export class NoteRepository extends Repository<Note> {
}
export const packedNoteSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this Note.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the Note was created on Misskey.'
},
text: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
},
cw: {
type: types.string,
optional: bool.true, nullable: bool.true,
type: 'string' as const,
optional: true as const, nullable: true as const,
},
userId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
user: {
type: types.object,
type: 'object' as const,
ref: 'User',
optional: bool.false, nullable: bool.false,
optional: false as const, nullable: false as const,
},
replyId: {
type: types.string,
optional: bool.true, nullable: bool.true,
type: 'string' as const,
optional: true as const, nullable: true as const,
format: 'id',
example: 'xxxxxxxxxx',
},
renoteId: {
type: types.string,
optional: bool.true, nullable: bool.true,
type: 'string' as const,
optional: true as const, nullable: true as const,
format: 'id',
example: 'xxxxxxxxxx',
},
reply: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'Note'
},
renote: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'Note'
},
viaMobile: {
type: types.boolean,
optional: bool.true, nullable: bool.false,
type: 'boolean' as const,
optional: true as const, nullable: false as const,
},
isHidden: {
type: types.boolean,
optional: bool.true, nullable: bool.false,
type: 'boolean' as const,
optional: true as const, nullable: false as const,
},
visibility: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
},
mentions: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
}
},
visibleUserIds: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
}
},
fileIds: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
}
},
files: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'DriveFile'
}
},
tags: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
}
},
poll: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
},
geo: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
},
},
};