chore: fix import position

This commit is contained in:
syuilo 2022-12-04 17:05:32 +09:00
parent bbb49457f9
commit 9ce13d487b
16 changed files with 29 additions and 16 deletions

View file

@ -6,13 +6,13 @@ import * as nsfw from 'nsfwjs';
import si from 'systeminformation'; import si from 'systeminformation';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
const _filename = fileURLToPath(import.meta.url); const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename); const _dirname = dirname(_filename);
const REQUIRED_CPU_FLAGS = ['avx2', 'fma']; const REQUIRED_CPU_FLAGS = ['avx2', 'fma'];
let isSupportedCpu: undefined | boolean = undefined; let isSupportedCpu: undefined | boolean = undefined;
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class AiService { export class AiService {

View file

@ -3,12 +3,12 @@ import { Inject, Injectable } from '@nestjs/common';
import redisLock from 'redis-lock'; import redisLock from 'redis-lock';
import Redis from 'ioredis'; import Redis from 'ioredis';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
/** /**
* Retry delay (ms) for lock acquisition * Retry delay (ms) for lock acquisition
*/ */
const retryDelay = 100; const retryDelay = 100;
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class AppLockService { export class AppLockService {

View file

@ -12,6 +12,7 @@ import type { Note } from '@/models/entities/Note.js';
import type { EmojisRepository } from '@/models/index.js'; import type { EmojisRepository } from '@/models/index.js';
import { UtilityService } from '@/core/UtilityService.js'; import { UtilityService } from '@/core/UtilityService.js';
import { ReactionService } from '@/core/ReactionService.js'; import { ReactionService } from '@/core/ReactionService.js';
import { bindThis } from '@/decorators.js';
/** /**
* *
@ -20,7 +21,6 @@ type PopulatedEmoji = {
name: string; name: string;
url: string; url: string;
}; };
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class CustomEmojiService { export class CustomEmojiService {

View file

@ -31,6 +31,7 @@ import { InternalStorageService } from '@/core/InternalStorageService.js';
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { FileInfoService } from '@/core/FileInfoService.js'; import { FileInfoService } from '@/core/FileInfoService.js';
import { bindThis } from '@/decorators.js';
import type S3 from 'aws-sdk/clients/s3.js'; import type S3 from 'aws-sdk/clients/s3.js';
type AddFileArgs = { type AddFileArgs = {
@ -71,7 +72,6 @@ type UploadFromUrlArgs = {
requestIp?: string | null; requestIp?: string | null;
requestHeaders?: Record<string, string> | null; requestHeaders?: Record<string, string> | null;
}; };
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class DriveService { export class DriveService {

View file

@ -10,6 +10,7 @@ import type Logger from '@/logger.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { LoggerService } from '@/core/LoggerService.js'; import { LoggerService } from '@/core/LoggerService.js';
import { HttpRequestService } from '@/core/HttpRequestService.js'; import { HttpRequestService } from '@/core/HttpRequestService.js';
import { bindThis } from '@/decorators.js';
import type { DOMWindow } from 'jsdom'; import type { DOMWindow } from 'jsdom';
type NodeInfo = { type NodeInfo = {
@ -30,7 +31,6 @@ type NodeInfo = {
themeColor?: unknown; themeColor?: unknown;
}; };
}; };
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class FetchInstanceMetadataService { export class FetchInstanceMetadataService {

View file

@ -50,26 +50,32 @@ export class GlobalEventService {
})); }));
} }
@bindThis
public publishInternalEvent<K extends keyof InternalStreamTypes>(type: K, value?: InternalStreamTypes[K]): void { public publishInternalEvent<K extends keyof InternalStreamTypes>(type: K, value?: InternalStreamTypes[K]): void {
this.publish('internal', type, typeof value === 'undefined' ? null : value); this.publish('internal', type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishUserEvent<K extends keyof UserStreamTypes>(userId: User['id'], type: K, value?: UserStreamTypes[K]): void { public publishUserEvent<K extends keyof UserStreamTypes>(userId: User['id'], type: K, value?: UserStreamTypes[K]): void {
this.publish(`user:${userId}`, type, typeof value === 'undefined' ? null : value); this.publish(`user:${userId}`, type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishBroadcastStream<K extends keyof BroadcastTypes>(type: K, value?: BroadcastTypes[K]): void { public publishBroadcastStream<K extends keyof BroadcastTypes>(type: K, value?: BroadcastTypes[K]): void {
this.publish('broadcast', type, typeof value === 'undefined' ? null : value); this.publish('broadcast', type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishMainStream<K extends keyof MainStreamTypes>(userId: User['id'], type: K, value?: MainStreamTypes[K]): void { public publishMainStream<K extends keyof MainStreamTypes>(userId: User['id'], type: K, value?: MainStreamTypes[K]): void {
this.publish(`mainStream:${userId}`, type, typeof value === 'undefined' ? null : value); this.publish(`mainStream:${userId}`, type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishDriveStream<K extends keyof DriveStreamTypes>(userId: User['id'], type: K, value?: DriveStreamTypes[K]): void { public publishDriveStream<K extends keyof DriveStreamTypes>(userId: User['id'], type: K, value?: DriveStreamTypes[K]): void {
this.publish(`driveStream:${userId}`, type, typeof value === 'undefined' ? null : value); this.publish(`driveStream:${userId}`, type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishNoteStream<K extends keyof NoteStreamTypes>(noteId: Note['id'], type: K, value?: NoteStreamTypes[K]): void { public publishNoteStream<K extends keyof NoteStreamTypes>(noteId: Note['id'], type: K, value?: NoteStreamTypes[K]): void {
this.publish(`noteStream:${noteId}`, type, { this.publish(`noteStream:${noteId}`, type, {
id: noteId, id: noteId,
@ -77,26 +83,32 @@ export class GlobalEventService {
}); });
} }
@bindThis
public publishChannelStream<K extends keyof ChannelStreamTypes>(channelId: Channel['id'], type: K, value?: ChannelStreamTypes[K]): void { public publishChannelStream<K extends keyof ChannelStreamTypes>(channelId: Channel['id'], type: K, value?: ChannelStreamTypes[K]): void {
this.publish(`channelStream:${channelId}`, type, typeof value === 'undefined' ? null : value); this.publish(`channelStream:${channelId}`, type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishUserListStream<K extends keyof UserListStreamTypes>(listId: UserList['id'], type: K, value?: UserListStreamTypes[K]): void { public publishUserListStream<K extends keyof UserListStreamTypes>(listId: UserList['id'], type: K, value?: UserListStreamTypes[K]): void {
this.publish(`userListStream:${listId}`, type, typeof value === 'undefined' ? null : value); this.publish(`userListStream:${listId}`, type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishAntennaStream<K extends keyof AntennaStreamTypes>(antennaId: Antenna['id'], type: K, value?: AntennaStreamTypes[K]): void { public publishAntennaStream<K extends keyof AntennaStreamTypes>(antennaId: Antenna['id'], type: K, value?: AntennaStreamTypes[K]): void {
this.publish(`antennaStream:${antennaId}`, type, typeof value === 'undefined' ? null : value); this.publish(`antennaStream:${antennaId}`, type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishMessagingStream<K extends keyof MessagingStreamTypes>(userId: User['id'], otherpartyId: User['id'], type: K, value?: MessagingStreamTypes[K]): void { public publishMessagingStream<K extends keyof MessagingStreamTypes>(userId: User['id'], otherpartyId: User['id'], type: K, value?: MessagingStreamTypes[K]): void {
this.publish(`messagingStream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value); this.publish(`messagingStream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishGroupMessagingStream<K extends keyof GroupMessagingStreamTypes>(groupId: UserGroup['id'], type: K, value?: GroupMessagingStreamTypes[K]): void { public publishGroupMessagingStream<K extends keyof GroupMessagingStreamTypes>(groupId: UserGroup['id'], type: K, value?: GroupMessagingStreamTypes[K]): void {
this.publish(`messagingStream:${groupId}`, type, typeof value === 'undefined' ? null : value); this.publish(`messagingStream:${groupId}`, type, typeof value === 'undefined' ? null : value);
} }
@bindThis
public publishMessagingIndexStream<K extends keyof MessagingIndexStreamTypes>(userId: User['id'], type: K, value?: MessagingIndexStreamTypes[K]): void { public publishMessagingIndexStream<K extends keyof MessagingIndexStreamTypes>(userId: User['id'], type: K, value?: MessagingIndexStreamTypes[K]): void {
this.publish(`messagingIndexStream:${userId}`, type, typeof value === 'undefined' ? null : value); this.publish(`messagingIndexStream:${userId}`, type, typeof value === 'undefined' ? null : value);
} }
@ -106,6 +118,7 @@ export class GlobalEventService {
this.publish('notesStream', null, note); this.publish('notesStream', null, note);
} }
@bindThis
public publishAdminStream<K extends keyof AdminStreamTypes>(userId: User['id'], type: K, value?: AdminStreamTypes[K]): void { public publishAdminStream<K extends keyof AdminStreamTypes>(userId: User['id'], type: K, value?: AdminStreamTypes[K]): void {
this.publish(`adminStream:${userId}`, type, typeof value === 'undefined' ? null : value); this.publish(`adminStream:${userId}`, type, typeof value === 'undefined' ? null : value);
} }

View file

@ -5,9 +5,9 @@ import type { UsersRepository } from '@/models/index.js';
import { Cache } from '@/misc/cache.js'; import { Cache } from '@/misc/cache.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { CreateSystemUserService } from '@/core/CreateSystemUserService.js'; import { CreateSystemUserService } from '@/core/CreateSystemUserService.js';
import { bindThis } from '@/decorators.js';
const ACTOR_USERNAME = 'instance.actor' as const; const ACTOR_USERNAME = 'instance.actor' as const;
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class InstanceActorService { export class InstanceActorService {

View file

@ -5,12 +5,12 @@ import { dirname } from 'node:path';
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { bindThis } from '@/decorators.js';
const _filename = fileURLToPath(import.meta.url); const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename); const _dirname = dirname(_filename);
const path = Path.resolve(_dirname, '../../../../files'); const path = Path.resolve(_dirname, '../../../../files');
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class InternalStorageService { export class InternalStorageService {

View file

@ -7,6 +7,7 @@ import type { UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { intersperse } from '@/misc/prelude/array.js'; import { intersperse } from '@/misc/prelude/array.js';
import type { IMentionedRemoteUsers } from '@/models/entities/Note.js'; import type { IMentionedRemoteUsers } from '@/models/entities/Note.js';
import { bindThis } from '@/decorators.js';
import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js'; import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js';
import type * as mfm from 'mfm-js'; import type * as mfm from 'mfm-js';
@ -14,7 +15,6 @@ const treeAdapter = TreeAdapter.defaultTreeAdapter;
const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/; const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/;
const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/; const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/;
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class MfmService { export class MfmService {

View file

@ -40,6 +40,7 @@ import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerService.js'; import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerService.js';
import { NoteReadService } from '@/core/NoteReadService.js'; import { NoteReadService } from '@/core/NoteReadService.js';
import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js'; import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js';
import { bindThis } from '@/decorators.js';
const mutedWordsCache = new Cache<{ userId: UserProfile['userId']; mutedWords: UserProfile['mutedWords']; }[]>(1000 * 60 * 5); const mutedWordsCache = new Cache<{ userId: UserProfile['userId']; mutedWords: UserProfile['mutedWords']; }[]>(1000 * 60 * 5);
@ -132,7 +133,6 @@ type Option = {
url?: string | null; url?: string | null;
app?: App | null; app?: App | null;
}; };
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class NoteCreateService { export class NoteCreateService {

View file

@ -6,6 +6,7 @@ import type { Packed } from '@/misc/schema';
import { getNoteSummary } from '@/misc/get-note-summary.js'; import { getNoteSummary } from '@/misc/get-note-summary.js';
import type { SwSubscriptionsRepository } from '@/models/index.js'; import type { SwSubscriptionsRepository } from '@/models/index.js';
import { MetaService } from '@/core/MetaService.js'; import { MetaService } from '@/core/MetaService.js';
import { bindThis } from '@/decorators.js';
// Defined also packages/sw/types.ts#L14-L21 // Defined also packages/sw/types.ts#L14-L21
type pushNotificationsTypes = { type pushNotificationsTypes = {
@ -37,7 +38,6 @@ function truncateNotification(notification: Packed<'Notification'>): any {
return notification; return notification;
} }
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class PushNotificationService { export class PushNotificationService {

View file

@ -17,6 +17,7 @@ import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { MetaService } from '@/core/MetaService.js'; import { MetaService } from '@/core/MetaService.js';
import { bindThis } from '@/decorators.js';
import { UtilityService } from './UtilityService.js'; import { UtilityService } from './UtilityService.js';
const legacies: Record<string, string> = { const legacies: Record<string, string> = {
@ -49,7 +50,6 @@ type DecodedReaction = {
*/ */
host?: string | null; host?: string | null;
}; };
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class ReactionService { export class ReactionService {

View file

@ -10,9 +10,9 @@ import { CreateSystemUserService } from '@/core/CreateSystemUserService.js';
import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import { deepClone } from '@/misc/clone.js'; import { deepClone } from '@/misc/clone.js';
import { bindThis } from '@/decorators.js';
const ACTOR_USERNAME = 'relay.actor' as const; const ACTOR_USERNAME = 'relay.actor' as const;
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class RelayService { export class RelayService {

View file

@ -4,6 +4,7 @@ import * as jsrsasign from 'jsrsasign';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { UsersRepository } from '@/models/index.js'; import type { UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { bindThis } from '@/decorators.js';
const ECC_PRELUDE = Buffer.from([0x04]); const ECC_PRELUDE = Buffer.from([0x04]);
const NULL_BYTE = Buffer.from([0]); const NULL_BYTE = Buffer.from([0]);
@ -103,7 +104,6 @@ function PEMString(pemBuffer: Buffer, type = 'CERTIFICATE') {
`\n-----END ${type}-----\n` `\n-----END ${type}-----\n`
); );
} }
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class TwoFactorAuthenticationService { export class TwoFactorAuthenticationService {

View file

@ -13,9 +13,10 @@ import { WebhookService } from '@/core/WebhookService.js';
import { CreateNotificationService } from '@/core/CreateNotificationService.js'; import { CreateNotificationService } from '@/core/CreateNotificationService.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { BlockingsRepository, FollowingsRepository, FollowRequestsRepository, InstancesRepository, UserProfilesRepository, UsersRepository } from '@/models/index.js'; import type { BlockingsRepository, FollowingsRepository, FollowRequestsRepository, InstancesRepository, UserProfilesRepository, UsersRepository } from '@/models/index.js';
import Logger from '../logger.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { bindThis } from '@/decorators.js';
import Logger from '../logger.js';
const logger = new Logger('following/create'); const logger = new Logger('following/create');
@ -31,7 +32,6 @@ type Remote = IRemoteUser | {
inbox: IRemoteUser['inbox']; inbox: IRemoteUser['inbox'];
}; };
type Both = Local | Remote; type Both = Local | Remote;
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class UserFollowingService { export class UserFollowingService {

View file

@ -4,6 +4,7 @@ import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { query as urlQuery } from '@/misc/prelude/url.js'; import { query as urlQuery } from '@/misc/prelude/url.js';
import { HttpRequestService } from '@/core/HttpRequestService.js'; import { HttpRequestService } from '@/core/HttpRequestService.js';
import { bindThis } from '@/decorators.js';
type ILink = { type ILink = {
href: string; href: string;
@ -14,7 +15,6 @@ type IWebFinger = {
links: ILink[]; links: ILink[];
subject: string; subject: string;
}; };
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class WebfingerService { export class WebfingerService {