open-index/open-npm huggingface dataset:
npm package: @indexdata/harvester-admin
Description: Admin console for the Index Data Harvester
Latest version: 3.0.0

# ui-harvester-admin

Copyright (C) 2022 Index Data Aps.

This software is distributed under the terms of the Apache License, Version 2.0. See the file "[LICENSE](LICENSE)" for more information.

## Overview

This is a Stripes UI modules providing an administrative interface to the Index Data Harvester by communicating with [`mod-harvester-admin`](https://github.com/indexdata/mod-harvester-admin).

## See also

* [Routes and methods implemented by `mod-harvester-admin`](doc/routing.md)
* [Links on implementing the Harvester Admin UI](doc/links.md)
* [Notes on UI requirements](doc/ui.md)
* [The harvester query language](doc/query-language.md)
* [Running `ui-harvester-admin` against a local backend](doc/running.md)
* [Re-establishing permissions after changing the module descriptor](doc/permissions.md)
* [Very lightweight local issues database](doc/TODO.md)
* [Exercising the OAI-PMH tools](doc/exercising-oai-pmh.md)

And outside of this repository:

* [Project UIHAADM](https://issues.folio.org/browse/UIHAADM) at the FOLIO issue tracker
* [`mod-harvester-admin`](https://github.com/indexdata/mod-harvester-admin), the corresponding server-side module.
npm package: @indexdata/oai-pmh
Description: Simple client library for OAI-PMH
Latest version: 0.0.3

# @indexdata/oai-pmh

Copyright (C) 2022 Index Data Aps.

This software is distributed under the terms of the Apache License, Version 2.0. See the file "[LICENSE](LICENSE)" for more information.


## Overview

This is a very simple
[OAI-PMH](https://www.openarchives.org/OAI/openarchivesprotocol.html)
client library, written because
[all the various existing libraries known to Node](https://www.npmjs.com/search?q=oai-pmh)
are abandonware or undocumented.

It exists primarily for the use of
[`ui-harvester-admin`](https://github.com/indexdata/ui-harvester-admin)
but should be of wider utility.


## API

First, create an OAI-PMH client object associated with a specific service:

	import OaiPmh from '@indexdata/oai-pmh';
	const oaiPmh = new OaiPmh('https://ora.ox.ac.uk/oai2');

Now you can use it to ask the server to identify itself, supply a list of sets, etc:

	const identity = await oaiPmh.identify();
	const sets = await oaiPmh.listSets();
	const formats = await oaiPmh.listMetadataFormats();

At present, only the Identify, ListSets and ListMetadataFormat verbs are supported: we will add others as we have a need for them. The optional parameters to the second and third of these are ignored.

All methods return a promise that resolves to a JavaScript object containing the data returned from the service. So for example:

	formats.ListMetadataFormats[0].metadataFormat.map(x => {
	  console.log(`prefix '${x.metadataPrefix} -> ${}`);
	});

See the [very simple example code](example.js).


## Note on dependencies

The package file includes a dependencies on `timers` and `stream` even though we don't use those packages directly. This is because the `xml2js` library needs them but doesn't have dependencies, probably because it's relying on the behavior of Babel before v5.x which used to polyfill various node.js core modules.


## Of CORS security is an issue

Understandably, when a browser loads the FOLIO SPA from one origin, it's unhappy about letting that SPA make OAI-PMH requests (or any HTTP requests) to other origins. We will need to figure out a way to address this in production, but for development it suffices to use the
[`local-cors-anywhere`](https://github.com/dkaoster/local-cors-anywhere)
web proxy. Install globally with
`yarn global add local-cors-anywhere`
and run as
`env PORT=8081 ~/.yarn/bin/local-cors-anywhere`.
Then prefix OAI-PMH service URLs with
`http://localhost:8081/`,
so that the SPA accesses services at URLs like
http://localhost:8081/https://ora.ox.ac.uk/oai2