18.2.1 • Published 24 hours ago

@cumulus/cmr-client v18.2.1

Weekly downloads
165
License
Apache-2.0
Repository
github
Last release
24 hours ago

@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

Kind: global class

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({
 provider: 'my-provider',
 clientId: 'my-clientId',
 username: 'my-username',
 password: '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.tokenstringCMR request token
params.ummgVersionstringUMMG 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(params, format) ⇒ Promise.<Object>

Search in collections

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

ParamTypeDefaultDescription
paramsstringthe search parameters
formatstring"json"format of the response

cmrClient.searchGranules(params, format) ⇒ Promise.<Object>

Search in granules

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

ParamTypeDefaultDescription
paramsstringthe search parameters
formatstring"'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.searchParamsstring"{}"the search parameters
params.formatstringthe result format

Example

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

const cmrSearchConceptQueue = new CMRSearchConceptQueue({
  provider: 'my-provider',
  clientId: 'my-clientId',
  type: 'granule',
  searchParams: {},
  format: '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

16.1.5

24 hours ago

18.2.1

2 days ago

16.1.4

11 days ago

18.2.0

3 months ago

16.1.3

4 months ago

18.2.0-alpha.0

5 months ago

16.1.1

9 months ago

16.1.0

9 months ago

16.1.2

6 months ago

18.1.0

7 months ago

17.0.0

9 months ago

18.0.0

9 months ago

16.0.3-alpha.0

10 months ago

16.0.0

10 months ago

15.0.4

11 months ago

16.0.1-alpha.0

11 months ago

16.0.2-alpha.0

11 months ago

15.0.2

1 year ago

15.0.3

1 year ago

15.0.1

1 year ago

14.1.0

1 year ago

15.0.0

1 year ago

13.4.0

2 years ago

11.1.8

2 years ago

13.3.3-alpha.0

2 years ago

14.0.0

1 year ago

13.3.3-alpha.1

2 years ago

13.3.2

2 years ago

12.0.3

2 years ago

13.3.1

2 years ago

11.1.6

2 years ago

11.1.7

2 years ago

13.3.0

2 years ago

12.0.1

2 years ago

12.0.2

2 years ago

13.0.0

2 years ago

13.0.1

2 years ago

11.1.5

2 years ago

11.1.3

2 years ago

11.1.4

2 years ago

11.1.2

2 years ago

13.1.0

2 years ago

10.1.3

2 years ago

13.2.0

2 years ago

13.2.1

2 years ago

12.0.0

2 years ago

10.0.2

2 years ago

11.1.1

2 years ago

11.1.0

2 years ago

11.0.0

2 years ago

9.9.4

2 years ago

10.1.2

2 years ago

9.4.2

2 years ago

10.1.1

2 years ago

9.4.1

2 years ago

10.0.0

2 years ago

10.0.1

2 years ago

9.9.1

2 years ago

9.7.1

2 years ago

10.1.0

2 years ago

9.9.2

2 years ago

9.9.3

2 years ago

9.2.4

2 years ago

9.2.3

2 years ago

10.0.0-beta.0

2 years ago

9.9.0

3 years ago

9.8.0

3 years ago

9.7.0

3 years ago

9.6.0

3 years ago

9.5.0

3 years ago

9.4.0

3 years ago

9.2.2

3 years ago

8.1.2

3 years ago

9.2.1

3 years ago

9.3.0

3 years ago

9.2.0

3 years ago

8.1.1

3 years ago

9.1.0

3 years ago

8.1.0

3 years ago

9.0.1

3 years ago

9.0.0

3 years ago

8.0.0

3 years ago

6.0.1

3 years ago

7.2.0

3 years ago

7.1.0

3 years ago

7.0.0

3 years ago

6.0.0

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.0.0

3 years ago

3.0.1

4 years ago

2.0.8

4 years ago

3.0.0

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.24.0

4 years ago

1.23.2

4 years ago

1.23.1

4 years ago

1.23.0

4 years ago

1.22.1

4 years ago

1.22.0

4 years ago

1.21.0

4 years ago

1.20.0

4 years ago

1.19.0

4 years ago

1.18.0-alpha.1

4 years ago

1.18.0

4 years ago

1.17.0

4 years ago

1.14.5

4 years ago

1.16.1

4 years ago

1.16.0

4 years ago

1.15.0

5 years ago

1.13.6

5 years ago

1.14.4

5 years ago

1.14.3

5 years ago

1.14.2

5 years ago

1.14.1

5 years ago

1.13.5

5 years ago

1.14.0

5 years ago

1.13.4

5 years ago

1.13.3

5 years ago

1.13.2

5 years ago

1.13.1

5 years ago

1.13.0

5 years ago

1.12.1

5 years ago

1.12.0

5 years ago

1.11.2-alpha2

5 years ago

1.11.2-alpha1

5 years ago