Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function getCmrCollections() {
const collections = [];
// get all collections from CMR and sort them, since CMR query doesn't support
// 'version' as sort_key
const cmrCollectionsIterator = new CMRSearchConceptQueue(
process.env.cmr_provider, process.env.cmr_client_id, 'collections', [], 'echo10'
);
let nextCmrItem = await cmrCollectionsIterator.peek();
while (nextCmrItem) {
await cmrCollectionsIterator.shift(); // eslint-disable-line no-await-in-loop
// evaluate each EMS field based on CMR collection and build EMS record
const emsRecord = Object.entries(emsMapping)
// eslint-disable-next-line no-loop-func
.map(([field, value]) =>
({ [field]: (isFunction(value) ? value(nextCmrItem.Collection) : value) }))
.reduce((returnObj, currentValue) => ({ ...returnObj, ...currentValue }), {});
const collectionId = constructCollectionId(
async function reconciliationReportForGranules(collectionId, bucketsConfig) {
// compare granule holdings:
// Get CMR granules list (by PROVIDER, short_name, version, sort_key: ['granule_ur'])
// Get CUMULUS granules list (by collectionId order by granuleId)
// Report granules only in CMR
// Report granules only in CUMULUS
const { name, version } = deconstructCollectionId(collectionId);
const cmrGranulesIterator = new CMRSearchConceptQueue(
process.env.cmr_provider, process.env.cmr_client_id, 'granules',
{ short_name: name, version: version, sort_key: ['granule_ur'] }, 'umm_json'
);
const dbGranulesIterator = new Granule().getGranulesForCollection(collectionId, 'completed');
const granulesReport = {
okCount: 0,
onlyInCumulus: [],
onlyInCmr: []
};
const filesReport = {
okCount: 0,
onlyInCumulus: [],
onlyInCmr: []