How to use the @cumulus/common/util.deprecate function in @cumulus/common

To help you get started, we’ve selected a few @cumulus/common 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 / deployment / lib / message.js View on Github external
function fixCumulusMessageSyntax(cumulusConfig) {
  if (!cumulusConfig) return {};
  deprecate('CumulusConfig', '1.15.0', 'AWS Parameters with task_config');
  const test = new RegExp('^([\\{]{1}|[\\[]{1})(\\$.*)([\\]]{1}|[\\}]{1})$');

  Object.keys(cumulusConfig).forEach((n) => {
    if (isObject(cumulusConfig[n])) {
      // eslint-disable-next-line no-param-reassign
      cumulusConfig[n] = fixCumulusMessageSyntax(cumulusConfig[n]);
    } else if (isString(cumulusConfig[n])) {
      const match = cumulusConfig[n].match(test);
      if (match) {
        // eslint-disable-next-line no-param-reassign
        cumulusConfig[n] = `{${match[0]}}`;
      }
    }
  });

  return cumulusConfig;
github nasa / cumulus / packages / ingest / aws.js View on Github external
static async stop(arn, cause, error) {
    deprecate('@cumulus/ingest/aws StepFunction.stop', '1.13.0');

    const stepfunctions = new AWS.StepFunctions();
    return stepfunctions.stopExecution({
      executionArn: arn,
      cause: cause,
      error: error
    }).promise();
  }
}
github nasa / cumulus / packages / api / models / granules.js View on Github external
async removeGranuleFromCmr(granuleId, collectionId) {
    deprecate('@cumulus/api/Granule.removeGranuleFromCmr', '1.11.3', '@cumulus/api/Granule.removeGranuleFromCmrByGranule');

    const granule = await this.get({ granuleId });

    return this.removeGranuleFromCmrByGranule(granule);
  }
github nasa / cumulus / packages / api / lib / response.js View on Github external
function resp(context, err, bodyArg, statusArg = null, headers = {}) {
  deprecate(
    '@cumulus/api/response.resp()',
    '1.10.3',
    '@cumulus/api/responses'
  );

  if (!isFunction(context.succeed)) {
    throw new TypeError('context as object with succeed method not provided');
  }

  let body = bodyArg;
  let statusCode = statusArg;

  if (err) {
    log.error(err);
    statusCode = statusCode || 400;
    body = {
github nasa / cumulus / packages / cmrjs / utils.js View on Github external
function hostId(env) {
  deprecate('@cumulus/cmrjs/utils#hostId', '1.11.3');
  return _get(
    { OPS: '', SIT: 'sit', UAT: 'uat' },
    env,
    'sit'
  );
}
github nasa / cumulus / packages / cmrjs / utils.js View on Github external
function getHost(environment = process.env) {
  deprecate('@cumulus/cmrjs/utils#getHost', '1.11.3');
  const env = environment.CMR_ENVIRONMENT;
  if (environment.CMR_HOST) return environment.CMR_HOST;

  const host = ['cmr', hostId(env), 'earthdata.nasa.gov'].filter((d) => d).join('.');
  return host;
}
github nasa / cumulus / packages / cmrjs / utils.js View on Github external
async function validateUMMG(ummMetadata, identifier, provider) {
  deprecate('@cumulus/cmrjs/utils#validateUMMG', '1.11.3');
  const version = ummVersion(ummMetadata);
  let result;

  try {
    result = await got.post(`${getUrl('validate', provider, process.env.CMR_ENVIRONMENT)}granule/${identifier}`, {
      json: true,
      body: ummMetadata,
      headers: {
        Accept: 'application/json',
        'Content-type': `application/vnd.nasa.cmr.umm+json;version=${version}`
      }
    });

    if (result.statusCode === 200) {
      return true;
    }
github nasa / cumulus / packages / cmrjs / cmr.js View on Github external
constructor(provider, clientId, username, password) {
    deprecate('@cmrjs/CMR', '1.11.3');

    this.provider = provider;
    this.cmrClient = new cmrClient.CMR({
      provider,
      clientId,
      username,
      password
    });
  }
github nasa / cumulus / packages / cmrjs / utils.js View on Github external
function ummVersion(umm) {
  deprecate('@cumulus/cmrjs/utils#ummVersion', '1.11.3');
  return _get(umm, 'MetadataSpecification.Version', '1.4');
}
github nasa / cumulus / packages / cmrjs / cmr-utils.js View on Github external
function getCmrFiles(input, granuleIdExtraction) {
  deprecate('@cumulus/cmrjs.getCmrFiles', '1.11.3');
  const files = [];

  input.forEach((filename) => {
    if (isCMRFilename(filename)) {
      const cmrFileObject = {
        filename,
        granuleId: getGranuleId(filename, granuleIdExtraction)
      };
      files.push(cmrFileObject);
    }
  });

  return files;
}