Skip to content

Commit

Permalink
fix: script types
Browse files Browse the repository at this point in the history
  • Loading branch information
tresabhi committed Oct 20, 2024
1 parent 31f7618 commit 76a8f83
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/scripts/src/averages.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import {
AverageDefinitions,
AverageDefinitionsEntry,
AverageDefinitionsEntrySubPartial,
AverageDefinitionsManifest,
IndividualTankStats,
REGIONS,
Region,
Samples,
averageDefinitionsAllStatsKeys,
emptySamples,
encodeProtobufToBase64,
encodePB64,
getAccountInfo,
getTankStats,
idToRegion,
Expand All @@ -24,6 +23,17 @@ interface DataPoint {
w: number;
}

type OptionalSecondLevel<T> = {
[P in keyof T]: P extends 'samples'
? T[P]
: {
[K in keyof T[P]]?: T[P][K];
};
};

type AverageDefinitionsEntrySubPartial =
OptionalSecondLevel<AverageDefinitionsEntry>;

const MINUTE = 60 * 1000;
const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
Expand Down Expand Up @@ -225,11 +235,7 @@ async function postWork() {
commitAssets('averages', [
{
path: `averages/${latest}.pb`,
content: await encodeProtobufToBase64(
'average_definitions',
'blitzkit.AverageDefinitions',
averageDefinitions,
),
content: encodePB64(AverageDefinitions, averageDefinitions),
encoding: 'base64',
},
{
Expand Down

0 comments on commit 76a8f83

Please sign in to comment.