Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
executionUrl,
executionDescription = {}
) {
if (!granule.granuleId) throw new Error(`Could not create granule record, invalid granuleId: ${granule.granuleId}`);
const collectionId = getCollectionIdFromMessage(message);
const granuleFiles = await buildDatabaseFiles({
providerURL: buildURL({
protocol: message.meta.provider.protocol,
host: message.meta.provider.host,
port: message.meta.provider.port
}),
files: granule.files
});
const temporalInfo = await cmrjs.getGranuleTemporalInfo(granule);
const { startDate, stopDate } = executionDescription;
const processingTimeInfo = {};
if (startDate) {
processingTimeInfo.processingStartDateTime = startDate.toISOString();
processingTimeInfo.processingEndDateTime = stopDate
? stopDate.toISOString()
: new Date().toISOString();
}
const record = {
granuleId: granule.granuleId,
pdrName: get(message, 'meta.pdr.name'),
collectionId,
status: get(message, 'meta.status', get(granule, 'status')),
provider: get(message, 'meta.provider.id'),