Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function createMailLock(uuid: string, taskUUID: string): Promise {
return db.collection('daily-mail-lock').doc(uuid).create({
taskUUID,
timestamp: firestore.FieldValue.serverTimestamp(),
});
}
export const toDocData = (
results: PR['save']>[],
compact = false,
) => {
const firstResult = results[0]
const { hostname, domain } = tldjs.parse(firstResult.url)
const docBase = {
createdAt: firestore.FieldValue.serverTimestamp(),
publishedAt: firstResult.mercury.date_published
? dayjs(firstResult.mercury.date_published)
: null,
url: firstResult.url,
hostname,
domain,
texts: results.map(r => r.mercury.content),
author: firstResult.mercury.author,
leadImageDownloadUrl: firstResult.mercury.lead_image_url,
title: firstResult.mercury.title,
excerpts: results.map(r => r.mercury.excerpt),
}