Skip to content

Commit

Permalink
convert services to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Dec 5, 2023
1 parent 979ab3c commit 1c4c4bc
Show file tree
Hide file tree
Showing 35 changed files with 603 additions and 261 deletions.
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const defaults = {
PROVIDER: '', // The cloud provider used by the application (determines how environment data is downloaded)
STEAM_ACCOUNT_DATA: '', // The URL to read Steam account data from
NODE_ENV: 'development',
PORT: '', // Default port to use by services often set by the system
FRONTEND_PORT: '5000',
RETRIEVER_PORT: '5100',
PARSER_PORT: '5200',
Expand Down
52 changes: 26 additions & 26 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,111 +2,111 @@ const config = require('./config.js');

let arr = [
{
script: 'svc/web.mjs',
script: 'svc/web.mts',
group: 'web',
},
{
script: 'svc/retriever.mjs',
script: 'svc/retriever.mts',
group: 'retriever',
},
{
script: 'svc/proxy.mjs',
script: 'svc/proxy.mts',
group: 'proxy',
},
{
script: 'svc/parser.mjs',
script: 'svc/parser.mts',
group: 'parser',
},
{
script: 'svc/apiadmin.mjs',
script: 'svc/apiadmin.mts',
group: 'backend',
},
{
script: 'svc/mmr.mjs',
script: 'svc/mmr.mts',
group: 'backend',
},
{
script: 'svc/profiler.mjs',
script: 'svc/profiler.mts',
group: 'backend',
},
{
script: 'svc/scanner.mjs',
script: 'svc/scanner.mts',
group: 'backend',
},
{
script: 'svc/fullhistory.mjs',
script: 'svc/fullhistory.mts',
group: 'backend',
},
{
script: 'svc/autofullhistory.mjs',
script: 'svc/autofullhistory.mts',
group: 'backend',
},
{
script: 'svc/monitor.mjs',
script: 'svc/monitor.mts',
group: 'backend',
},
{
script: 'svc/gcdata.mts',
group: 'backend',
},
{
script: 'svc/buildsets.mjs',
script: 'svc/buildsets.mts',
group: 'backend',
},
{
script: 'svc/cosmetics.mjs',
script: 'svc/cosmetics.mts',
group: 'backend',
},
{
script: 'svc/distributions.mjs',
script: 'svc/distributions.mts',
group: 'backend',
},
{
script: 'svc/heroes.mjs',
script: 'svc/heroes.mts',
group: 'backend',
},
{
script: 'svc/herostats.mjs',
script: 'svc/herostats.mts',
group: 'backend',
},
{
script: 'svc/items.mjs',
script: 'svc/items.mts',
group: 'backend',
},
{
script: 'svc/leagues.mjs',
script: 'svc/leagues.mts',
group: 'backend',
},
{
script: 'svc/livegames.mjs',
script: 'svc/livegames.mts',
group: 'backend',
},
{
script: 'svc/proplayers.mjs',
script: 'svc/proplayers.mts',
group: 'backend',
},
{
script: 'svc/teams.mjs',
script: 'svc/teams.mts',
group: 'backend',
},
{
script: 'svc/scenarios.mjs',
script: 'svc/scenarios.mts',
group: 'backend',
},
{
script: 'svc/scenariosCleanup.mjs',
script: 'svc/scenariosCleanup.mts',
group: 'backend',
},
{
script: 'svc/counts.mjs',
script: 'svc/counts.mts',
group: 'backend',
},
{
script: 'svc/syncSubs.mjs',
script: 'svc/syncSubs.mts',
group: 'backend',
},
{
script: 'svc/cassandraDelete.mjs',
script: 'svc/cassandraDelete.mts',
group: 'backend',
},
];
Expand Down
90 changes: 90 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
declare module 'simple-vdf';
declare module 'dotaconstants';
declare module 'json-bigint';
declare module 'http-proxy';
declare module 'steam';
declare module 'dota2';
declare module 'passport-steam';

type StringDict = { [key: string]: string };
type NumberDict = { [key: string]: number };
type ErrorCb = (err?: Error | null | undefined | unknown) => void

interface Match {
match_id: number;
start_time: number;
duration: number;
leagueid: number;
radiant_win: boolean;
lobby_type: number;
game_mode: number;
players: Player[];
}

interface LiveMatch extends Match {
lobby_id: string;
}

interface ParsedMatch extends Match {
chat: any[];
version: number;
}

interface Player {
player_slot: number,
account_id: number,
hero_id: number,
kills: number,
deaths: number,

// Not on most players but we sometimes add it from match
radiant_win?: boolean,
match_id?: number,
}

interface User {
account_id: number;
fh_unavailable: boolean;
steamid: string;
personaname: string;
avatarfull: string;
}

interface FullHistoryJob {
account_id: number;
short_history: boolean;

// These fields don't exist on the job but we add them during processing
fh_unavailable: boolean;
match_ids: number[];
}

interface MmrJob {
account_id: number;
match_id: number;
}

interface GCDataJob {
useGcDataArr: boolean;
}

interface ParseJob {
match_id: number;
origin?: DataOrigin;
}

interface ParsedPlayer extends Player {
kills_log: any[];
obs_log: any[];
purchases: any[];
}

interface ProPlayer {
name: string;
account_id: number;
}

type DataType = 'api' | 'parsed' | 'gcdata' | 'meta';
type DataOrigin = 'scanner';

// Various types of job objects mostly based on matches, e.g. adding origin
Loading

0 comments on commit 1c4c4bc

Please sign in to comment.