dependencies: bump (major)

TODO: drop the "const argv = argvObj as Record<string, any>;" hack

Refs: yargs/yargs#2175
This commit is contained in:
Jesse Chan
2022-05-07 16:41:01 -07:00
parent 531e33d636
commit efdd620192
13 changed files with 4441 additions and 5327 deletions

View File

@@ -1,3 +1,4 @@
import type {EventMap} from 'typed-emitter';
import type {Operation} from 'fast-json-patch';
import type {Request, Response} from 'express';
import type TypedEmitter from 'typed-emitter';
@@ -21,7 +22,7 @@ export default async (req: Request, res: Response) => {
const fetchTorrentList = serviceInstances.torrentService.fetchTorrentList();
// Hook into events and stop listening when connection is closed
const handleEvents = <T extends TypedEmitter<Record<string, unknown>>>(
const handleEvents = <T extends TypedEmitter<EventMap>>(
emitter: T,
event: Parameters<T['on']>[0],
handler: Parameters<T['on']>[1],

View File

@@ -12,11 +12,11 @@ export interface DiskUsageSummary {
disks: Disks;
}
interface DiskUsageEvents {
type DiskUsageEvents = {
DISK_USAGE_CHANGE: (usage: DiskUsageSummary) => void;
newListener: (event: keyof Omit<DiskUsageEvents, 'newListener' | 'removeListener'>) => void;
removeListener: (event: keyof Omit<DiskUsageEvents, 'newListener' | 'removeListener'>) => void;
}
};
const INTERVAL_UPDATE = 10000;

View File

@@ -1,12 +1,13 @@
import {EventEmitter} from 'events';
import type {EventMap} from 'typed-emitter';
import type TypedEmitter from 'typed-emitter';
import type {UserInDatabase} from '@shared/schema/Auth';
import type {ServiceInstances} from '.';
class BaseService<E = unknown> extends (EventEmitter as {
new <T>(): TypedEmitter<T>;
class BaseService<E extends EventMap> extends (EventEmitter as {
new <T extends EventMap>(): TypedEmitter<T>;
})<E> {
user: UserInDatabase;
services?: ServiceInstances;

View File

@@ -28,12 +28,12 @@ import type {UserInDatabase} from '@shared/schema/Auth';
import BaseService from './BaseService';
import config from '../../config';
interface ClientGatewayServiceEvents {
type ClientGatewayServiceEvents = {
CLIENT_CONNECTION_STATE_CHANGE: (isConnected: boolean) => void;
PROCESS_TORRENT_LIST_START: () => void;
PROCESS_TORRENT_LIST_END: (torrentListSummary: TorrentListSummary) => void;
PROCESS_TORRENT: (torrentProperties: TorrentProperties) => void;
}
};
abstract class ClientGatewayService extends BaseService<ClientGatewayServiceEvents> {
errorCount = 0;

View File

@@ -12,7 +12,7 @@ import type {AddFeedOptions, AddRuleOptions, ModifyFeedOptions} from '../../shar
import type {Feed, Item, MatchedTorrents, Rule} from '../../shared/types/Feed';
import type {FeedReaderOptions} from '../models/FeedReader';
class FeedService extends BaseService {
class FeedService extends BaseService<Record<string, never>> {
rules: Record<string, Array<Rule>> = {};
feedReaders: Array<FeedReader> = [];
db = new Datastore({

View File

@@ -4,11 +4,11 @@ import BaseService from './BaseService';
import config from '../../config';
import HistoryEra from '../models/HistoryEra';
interface HistoryServiceEvents {
type HistoryServiceEvents = {
TRANSFER_SUMMARY_FULL_UPDATE: (payload: {id: number; summary: TransferSummary}) => void;
FETCH_TRANSFER_SUMMARY_SUCCESS: () => void;
FETCH_TRANSFER_SUMMARY_ERROR: () => void;
}
};
class HistoryService extends BaseService<HistoryServiceEvents> {
private errorCount = 0;

View File

@@ -11,9 +11,9 @@ import type {
import BaseService from './BaseService';
import config from '../../config';
interface NotificationServiceEvents {
type NotificationServiceEvents = {
NOTIFICATION_COUNT_CHANGE: (payload: {id: number; data: NotificationCount}) => void;
}
};
const DEFAULT_QUERY_LIMIT = 20;

View File

@@ -11,9 +11,9 @@ interface SettingRecord {
data: unknown;
}
interface SettingServiceEvents {
type SettingServiceEvents = {
SETTINGS_CHANGE: (changeSettings: Partial<FloodSettings>) => void;
}
};
class SettingService extends BaseService<SettingServiceEvents> {
db = new Datastore({

View File

@@ -7,9 +7,9 @@ import type {Taxonomy} from '../../shared/types/Taxonomy';
import type {TorrentStatus} from '../../shared/constants/torrentStatusMap';
import type {TorrentProperties, TorrentList} from '../../shared/types/Torrent';
interface TaxonomyServiceEvents {
type TaxonomyServiceEvents = {
TAXONOMY_DIFF_CHANGE: (payload: {id: number; diff: Operation[]}) => void;
}
};
class TaxonomyService extends BaseService<TaxonomyServiceEvents> {
taxonomy: Taxonomy = {

View File

@@ -6,13 +6,13 @@ import BaseService from './BaseService';
import config from '../../config';
import {hasTorrentFinished} from '../util/torrentPropertiesUtil';
interface TorrentServiceEvents {
type TorrentServiceEvents = {
FETCH_TORRENT_LIST_SUCCESS: () => void;
FETCH_TORRENT_LIST_ERROR: () => void;
TORRENT_LIST_DIFF_CHANGE: (payload: {id: number; diff: Operation[]}) => void;
newListener: (event: keyof Omit<TorrentServiceEvents, 'newListener' | 'removeListener'>) => void;
removeListener: (event: keyof Omit<TorrentServiceEvents, 'newListener' | 'removeListener'>) => void;
}
};
class TorrentService extends BaseService<TorrentServiceEvents> {
pollInterval = config.torrentClientPollIntervalIdle;