mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-10-25 18:54:52 +00:00 
			
		
		
		
	* wip * wip * wip * Update SystemAccountService.ts * Update 1740121393164-system-accounts.js * Update DeleteAccountService.ts * wip * wip * wip * wip * Update 1740121393164-system-accounts.js * Update RepositoryModule.ts * wip * wip * wip * Update ApRendererService.ts * wip * wip * Update SystemAccountService.ts * fix tests * fix tests * fix tests * fix tests * fix tests * fix tests * add print logs * ログが長すぎて出てないかもしれない * fix migration * refactor * fix fed-tests * Update RelayService.ts * merge * Update user.test.ts * chore: emit log * fix: tweak sleep duration * fix: exit 1 * fix: wait for misskey processes to become healthy * fix: longer sleep for user deletion * fix: make sleep longer again * デッドロック解消の試み https://github.com/misskey-dev/misskey/issues/15005 * Revert "デッドロック解消の試み" This reverts commit 266141f66fb584371bbb56ef7eba04e14bcff94d. * wip * Update SystemAccountService.ts --------- Co-authored-by: おさむのひと <46447427+samunohito@users.noreply.github.com> Co-authored-by: zyoshoka <107108195+zyoshoka@users.noreply.github.com>
		
			
				
	
	
		
			85 lines
		
	
	
	
		
			2.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
	
		
			2.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /*
 | |
|  * SPDX-FileCopyrightText: syuilo and misskey-project
 | |
|  * SPDX-License-Identifier: AGPL-3.0-only
 | |
|  */
 | |
| 
 | |
| import type { Config } from '@/config.js';
 | |
| import type { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js';
 | |
| import type { ApRendererService } from '@/core/activitypub/ApRendererService.js';
 | |
| import type { ApRequestService } from '@/core/activitypub/ApRequestService.js';
 | |
| import type { IObject } from '@/core/activitypub/type.js';
 | |
| import type { HttpRequestService } from '@/core/HttpRequestService.js';
 | |
| import type { LoggerService } from '@/core/LoggerService.js';
 | |
| import type { UtilityService } from '@/core/UtilityService.js';
 | |
| import type {
 | |
| 	FollowRequestsRepository,
 | |
| 	MiMeta,
 | |
| 	NoteReactionsRepository,
 | |
| 	NotesRepository,
 | |
| 	PollsRepository,
 | |
| 	UsersRepository,
 | |
| } from '@/models/_.js';
 | |
| import { SystemAccountService } from '@/core/SystemAccountService.js';
 | |
| import { bindThis } from '@/decorators.js';
 | |
| import { Resolver } from '@/core/activitypub/ApResolverService.js';
 | |
| 
 | |
| type MockResponse = {
 | |
| 	type: string;
 | |
| 	content: string;
 | |
| };
 | |
| 
 | |
| export class MockResolver extends Resolver {
 | |
| 	#responseMap = new Map<string, MockResponse>();
 | |
| 	#remoteGetTrials: string[] = [];
 | |
| 
 | |
| 	constructor(loggerService: LoggerService) {
 | |
| 		super(
 | |
| 			{} as Config,
 | |
| 			{} as MiMeta,
 | |
| 			{} as UsersRepository,
 | |
| 			{} as NotesRepository,
 | |
| 			{} as PollsRepository,
 | |
| 			{} as NoteReactionsRepository,
 | |
| 			{} as FollowRequestsRepository,
 | |
| 			{} as UtilityService,
 | |
| 			{} as SystemAccountService,
 | |
| 			{} as ApRequestService,
 | |
| 			{} as HttpRequestService,
 | |
| 			{} as ApRendererService,
 | |
| 			{} as ApDbResolverService,
 | |
| 			loggerService,
 | |
| 		);
 | |
| 	}
 | |
| 
 | |
| 	public register(uri: string, content: string | Record<string, any>, type = 'application/activity+json'): void {
 | |
| 		this.#responseMap.set(uri, {
 | |
| 			type,
 | |
| 			content: typeof content === 'string' ? content : JSON.stringify(content),
 | |
| 		});
 | |
| 	}
 | |
| 
 | |
| 	public clear(): void {
 | |
| 		this.#responseMap.clear();
 | |
| 		this.#remoteGetTrials.length = 0;
 | |
| 	}
 | |
| 
 | |
| 	public remoteGetTrials(): string[] {
 | |
| 		return this.#remoteGetTrials;
 | |
| 	}
 | |
| 
 | |
| 	@bindThis
 | |
| 	public async resolve(value: string | IObject): Promise<IObject> {
 | |
| 		if (typeof value !== 'string') return value;
 | |
| 
 | |
| 		this.#remoteGetTrials.push(value);
 | |
| 		const r = this.#responseMap.get(value);
 | |
| 
 | |
| 		if (!r) {
 | |
| 			throw new Error('Not registed for mock');
 | |
| 		}
 | |
| 
 | |
| 		const object = JSON.parse(r.content);
 | |
| 
 | |
| 		return object;
 | |
| 	}
 | |
| }
 |