@@ -3,9 +3,13 @@ import Fs from 'node:fs';
33import Path from 'node:path' ;
44import { singleton } from 'tsyringe' ;
55import DatabaseClient from '../../database/DatabaseClient.js' ;
6+ import AutoProxiedHttpClient from '../../http/clients/AutoProxiedHttpClient.js' ;
7+ import ServerBlocklistService from '../../minecraft/server/blocklist/ServerBlocklistService.js' ;
68import BulkImporter from './importer/BulkImporter.js' ;
9+ import DomainBulkImporter from './importer/DomainBulkImporter.js' ;
710import ProfileTextureValueBulkImporter from './importer/ProfileTextureValueBulkImporter.js' ;
811import SkinFileBulkImporter from './importer/SkinFileBulkImporter.js' ;
12+ import SkinUrlBulkImporter from './importer/SkinUrlBulkImporter.js' ;
913import UsernameBulkImporter from './importer/UsernameBulkImporter.js' ;
1014import UuidBulkImporter from './importer/UuidBulkImporter.js' ;
1115
@@ -22,10 +26,12 @@ export type BulkQueueImportResult = {
2226export default class BulkQueueImporter {
2327 constructor (
2428 private readonly databaseClient : DatabaseClient ,
29+ private readonly httpClient : AutoProxiedHttpClient ,
30+ private readonly serverBlocklistService : ServerBlocklistService ,
2531 ) {
2632 }
2733
28- async importEachLine ( filePath : string , type : 'uuid' | 'username' | 'profile-texture-value' , importingApiKeyId : bigint ) : Promise < BulkQueueImportResult > {
34+ async importEachLine ( filePath : string , type : 'uuid' | 'username' | 'profile-texture-value' | 'skin-urls' | 'domains' , importingApiKeyId : bigint ) : Promise < BulkQueueImportResult > {
2935 const fileHandle = await Fs . promises . open ( filePath , 'r' ) ;
3036 const totalFileBytes = ( await fileHandle . stat ( ) ) . size ;
3137
@@ -40,6 +46,12 @@ export default class BulkQueueImporter {
4046 case 'profile-texture-value' :
4147 payloadImporter = new ProfileTextureValueBulkImporter ( new UuidBulkImporter ( ) ) ;
4248 break ;
49+ case 'skin-urls' :
50+ payloadImporter = new SkinUrlBulkImporter ( this . httpClient ) ;
51+ break ;
52+ case 'domains' :
53+ payloadImporter = new DomainBulkImporter ( this . serverBlocklistService ) ;
54+ break ;
4355
4456 default :
4557 throw new Error ( `Unsupported bulk queue import type: ${ type } ` ) ;
@@ -94,7 +106,7 @@ export default class BulkQueueImporter {
94106 continue ;
95107 }
96108
97- insertBatch . push ( ...payloadImporter . createTasks ( payload , importGroup . id ) ) ;
109+ insertBatch . push ( ...( await payloadImporter . createTasks ( payload , importGroup . id ) ) ) ;
98110 if ( insertBatch . length >= 250 ) {
99111 const newlyQueued = await this . writeBatch ( transaction , insertBatch ) ;
100112 result . queued += newlyQueued ;
0 commit comments