Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cumulus/cmr-client

Package Overview
Dependencies
Maintainers
7
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cumulus/cmr-client

[![Build Status](https://travis-ci.org/nasa/cumulus.svg?branch=master)](https://travis-ci.org/nasa/cumulus)

  • 1.11.2-alpha2
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created
Source

@cumulus/cmr-client

Build Status

A Node.js client to read from, write to, and delete from NASA's Common Metadata Repository (CMR) API.

API

Classes

CMR

A class to simplify requests to the CMR

CMRSearchConceptQueue

A class to efficiently list all of the concepts (collections/granules) from CMR search, without loading them all into memory at once. Handles paging.

CMR

A class to simplify requests to the CMR

Kind: global class

  • CMR
    • new CMR(params)
    • .getToken()Promise.<string>
    • .getHeaders(params)Object
    • .ingestCollection(xml)Promise.<Object>
    • .ingestGranule(xml)Promise.<Object>
    • .ingestUMMGranule(ummgMetadata)Promise.<Object>
    • .deleteCollection(datasetID)Promise.<Object>
    • .deleteGranule(granuleUR)Promise.<Object>
    • .searchCollections(searchParams, [format])Promise.<Object>
    • .searchGranules(searchParams, [format])Promise.<Object>

new CMR(params)

The constructor for the CMR class

ParamTypeDescription
paramsObject
params.providerstringthe CMR provider id
params.clientIdstringthe CMR clientId
params.usernamestringCMR username
params.passwordstringCMR password

Example

const { CMR } = require('@cumulus/cmr-client');

const cmrClient = new CMR('my-provider', 'my-clientId', 'my-username', 'my-password');

cmrClient.getToken() ⇒ Promise.<string>

The method for getting the token

Kind: instance method of CMR
Returns: Promise.<string> - the token

cmrClient.getHeaders(params) ⇒ Object

Return object containing CMR request headers

Kind: instance method of CMR
Returns: Object - CMR headers object

ParamTypeDescription
paramsObject
[params.token]stringCMR request token
[params.ummgVersion]stringUMMG metadata version string or null if echo10 metadata

cmrClient.ingestCollection(xml) ⇒ Promise.<Object>

Adds a collection record to the CMR

Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response

ParamTypeDescription
xmlstringthe collection XML document

cmrClient.ingestGranule(xml) ⇒ Promise.<Object>

Adds a granule record to the CMR

Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response

ParamTypeDescription
xmlstringthe granule XML document

cmrClient.ingestUMMGranule(ummgMetadata) ⇒ Promise.<Object>

Adds/Updates UMMG json metadata in the CMR

Kind: instance method of CMR
Returns: Promise.<Object> - to the CMR response object.

ParamTypeDescription
ummgMetadataObjectUMMG metadata object

cmrClient.deleteCollection(datasetID) ⇒ Promise.<Object>

Deletes a collection record from the CMR

Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response

ParamTypeDescription
datasetIDstringthe collection unique id

cmrClient.deleteGranule(granuleUR) ⇒ Promise.<Object>

Deletes a granule record from the CMR

Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response

ParamTypeDescription
granuleURstringthe granule unique id

cmrClient.searchCollections(searchParams, [format]) ⇒ Promise.<Object>

Search in collections

Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response

ParamTypeDefaultDescription
searchParamsstringthe search parameters
searchParams.provider_short_namestringprovider shortname
[format]string"json"format of the response

cmrClient.searchGranules(searchParams, [format]) ⇒ Promise.<Object>

Search in granules

Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response

ParamTypeDefaultDescription
searchParamsstringthe search parameters
searchParams.provider_short_namestringprovider shortname
[format]string"'json'"format of the response

CMRSearchConceptQueue

A class to efficiently list all of the concepts (collections/granules) from CMR search, without loading them all into memory at once. Handles paging.

Kind: global class

new CMRSearchConceptQueue(params)

The constructor for the CMRSearchConceptQueue class

ParamTypeDefaultDescription
paramsObject
params.providerstringthe CMR provider id
params.clientIdstringthe CMR clientId
params.typestringthe type of search 'granule' or 'collection'
[params.searchParams]string"{}"the search parameters
params.formatstringthe result format

Example

const { CMRSearchConceptQueue } = require('@cumulus/cmr-client');

const cmrSearchConceptQueue = new CMRSearchConceptQueue(
  'my-provider',
  'my-clientId',
  'granule',
  {},
  'json'
);

cmrSearchConceptQueue.peek() ⇒ Promise.<Object>

View the next item in the queue

This does not remove the object from the queue. When there are no more items in the queue, returns 'null'.

Kind: instance method of CMRSearchConceptQueue
Returns: Promise.<Object> - an item from the CMR search

cmrSearchConceptQueue.shift() ⇒ Promise.<Object>

Remove the next item from the queue

When there are no more items in the queue, returns null.

Kind: instance method of CMRSearchConceptQueue
Returns: Promise.<Object> - an item from the CMR search

CMR Docs

CMR REST API endpoint documentation is here:

What is Cumulus?

Cumulus is a cloud-based data ingest, archive, distribution and management prototype for NASA's future Earth science data streams.

Cumulus Documentation

Test

Test with npm run test.

Contributing

See Cumulus README


Generated automatically using npm run build-docs

Keywords

FAQs

Package last updated on 04 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc