From 3ef1a4b0f9d61f35e3cbdfde6562391b391f0f51 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sun, 11 Dec 2022 15:33:03 +0100 Subject: [PATCH] refactor: remove default export for Resolver --- packages/backend/src/queue/processors/inbox.ts | 2 +- packages/backend/src/remote/activitypub/audience.ts | 2 +- packages/backend/src/remote/activitypub/kernel/accept/index.ts | 2 +- packages/backend/src/remote/activitypub/kernel/add/index.ts | 2 +- .../backend/src/remote/activitypub/kernel/announce/index.ts | 2 +- packages/backend/src/remote/activitypub/kernel/announce/note.ts | 2 +- packages/backend/src/remote/activitypub/kernel/create/index.ts | 2 +- packages/backend/src/remote/activitypub/kernel/create/note.ts | 2 +- packages/backend/src/remote/activitypub/kernel/index.ts | 2 +- packages/backend/src/remote/activitypub/kernel/reject/index.ts | 2 +- packages/backend/src/remote/activitypub/kernel/remove/index.ts | 2 +- packages/backend/src/remote/activitypub/kernel/undo/index.ts | 2 +- packages/backend/src/remote/activitypub/kernel/update/index.ts | 2 +- packages/backend/src/remote/activitypub/models/image.ts | 2 +- packages/backend/src/remote/activitypub/models/mention.ts | 2 +- packages/backend/src/remote/activitypub/models/note.ts | 2 +- packages/backend/src/remote/activitypub/models/person.ts | 2 +- packages/backend/src/remote/activitypub/models/question.ts | 2 +- packages/backend/src/remote/activitypub/perform.ts | 2 +- packages/backend/src/remote/activitypub/resolver.ts | 2 +- packages/backend/src/remote/resolve-user.ts | 2 +- packages/backend/src/server/api/endpoints/ap/get.ts | 2 +- packages/backend/src/server/api/endpoints/ap/show.ts | 2 +- .../src/server/api/endpoints/federation/update-remote-user.ts | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/backend/src/queue/processors/inbox.ts b/packages/backend/src/queue/processors/inbox.ts index c151403f7..8c5fab64c 100644 --- a/packages/backend/src/queue/processors/inbox.ts +++ b/packages/backend/src/queue/processors/inbox.ts @@ -9,7 +9,7 @@ import { apRequestChart, federationChart, instanceChart } from '@/services/chart import { toPuny, extractDbHost } from '@/misc/convert-host.js'; import { getApId } from '@/remote/activitypub/type.js'; import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { LdSignature } from '@/remote/activitypub/misc/ld-signature.js'; import { getAuthUser } from '@/remote/activitypub/misc/auth-user.js'; import { StatusError } from '@/misc/fetch.js'; diff --git a/packages/backend/src/remote/activitypub/audience.ts b/packages/backend/src/remote/activitypub/audience.ts index 0e2111f0c..9c04ecb6d 100644 --- a/packages/backend/src/remote/activitypub/audience.ts +++ b/packages/backend/src/remote/activitypub/audience.ts @@ -2,7 +2,7 @@ import promiseLimit from 'promise-limit'; import { CacheableRemoteUser, CacheableUser } from '@/models/entities/user.js'; import { unique, concat } from '@/prelude/array.js'; import { resolvePerson } from './models/person.js'; -import Resolver from './resolver.js'; +import { Resolver } from './resolver.js'; import { ApObject, getApIds } from './type.js'; type Visibility = 'public' | 'home' | 'followers' | 'specified'; diff --git a/packages/backend/src/remote/activitypub/kernel/accept/index.ts b/packages/backend/src/remote/activitypub/kernel/accept/index.ts index e2f5be16b..be9b80096 100644 --- a/packages/backend/src/remote/activitypub/kernel/accept/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/accept/index.ts @@ -1,6 +1,6 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { apLogger } from '@/remote/activitypub/logger.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { IAccept, isFollow, getApType } from '@/remote/activitypub/type.js'; import acceptFollow from './follow.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/add/index.ts b/packages/backend/src/remote/activitypub/kernel/add/index.ts index f78ddf138..3fd5f4723 100644 --- a/packages/backend/src/remote/activitypub/kernel/add/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/add/index.ts @@ -2,7 +2,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { addPinned } from '@/services/i/pin.js'; import { resolveNote } from '@/remote/activitypub/models/note.js'; import { IAdd } from '@/remote/activitypub/type.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; export default async (actor: CacheableRemoteUser, activity: IAdd, resolver: Resolver): Promise => { if ('actor' in activity && actor.uri !== activity.actor) { diff --git a/packages/backend/src/remote/activitypub/kernel/announce/index.ts b/packages/backend/src/remote/activitypub/kernel/announce/index.ts index 4c13d763d..e4d77e1c5 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/index.ts @@ -1,6 +1,6 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { apLogger } from '@/remote/activitypub/logger.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { IAnnounce, getApId } from '@/remote/activitypub/type.js'; import announceNote from './note.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/announce/note.ts b/packages/backend/src/remote/activitypub/kernel/announce/note.ts index f1fb80bbd..254ef2727 100644 --- a/packages/backend/src/remote/activitypub/kernel/announce/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/announce/note.ts @@ -7,7 +7,7 @@ import { Notes } from '@/models/index.js'; import { parseAudience } from '@/remote/activitypub/audience.js'; import { apLogger } from '@/remote/activitypub/logger.js'; import { fetchNote, resolveNote } from '@/remote/activitypub/models/note.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { IAnnounce, getApId } from '@/remote/activitypub/type.js'; import { shouldBlockInstance } from '@/misc/should-block-instance.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/create/index.ts b/packages/backend/src/remote/activitypub/kernel/create/index.ts index a3abd4815..f6e86d91d 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/index.ts @@ -1,6 +1,6 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { toArray, concat, unique } from '@/prelude/array.js'; -import Resolver from '../../resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { ICreate, getApId, isPost, getApType } from '../../type.js'; import { apLogger } from '../../logger.js'; import createNote from './note.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/create/note.ts b/packages/backend/src/remote/activitypub/kernel/create/note.ts index 12b07c18e..1e3207ccd 100644 --- a/packages/backend/src/remote/activitypub/kernel/create/note.ts +++ b/packages/backend/src/remote/activitypub/kernel/create/note.ts @@ -2,7 +2,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { getApLock } from '@/misc/app-lock.js'; import { extractDbHost } from '@/misc/convert-host.js'; import { StatusError } from '@/misc/fetch.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { createNote, fetchNote } from '@/remote/activitypub/models/note.js'; import { getApId, IObject, ICreate } from '@/remote/activitypub/type.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/index.ts b/packages/backend/src/remote/activitypub/kernel/index.ts index 59e9a56a5..4a5951824 100644 --- a/packages/backend/src/remote/activitypub/kernel/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/index.ts @@ -1,7 +1,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { toArray } from '@/prelude/array.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { apLogger } from '../logger.js'; -import Resolver from '../resolver.js'; import { IObject, isCreate, isDelete, isUpdate, isRead, isFollow, isAccept, isReject, isAdd, isRemove, isAnnounce, isLike, isUndo, isBlock, isCollectionOrOrderedCollection, isCollection, isFlag } from '../type.js'; import create from './create/index.js'; import performDeleteActivity from './delete/index.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/reject/index.ts b/packages/backend/src/remote/activitypub/kernel/reject/index.ts index bb6138a6d..3a91c8ec7 100644 --- a/packages/backend/src/remote/activitypub/kernel/reject/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/reject/index.ts @@ -1,7 +1,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { apLogger } from '../../logger.js'; import { IReject, isFollow, getApType } from '../../type.js'; -import Resolver from '../../resolver.js'; import rejectFollow from './follow.js'; export default async (actor: CacheableRemoteUser, activity: IReject, resolver: Resolver): Promise => { diff --git a/packages/backend/src/remote/activitypub/kernel/remove/index.ts b/packages/backend/src/remote/activitypub/kernel/remove/index.ts index 8c36de4d8..6591f82b1 100644 --- a/packages/backend/src/remote/activitypub/kernel/remove/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/remove/index.ts @@ -1,8 +1,8 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { removePinned } from '@/services/i/pin.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { IRemove } from '../../type.js'; import { resolveNote } from '../../models/note.js'; -import Resolver from '@/remote/activitypub/resolver.js'; export default async (actor: CacheableRemoteUser, activity: IRemove, resolver: Resolver): Promise => { if ('actor' in activity && actor.uri !== activity.actor) { diff --git a/packages/backend/src/remote/activitypub/kernel/undo/index.ts b/packages/backend/src/remote/activitypub/kernel/undo/index.ts index 5233a8a5b..05382f0f5 100644 --- a/packages/backend/src/remote/activitypub/kernel/undo/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/undo/index.ts @@ -1,6 +1,6 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { apLogger } from '@/remote/activitypub/logger.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType, isAccept } from '@/remote/activitypub/type.js'; import unfollow from './follow.js'; import unblock from './block.js'; diff --git a/packages/backend/src/remote/activitypub/kernel/update/index.ts b/packages/backend/src/remote/activitypub/kernel/update/index.ts index d9ca414c8..bb6d30d85 100644 --- a/packages/backend/src/remote/activitypub/kernel/update/index.ts +++ b/packages/backend/src/remote/activitypub/kernel/update/index.ts @@ -2,7 +2,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js'; import { getApType, IUpdate, isActor } from '@/remote/activitypub/type.js'; import { apLogger } from '@/remote/activitypub/logger.js'; import { updateQuestion } from '@/remote/activitypub/models/question.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { updatePerson } from '@/remote/activitypub/models/person.js'; /** diff --git a/packages/backend/src/remote/activitypub/models/image.ts b/packages/backend/src/remote/activitypub/models/image.ts index d13412579..281cbdf9a 100644 --- a/packages/backend/src/remote/activitypub/models/image.ts +++ b/packages/backend/src/remote/activitypub/models/image.ts @@ -5,7 +5,7 @@ import { DriveFile } from '@/models/entities/drive-file.js'; import { DriveFiles } from '@/models/index.js'; import { truncate } from '@/misc/truncate.js'; import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/misc/hard-limits.js'; -import Resolver from '../resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { apLogger } from '../logger.js'; /** diff --git a/packages/backend/src/remote/activitypub/models/mention.ts b/packages/backend/src/remote/activitypub/models/mention.ts index 38ac7dd2e..52436cd64 100644 --- a/packages/backend/src/remote/activitypub/models/mention.ts +++ b/packages/backend/src/remote/activitypub/models/mention.ts @@ -1,8 +1,8 @@ import promiseLimit from 'promise-limit'; import { toArray, unique } from '@/prelude/array.js'; import { CacheableUser } from '@/models/entities/user.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { IObject, isMention, IApMention } from '../type.js'; -import Resolver from '../resolver.js'; import { resolvePerson } from './person.js'; export async function extractApMentions(tags: IObject | IObject[] | null | undefined, resolver: Resolver) { diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index fa2e2d04d..ffb8c28d2 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -17,10 +17,10 @@ import { createMessage } from '@/services/messages/create.js'; import { StatusError } from '@/misc/fetch.js'; import { fromHtml } from '@/mfm/from-html.js'; import { shouldBlockInstance } from '@/misc/should-block-instance.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { parseAudience } from '../audience.js'; import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji, getApType } from '../type.js'; import { DbResolver } from '../db-resolver.js'; -import Resolver from '../resolver.js'; import { apLogger } from '../logger.js'; import { resolvePerson } from './person.js'; import { resolveImage } from './image.js'; diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 6d753d004..e6a6779c4 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -24,9 +24,9 @@ import { uriPersonCache } from '@/services/user-cache.js'; import { publishInternalEvent } from '@/services/stream.js'; import { db } from '@/db/postgre.js'; import { fromHtml } from '@/mfm/from-html.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { apLogger } from '../logger.js'; import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, getApType, isActor } from '../type.js'; -import Resolver from '../resolver.js'; import { extractApHashtags } from './tag.js'; import { resolveNote, extractEmojis } from './note.js'; import { resolveImage } from './image.js'; diff --git a/packages/backend/src/remote/activitypub/models/question.ts b/packages/backend/src/remote/activitypub/models/question.ts index f14148f95..088cdbe94 100644 --- a/packages/backend/src/remote/activitypub/models/question.ts +++ b/packages/backend/src/remote/activitypub/models/question.ts @@ -1,7 +1,7 @@ import config from '@/config/index.js'; import { Notes, Polls } from '@/models/index.js'; import { IPoll } from '@/models/entities/poll.js'; -import Resolver from '../resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { IObject, IQuestion, isQuestion } from '../type.js'; import { apLogger } from '../logger.js'; diff --git a/packages/backend/src/remote/activitypub/perform.ts b/packages/backend/src/remote/activitypub/perform.ts index 0d90ba2cf..c81de5679 100644 --- a/packages/backend/src/remote/activitypub/perform.ts +++ b/packages/backend/src/remote/activitypub/perform.ts @@ -1,9 +1,9 @@ import { DAY } from '@/const.js'; import { CacheableRemoteUser } from '@/models/entities/user.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { IObject } from './type.js'; import { performActivity } from './kernel/index.js'; import { updatePerson } from './models/person.js'; -import Resolver from './resolver.js'; export default async (actor: CacheableRemoteUser, activity: IObject, resolver: Resolver): Promise => { await performActivity(actor, activity, resolver); diff --git a/packages/backend/src/remote/activitypub/resolver.ts b/packages/backend/src/remote/activitypub/resolver.ts index e1aa6b2bd..fd96758f6 100644 --- a/packages/backend/src/remote/activitypub/resolver.ts +++ b/packages/backend/src/remote/activitypub/resolver.ts @@ -21,7 +21,7 @@ import { parseUri } from './db-resolver.js'; * * As opposed to the DbResolver which will try to resolve an ActivityPub URI into a database object. */ -export default class Resolver { +export class Resolver { private history: Set; private user?: ILocalUser; private recursionLimit?: number; diff --git a/packages/backend/src/remote/resolve-user.ts b/packages/backend/src/remote/resolve-user.ts index 309304d5e..a459e847e 100644 --- a/packages/backend/src/remote/resolve-user.ts +++ b/packages/backend/src/remote/resolve-user.ts @@ -9,7 +9,7 @@ import { Users } from '@/models/index.js'; import webFinger from './webfinger.js'; import { createPerson, updatePerson } from './activitypub/models/person.js'; import { remoteLogger } from './logger.js'; -import Resolver from './activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; const logger = remoteLogger.createSubLogger('resolve-user'); diff --git a/packages/backend/src/server/api/endpoints/ap/get.ts b/packages/backend/src/server/api/endpoints/ap/get.ts index d20c36e7c..7f261b0bf 100644 --- a/packages/backend/src/server/api/endpoints/ap/get.ts +++ b/packages/backend/src/server/api/endpoints/ap/get.ts @@ -1,4 +1,4 @@ -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { HOUR } from '@/const.js'; import define from '../../define.js'; diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index 64c87e347..6c529482f 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -1,7 +1,7 @@ import { createPerson } from '@/remote/activitypub/models/person.js'; import { createNote } from '@/remote/activitypub/models/note.js'; import { DbResolver } from '@/remote/activitypub/db-resolver.js'; -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { extractDbHost } from '@/misc/convert-host.js'; import { Users, Notes } from '@/models/index.js'; import { Note } from '@/models/entities/note.js'; diff --git a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts index 88134684e..65b505070 100644 --- a/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts +++ b/packages/backend/src/server/api/endpoints/federation/update-remote-user.ts @@ -1,4 +1,4 @@ -import Resolver from '@/remote/activitypub/resolver.js'; +import { Resolver } from '@/remote/activitypub/resolver.js'; import { updatePerson } from '@/remote/activitypub/models/person.js'; import define from '../../define.js'; import { getRemoteUser } from '../../common/getters.js';