How to use the @cumulus/cmrjs.getGranuleTemporalInfo function in @cumulus/cmrjs

To help you get started, we’ve selected a few @cumulus/cmrjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus / packages / api / models / granules.js View on Github external
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'),