refactor: use path alias to improve readability

This commit is contained in:
syuilo 2021-08-19 22:04:15 +09:00
parent 6d881d4570
commit 97f2675d40
55 changed files with 92 additions and 92 deletions

View File

@ -7,7 +7,7 @@ import { getConnection } from 'typeorm';
import Logger from '@/services/logger';
import loadConfig from '@/config/load';
import { Config } from '@/config/types';
import { lessThan } from '../prelude/array';
import { lessThan } from '@/prelude/array';
import { program } from '../argv';
import { showMachineInfo } from '@/misc/show-machine-info';
import { initDb } from '../db/postgre';

View File

@ -1,4 +1,4 @@
import { count, concat } from '../../prelude/array';
import { count, concat } from '@/prelude/array';
// MISSKEY REVERSI ENGINE

View File

@ -1,7 +1,7 @@
import { JSDOM } from 'jsdom';
import * as mfm from 'mfm-js';
import config from '@/config/index';
import { intersperse } from '../prelude/array';
import { intersperse } from '@/prelude/array';
import { IMentionedRemoteUsers } from '@/models/entities/note';
import { wellKnownServices } from '../well-known-services';

View File

@ -1,7 +1,7 @@
import { EntityRepository, Repository } from 'typeorm';
import { Users } from '../index';
import { AbuseUserReport } from '../entities/abuse-user-report';
import { awaitAll } from '../../prelude/await-all';
import { AbuseUserReport } from '@/models/entities/abuse-user-report';
import { awaitAll } from '@/prelude/await-all';
@EntityRepository(AbuseUserReport)
export class AbuseUserReportRepository extends Repository<AbuseUserReport> {

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { Antenna } from '../entities/antenna';
import { Antenna } from '@/models/entities/antenna';
import { SchemaType } from '@/misc/schema';
import { AntennaNotes, UserGroupJoinings } from '../index';

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { App } from '../entities/app';
import { App } from '@/models/entities/app';
import { AccessTokens } from '../index';
import { SchemaType } from '@/misc/schema';

View File

@ -1,8 +1,8 @@
import { EntityRepository, Repository } from 'typeorm';
import { Apps } from '../index';
import { AuthSession } from '../entities/auth-session';
import { awaitAll } from '../../prelude/await-all';
import { User } from '../entities/user';
import { AuthSession } from '@/models/entities/auth-session';
import { awaitAll } from '@/prelude/await-all';
import { User } from '@/models/entities/user';
@EntityRepository(AuthSession)
export class AuthSessionRepository extends Repository<AuthSession> {

View File

@ -1,9 +1,9 @@
import { EntityRepository, Repository } from 'typeorm';
import { Users } from '../index';
import { Blocking } from '../entities/blocking';
import { awaitAll } from '../../prelude/await-all';
import { Blocking } from '@/models/entities/blocking';
import { awaitAll } from '@/prelude/await-all';
import { SchemaType } from '@/misc/schema';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
export type PackedBlocking = SchemaType<typeof packedBlockingSchema>;

View File

@ -1,8 +1,8 @@
import { EntityRepository, Repository } from 'typeorm';
import { Channel } from '../entities/channel';
import { Channel } from '@/models/entities/channel';
import { SchemaType } from '@/misc/schema';
import { DriveFiles, ChannelFollowings, NoteUnreads } from '../index';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
export type PackedChannel = SchemaType<typeof packedChannelSchema>;

View File

@ -1,8 +1,8 @@
import { EntityRepository, Repository } from 'typeorm';
import { Clip } from '../entities/clip';
import { Clip } from '@/models/entities/clip';
import { SchemaType } from '@/misc/schema';
import { Users } from '../index';
import { awaitAll } from '../../prelude/await-all';
import { awaitAll } from '@/prelude/await-all';
export type PackedClip = SchemaType<typeof packedClipSchema>;

View File

@ -1,13 +1,13 @@
import { EntityRepository, Repository } from 'typeorm';
import { DriveFile } from '../entities/drive-file';
import { DriveFile } from '@/models/entities/drive-file';
import { Users, DriveFolders } from '../index';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
import { toPuny } from '@/misc/convert-host';
import { awaitAll } from '../../prelude/await-all';
import { awaitAll } from '@/prelude/await-all';
import { SchemaType } from '@/misc/schema';
import config from '@/config/index';
import { query, appendQuery } from '../../prelude/url';
import { Meta } from '../entities/meta';
import { query, appendQuery } from '@/prelude/url';
import { Meta } from '@/models/entities/meta';
import { fetchMeta } from '@/misc/fetch-meta';
export type PackedDriveFile = SchemaType<typeof packedDriveFileSchema>;

View File

@ -1,7 +1,7 @@
import { EntityRepository, Repository } from 'typeorm';
import { DriveFolders, DriveFiles } from '../index';
import { DriveFolder } from '../entities/drive-folder';
import { awaitAll } from '../../prelude/await-all';
import { DriveFolder } from '@/models/entities/drive-folder';
import { awaitAll } from '@/prelude/await-all';
import { SchemaType } from '@/misc/schema';
export type PackedDriveFolder = SchemaType<typeof packedDriveFolderSchema>;

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { Emoji } from '../entities/emoji';
import { Emoji } from '@/models/entities/emoji';
@EntityRepository(Emoji)
export class EmojiRepository extends Repository<Emoji> {

View File

@ -1,7 +1,7 @@
import { EntityRepository, Repository } from 'typeorm';
import { FollowRequest } from '../entities/follow-request';
import { FollowRequest } from '@/models/entities/follow-request';
import { Users } from '../index';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
@EntityRepository(FollowRequest)
export class FollowRequestRepository extends Repository<FollowRequest> {

View File

@ -1,9 +1,9 @@
import { EntityRepository, Repository } from 'typeorm';
import { Users } from '../index';
import { Following } from '../entities/following';
import { awaitAll } from '../../prelude/await-all';
import { Following } from '@/models/entities/following';
import { awaitAll } from '@/prelude/await-all';
import { SchemaType } from '@/misc/schema';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
type LocalFollowerFollowing = Following & {
followerHost: null;

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { GalleryLike } from '../entities/gallery-like';
import { GalleryLike } from '@/models/entities/gallery-like';
import { GalleryPosts } from '../index';
@EntityRepository(GalleryLike)

View File

@ -1,9 +1,9 @@
import { EntityRepository, Repository } from 'typeorm';
import { GalleryPost } from '../entities/gallery-post';
import { GalleryPost } from '@/models/entities/gallery-post';
import { SchemaType } from '../../misc/schema';
import { Users, DriveFiles, GalleryLikes } from '../index';
import { awaitAll } from '../../prelude/await-all';
import { User } from '../entities/user';
import { awaitAll } from '@/prelude/await-all';
import { User } from '@/models/entities/user';
export type PackedGalleryPost = SchemaType<typeof packedGalleryPostSchema>;

View File

@ -1,7 +1,7 @@
import { User } from '@/models/entities/user';
import { EntityRepository, Repository } from 'typeorm';
import { Users } from '../../../index';
import { ReversiGame } from '../../../entities/games/reversi/game';
import { ReversiGame } from '@/models/entities/games/reversi/game';
@EntityRepository(ReversiGame)
export class ReversiGameRepository extends Repository<ReversiGame> {

View File

@ -1,7 +1,7 @@
import { EntityRepository, Repository } from 'typeorm';
import { ReversiMatching } from '../../../entities/games/reversi/matching';
import { ReversiMatching } from '@/models/entities/games/reversi/matching';
import { Users } from '../../../index';
import { awaitAll } from '../../../../prelude/await-all';
import { awaitAll } from '@/prelude/await-all';
import { User } from '@/models/entities/user';
@EntityRepository(ReversiMatching)

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { Hashtag } from '../entities/hashtag';
import { Hashtag } from '@/models/entities/hashtag';
import { SchemaType } from '@/misc/schema';
export type PackedHashtag = SchemaType<typeof packedHashtagSchema>;

View File

@ -1,8 +1,8 @@
import { EntityRepository, Repository } from 'typeorm';
import { MessagingMessage } from '../entities/messaging-message';
import { MessagingMessage } from '@/models/entities/messaging-message';
import { Users, DriveFiles, UserGroups } from '../index';
import { SchemaType } from '@/misc/schema';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
export type PackedMessagingMessage = SchemaType<typeof packedMessagingMessageSchema>;

View File

@ -1,7 +1,7 @@
import { EntityRepository, Repository } from 'typeorm';
import { Users } from '../index';
import { ModerationLog } from '../entities/moderation-log';
import { awaitAll } from '../../prelude/await-all';
import { ModerationLog } from '@/models/entities/moderation-log';
import { awaitAll } from '@/prelude/await-all';
@EntityRepository(ModerationLog)
export class ModerationLogRepository extends Repository<ModerationLog> {

View File

@ -1,9 +1,9 @@
import { EntityRepository, Repository } from 'typeorm';
import { Users } from '../index';
import { Muting } from '../entities/muting';
import { awaitAll } from '../../prelude/await-all';
import { Muting } from '@/models/entities/muting';
import { awaitAll } from '@/prelude/await-all';
import { SchemaType } from '@/misc/schema';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
export type PackedMuting = SchemaType<typeof packedMutingSchema>;

View File

@ -1,7 +1,7 @@
import { EntityRepository, Repository } from 'typeorm';
import { NoteFavorite } from '../entities/note-favorite';
import { NoteFavorite } from '@/models/entities/note-favorite';
import { Notes } from '../index';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
@EntityRepository(NoteFavorite)
export class NoteFavoriteRepository extends Repository<NoteFavorite> {

View File

@ -1,9 +1,9 @@
import { EntityRepository, Repository } from 'typeorm';
import { NoteReaction } from '../entities/note-reaction';
import { NoteReaction } from '@/models/entities/note-reaction';
import { Users } from '../index';
import { SchemaType } from '@/misc/schema';
import { convertLegacyReaction } from '@/misc/reaction-lib';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
export type PackedNoteReaction = SchemaType<typeof packedNoteReactionSchema>;

View File

@ -1,13 +1,13 @@
import { EntityRepository, Repository, In } from 'typeorm';
import * as mfm from 'mfm-js';
import { Note } from '../entities/note';
import { User } from '../entities/user';
import { Note } from '@/models/entities/note';
import { User } from '@/models/entities/user';
import { Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '../index';
import { SchemaType } from '@/misc/schema';
import { nyaize } from '@/misc/nyaize';
import { awaitAll } from '../../prelude/await-all';
import { awaitAll } from '@/prelude/await-all';
import { convertLegacyReaction, convertLegacyReactions, decodeReaction } from '@/misc/reaction-lib';
import { NoteReaction } from '../entities/note-reaction';
import { NoteReaction } from '@/models/entities/note-reaction';
import { aggregateNoteEmojis, populateEmojis, prefetchEmojis } from '@/misc/populate-emojis';
export type PackedNote = SchemaType<typeof packedNoteSchema>;

View File

@ -1,11 +1,11 @@
import { EntityRepository, In, Repository } from 'typeorm';
import { Users, Notes, UserGroupInvitations, AccessTokens, NoteReactions } from '../index';
import { Notification } from '../entities/notification';
import { awaitAll } from '../../prelude/await-all';
import { Notification } from '@/models/entities/notification';
import { awaitAll } from '@/prelude/await-all';
import { SchemaType } from '@/misc/schema';
import { Note } from '../entities/note';
import { NoteReaction } from '../entities/note-reaction';
import { User } from '../entities/user';
import { Note } from '@/models/entities/note';
import { NoteReaction } from '@/models/entities/note-reaction';
import { User } from '@/models/entities/user';
import { aggregateNoteEmojis, prefetchEmojis } from '@/misc/populate-emojis';
export type PackedNotification = SchemaType<typeof packedNotificationSchema>;

View File

@ -1,7 +1,7 @@
import { EntityRepository, Repository } from 'typeorm';
import { PageLike } from '../entities/page-like';
import { PageLike } from '@/models/entities/page-like';
import { Pages } from '../index';
import { User } from '../entities/user';
import { User } from '@/models/entities/user';
@EntityRepository(PageLike)
export class PageLikeRepository extends Repository<PageLike> {

View File

@ -1,10 +1,10 @@
import { EntityRepository, Repository } from 'typeorm';
import { Page } from '../entities/page';
import { Page } from '@/models/entities/page';
import { SchemaType } from '@/misc/schema';
import { Users, DriveFiles, PageLikes } from '../index';
import { awaitAll } from '../../prelude/await-all';
import { DriveFile } from '../entities/drive-file';
import { User } from '../entities/user';
import { awaitAll } from '@/prelude/await-all';
import { DriveFile } from '@/models/entities/drive-file';
import { User } from '@/models/entities/user';
export type PackedPage = SchemaType<typeof packedPageSchema>;

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { Relay } from '../entities/relay';
import { Relay } from '@/models/entities/relay';
@EntityRepository(Relay)
export class RelayRepository extends Repository<Relay> {

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { Signin } from '../entities/signin';
import { Signin } from '@/models/entities/signin';
@EntityRepository(Signin)
export class SigninRepository extends Repository<Signin> {

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { UserGroupInvitation } from '../entities/user-group-invitation';
import { UserGroupInvitation } from '@/models/entities/user-group-invitation';
import { UserGroups } from '../index';
@EntityRepository(UserGroupInvitation)

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { UserGroup } from '../entities/user-group';
import { UserGroup } from '@/models/entities/user-group';
import { UserGroupJoinings } from '../index';
import { SchemaType } from '@/misc/schema';

View File

@ -1,5 +1,5 @@
import { EntityRepository, Repository } from 'typeorm';
import { UserList } from '../entities/user-list';
import { UserList } from '@/models/entities/user-list';
import { UserListJoinings } from '../index';
import { SchemaType } from '@/misc/schema';

View File

@ -1,10 +1,10 @@
import $ from 'cafy';
import { EntityRepository, Repository, In, Not } from 'typeorm';
import { User, ILocalUser, IRemoteUser } from '../entities/user';
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user';
import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances } from '../index';
import config from '@/config/index';
import { SchemaType } from '@/misc/schema';
import { awaitAll } from '../../prelude/await-all';
import { awaitAll } from '@/prelude/await-all';
import { populateEmojis } from '@/misc/populate-emojis';
import { getAntennas } from '@/misc/antenna-cache';
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const';

View File

@ -1,7 +1,7 @@
import { ApObject, getApIds } from './type';
import Resolver from './resolver';
import { resolvePerson } from './models/person';
import { unique, concat } from '../../prelude/array';
import { unique, concat } from '@/prelude/array';
import * as promiseLimit from 'promise-limit';
import { User, IRemoteUser } from '@/models/entities/user';

View File

@ -3,7 +3,7 @@ import { IRemoteUser } from '@/models/entities/user';
import createNote from './note';
import { ICreate, getApId, isPost, getApType } from '../../type';
import { apLogger } from '../../logger';
import { toArray, concat, unique } from '../../../../prelude/array';
import { toArray, concat, unique } from '@/prelude/array';
const logger = apLogger;

View File

@ -1,7 +1,7 @@
import deleteNote from './note';
import { IRemoteUser } from '@/models/entities/user';
import { IDelete, getApId, isTombstone, IObject, validPost, validActor } from '../../type';
import { toSingle } from '../../../../prelude/array';
import { toSingle } from '@/prelude/array';
/**
*

View File

@ -16,7 +16,7 @@ import block from './block/index';
import flag from './flag/index';
import { apLogger } from '../logger';
import Resolver from '../resolver';
import { toArray } from '../../../prelude/array';
import { toArray } from '@/prelude/array';
export async function performActivity(actor: IRemoteUser, activity: IObject) {
if (isCollectionOrOrderedCollection(activity)) {

View File

@ -1,4 +1,4 @@
import { toArray, unique } from '../../../prelude/array';
import { toArray, unique } from '@/prelude/array';
import { IObject, isMention, IApMention } from '../type';
import { resolvePerson } from './person';
import * as promiseLimit from 'promise-limit';

View File

@ -8,7 +8,7 @@ import { resolveImage } from './image';
import { IRemoteUser } from '@/models/entities/user';
import { htmlToMfm } from '../misc/html-to-mfm';
import { extractApHashtags } from './tag';
import { unique, toArray, toSingle } from '../../../prelude/array';
import { unique, toArray, toSingle } from '@/prelude/array';
import { extractPollFromQuestion } from './question';
import vote from '@/services/note/polls/vote';
import { apLogger } from '../logger';

View File

@ -25,7 +25,7 @@ import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
import { toPuny } from '@/misc/convert-host';
import { UserProfile } from '@/models/entities/user-profile';
import { getConnection } from 'typeorm';
import { toArray } from '../../../prelude/array';
import { toArray } from '@/prelude/array';
import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata';
import { normalizeForSearch } from '@/misc/normalize-for-search';

View File

@ -1,4 +1,4 @@
import { toArray } from '../../../prelude/array';
import { toArray } from '@/prelude/array';
import { IObject, isHashtag, IApHashtag } from '../type';
export function extractApHashtags(tags: IObject | IObject[] | null | undefined) {

View File

@ -1,6 +1,6 @@
import { URL } from 'url';
import { getJson } from '@/misc/fetch';
import { query as urlQuery } from '../prelude/url';
import { query as urlQuery } from '@/prelude/url';
type ILink = {
href: string;

View File

@ -2,7 +2,7 @@ import * as Router from '@koa/router';
import config from '@/config/index';
import $ from 'cafy';
import { ID } from '@/misc/cafy-id';
import * as url from '../../prelude/url';
import * as url from '@/prelude/url';
import { renderActivity } from '@/remote/activitypub/renderer/index';
import renderOrderedCollection from '@/remote/activitypub/renderer/ordered-collection';
import renderOrderedCollectionPage from '@/remote/activitypub/renderer/ordered-collection-page';

View File

@ -2,7 +2,7 @@ import * as Router from '@koa/router';
import config from '@/config/index';
import $ from 'cafy';
import { ID } from '@/misc/cafy-id';
import * as url from '../../prelude/url';
import * as url from '@/prelude/url';
import { renderActivity } from '@/remote/activitypub/renderer/index';
import renderOrderedCollection from '@/remote/activitypub/renderer/ordered-collection';
import renderOrderedCollectionPage from '@/remote/activitypub/renderer/ordered-collection-page';

View File

@ -9,8 +9,8 @@ import { setResponseType } from '../activitypub';
import renderNote from '@/remote/activitypub/renderer/note';
import renderCreate from '@/remote/activitypub/renderer/create';
import renderAnnounce from '@/remote/activitypub/renderer/announce';
import { countIf } from '../../prelude/array';
import * as url from '../../prelude/url';
import { countIf } from '@/prelude/array';
import * as url from '@/prelude/url';
import { Users, Notes } from '@/models/index';
import { makePaginationQuery } from '../api/common/make-pagination-query';
import { Brackets } from 'typeorm';

View File

@ -7,7 +7,7 @@ import { MessagingMessages, UserGroupJoinings, Users } from '@/models/index';
import { In } from 'typeorm';
import { IdentifiableError } from '@/misc/identifiable-error';
import { UserGroup } from '@/models/entities/user-group';
import { toArray } from '../../../prelude/array';
import { toArray } from '@/prelude/array';
import { renderReadActivity } from '@/remote/activitypub/renderer/read';
import { renderActivity } from '@/remote/activitypub/renderer/index';
import { deliver } from '@/queue/index';

View File

@ -2,7 +2,7 @@ import $ from 'cafy';
import define from '../../define';
import { Apps } from '@/models/index';
import { genId } from '@/misc/gen-id';
import { unique } from '../../../../prelude/array';
import { unique } from '@/prelude/array';
import { secureRndstr } from '@/misc/secure-rndstr';
export const meta = {

View File

@ -1,7 +1,7 @@
import $ from 'cafy';
import { ID } from '@/misc/cafy-id';
import define from '../../define';
import { maximum } from '../../../../prelude/array';
import { maximum } from '@/prelude/array';
import { ApiError } from '../../error';
import { getUser } from '../../common/getters';
import { Not, In, IsNull } from 'typeorm';

View File

@ -18,7 +18,7 @@ import nodeinfo from './nodeinfo';
import wellKnown from './well-known';
import config from '@/config/index';
import apiServer from './api/index';
import { sum } from '../prelude/array';
import { sum } from '@/prelude/array';
import Logger from '@/services/logger';
import { program } from '../argv';
import { UserProfiles, Users } from '@/models/index';

View File

@ -3,7 +3,7 @@ import summaly from 'summaly';
import { fetchMeta } from '@/misc/fetch-meta';
import Logger from '@/services/logger';
import config from '@/config/index';
import { query } from '../../prelude/url';
import { query } from '@/prelude/url';
import { getJson } from '@/misc/fetch';
const logger = new Logger('url-preview');

View File

@ -3,7 +3,7 @@ import * as Router from '@koa/router';
import config from '@/config/index';
import { parseAcct, Acct } from '@/misc/acct';
import { links } from './nodeinfo';
import { escapeAttribute, escapeValue } from '../prelude/xml';
import { escapeAttribute, escapeValue } from '@/prelude/xml';
import { Users } from '@/models/index';
import { User } from '@/models/entities/user';

View File

@ -9,7 +9,7 @@ import autobind from 'autobind-decorator';
import Logger from '../logger';
import { Schema } from '@/misc/schema';
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';
const logger = new Logger('chart', 'white', process.env.NODE_ENV !== 'test');

View File

@ -9,7 +9,7 @@ import { renderActivity } from '@/remote/activitypub/renderer/index';
import { resolveUser } from '@/remote/resolve-user';
import config from '@/config/index';
import { updateHashtags } from '../update-hashtag';
import { concat } from '../../prelude/array';
import { concat } from '@/prelude/array';
import insertNoteUnread from './unread';
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
import { extractMentions } from '@/misc/extract-mentions';