in lambda/publish-todays-curation/src/curation.ts [100:139]
month: parseInt(parts[4]),
day: parseInt(parts[5]),
};
} else {
return null;
}
}
export function newCurationPath(
region: string,
variant: string,
date: Date,
): CurationPath {
return {
edition: region,
front: variant,
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate(),
};
}
export async function validateCurationData(
region: string,
variant: string,
date: Date,
staticBucketName: string,
): Promise<CurationPath | null> {
console.debug(`Checking path `, generatePath(region, variant, date));
const req = new HeadObjectCommand({
Bucket: staticBucketName,
Key: generatePath(region, variant, date),
});
try {
await s3Client.send(req); //this should throw an exception if the file does not exist
console.debug(
`Found curation data for ${region}/${variant} on ${formatISO(date)}`,
);
return {