{"id":15046035,"url":"https://github.com/flevi29/oai_pmh_v2","last_synced_at":"2025-06-14T10:33:09.798Z","repository":{"id":57879742,"uuid":"528787671","full_name":"flevi29/oai_pmh_v2","owner":"flevi29","description":"Deno and Node.js API module for OAI-PMH.","archived":false,"fork":false,"pushed_at":"2024-06-13T11:46:34.000Z","size":721,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T03:33:55.342Z","etag":null,"topics":["deno","harvest","javascript","metadata","nodejs","oai-pmh","protocol","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flevi29.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-25T09:48:26.000Z","updated_at":"2024-06-18T08:28:59.000Z","dependencies_parsed_at":"2023-11-08T04:22:34.871Z","dependency_job_id":"8156191b-daee-4c23-b68e-2a6164e322ac","html_url":"https://github.com/flevi29/oai_pmh_v2","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"fc79229afb40fad84b6ba1c5bbb8e13052b46527"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/flevi29/oai_pmh_v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flevi29%2Foai_pmh_v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flevi29%2Foai_pmh_v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flevi29%2Foai_pmh_v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flevi29%2Foai_pmh_v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flevi29","download_url":"https://codeload.github.com/flevi29/oai_pmh_v2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flevi29%2Foai_pmh_v2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259802060,"owners_count":22913561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","harvest","javascript","metadata","nodejs","oai-pmh","protocol","typescript"],"created_at":"2024-09-24T20:52:37.002Z","updated_at":"2025-06-14T10:33:09.772Z","avatar_url":"https://github.com/flevi29.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OAI-PMH TypeScript client\n\n[![Version][npm-svg]][npm-url]\n\nIt's an\n[OAI-PMH Version 2.0](https://www.openarchives.org/OAI/openarchivesprotocol.html)\nAPI client package/module for Node.js and Deno.\n\n## Installing (Node.js)\n\n```sh\nnpm i oai_pmh_v2\n```\n\n\u003c!--deno-fmt-ignore-start--\u003e\n\u003e [!IMPORTANT]\n\u003e For Node.js users a\n\u003e [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch#browser_compatibility)\n\u003e compatible version of the runtime is required, or a polyfill otherwise (like\n\u003e [`node-fetch`](https://github.com/node-fetch/node-fetch?tab=readme-ov-file#providing-global-access)).\n\u003c!--deno-fmt-ignore-end--\u003e\n\n## Example\n\n\u003c!--deno-fmt-ignore-start--\u003e\n\u003e [!NOTE]\n\u003e It is possible to iterate through the generator with a `for...of`\n\u003e loop, but this way we can only acquire the\n\u003e [`yield`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield)\n\u003e -ed values of the generator, the `return` -ed value would be lost, and the\n\u003e `return` -ed value contains the potential error.\n\u003c!--deno-fmt-ignore-end--\u003e\n\n```typescript\n// `... from \"npm:oai_pmh_v2\"` for Deno\nimport { OAIPMH, STATUS } from \"oai_pmh_v2\";\n\n// you can find OAI-PMH providers here (although a lot of them might not work):\n// https://www.openarchives.org/Register/BrowseSites\nconst oaiPMH = new OAIPMH({\n  baseURL:\n    \"http://bibliotecavirtual.asturias.es/i18n/oai/oai_bibliotecavirtual.asturias.es.cmd\",\n});\n\nconst g = oaiPMH.listIdentifiers(\n  { metadataPrefix: \"marc21\", from: \"2015-04-10\", until: \"2015-10-28\" },\n  { signal: AbortSignal.timeout(30_000) },\n);\n\nfor (;;) {\n  const { done, value: gVal } = await g.next();\n\n  if (done) {\n    // there are no more values yielded by the generator\n    const { status, value } = gVal;\n\n    if (status !== STATUS.OK) {\n      // handle error, we can narrow error type by checking\n      // against specific values of `STATUS` enum\n      console.error(value);\n    }\n\n    // break out of loop as there are no more yielded values\n    break;\n  }\n\n  console.log(JSON.stringify(gVal));\n}\n```\n\n\u003c!-- TODO: Mention import { setMaxListeners } from \"node:events\"; setMaxListeners(2000, this.#abortController.signal); --\u003e\n\n\u003c!--deno-fmt-ignore-start--\u003e\n\u003e [!WARNING]\n\u003e When using an `AbortSignal` with any list method\n\u003e (`listIdentifiers`, `listRecords`, `listSets`), there will be some minuscule\n\u003e memory leak until the loop exits. This is because for each request there is an\n\u003e additional listener registered for the signal. Specifically in Node.js this\n\u003e will cause a lot of warnings (after 100 or so loops). This is a fetch API spec\n\u003e limitation, see [issue](https://github.com/nodejs/undici/issues/939).\n\u003c!--deno-fmt-ignore-end--\u003e\n\n## General shape of parsed data\n\n```typescript\ntype ParsedXMLRecordValue = {\n  // index in XML tree branch, for preserving order of elements\n  i: number;\n  // XML attributes\n  attr?: Record\u003cstring, string\u003e;\n  // either a text value, another branch of the XML tree,\n  // or undefined in case of an empty XML element\n  val?: string | ParsedXML;\n};\n\ntype ParsedXML = Record\u003cstring, ParsedXMLRecordValue[]\u003e;\n```\n\nFind examples for all methods in\n[examples directory](https://github.com/flevi29/oai_pmh_v2/tree/main/examples).\nDocumentation via types.\n\n[npm-svg]: https://img.shields.io/npm/v/oai_pmh_v2.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/oai_pmh_v2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflevi29%2Foai_pmh_v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflevi29%2Foai_pmh_v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflevi29%2Foai_pmh_v2/lists"}