in super-mode-calculator/src/lambda.ts [16:46]
export async function handler(): Promise<void> {
if (stage !== 'CODE' && stage !== 'PROD') {
return Promise.reject(`Invalid stage: ${stage ?? ''}`);
}
const gcpConfig = await getSSMParam('gcp-wif-credentials-config', stage);
const authClient = await buildAuthClient(gcpConfig);
const rows: SimpleQueryRowsResponse = await getDataForSuperModeCalculator(
authClient,
stage,
);
const parsedResult: QueryRow[] = parseResultFromBigQuery(rows);
const activeArticles = await queryActiveArticlesForSuperMode(
stage,
docClient,
);
const superModeRows = parsedResult.filter(
(r) =>
!isCurrentlyInSuperMode(r, activeArticles) &&
shouldEnterSuperMode(r),
);
console.log({ superModeRows });
await writeRowsForSuperMode(superModeRows, stage, docClient);
return;
}