@the_library/standard-adapters 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +684 -0
- package/README.md +69 -61
- package/THIRD_PARTY_NOTICES +3 -0
- package/dist/bbk/index.js +11 -2
- package/dist/bbk/index.js.map +1 -1
- package/dist/cc/index.js +11 -2
- package/dist/cc/index.js.map +1 -1
- package/dist/{chunk-INW2BUCX.js → chunk-5RNEFYG4.js} +10 -3
- package/dist/chunk-5RNEFYG4.js.map +1 -0
- package/dist/{chunk-VP4ER7MD.js → chunk-5W3ZWMUQ.js} +10 -3
- package/dist/chunk-5W3ZWMUQ.js.map +1 -0
- package/dist/{chunk-D5QOJWWA.js → chunk-ADV2G3VE.js} +10 -3
- package/dist/chunk-ADV2G3VE.js.map +1 -0
- package/dist/{chunk-KNGZ7NJF.js → chunk-B3OKVAXL.js} +10 -3
- package/dist/chunk-B3OKVAXL.js.map +1 -0
- package/dist/{chunk-3OK4JVCA.js → chunk-BJQSNRJI.js} +11 -3
- package/dist/chunk-BJQSNRJI.js.map +1 -0
- package/dist/{chunk-AHIDYNLW.js → chunk-HQICVT3W.js} +10 -3
- package/dist/chunk-HQICVT3W.js.map +1 -0
- package/dist/{chunk-GJJ6NIDQ.js → chunk-HWMSPPAK.js} +10 -3
- package/dist/chunk-HWMSPPAK.js.map +1 -0
- package/dist/{chunk-KOHT5EA3.js → chunk-OMNF76QQ.js} +10 -3
- package/dist/chunk-OMNF76QQ.js.map +1 -0
- package/dist/{chunk-DX6SH342.js → chunk-Q72TUYFB.js} +10 -3
- package/dist/chunk-Q72TUYFB.js.map +1 -0
- package/dist/{chunk-C5WHAJXI.js → chunk-QCAFHNGS.js} +10 -3
- package/dist/chunk-QCAFHNGS.js.map +1 -0
- package/dist/{chunk-IJYCM5NU.js → chunk-TACIHHFK.js} +10 -3
- package/dist/chunk-TACIHHFK.js.map +1 -0
- package/dist/clc/index.js +11 -2
- package/dist/clc/index.js.map +1 -1
- package/dist/ddc/index.js +11 -2
- package/dist/ddc/index.js.map +1 -1
- package/dist/index.js +53 -12
- package/dist/index.js.map +1 -1
- package/dist/isbn/index.js +11 -2
- package/dist/isbn/index.js.map +1 -1
- package/dist/isni/index.js +11 -2
- package/dist/isni/index.js.map +1 -1
- package/dist/issn/index.js +11 -2
- package/dist/issn/index.js.map +1 -1
- package/dist/lcc/index.js +11 -2
- package/dist/lcc/index.js.map +1 -1
- package/dist/orcid/index.js +11 -2
- package/dist/orcid/index.js.map +1 -1
- package/dist/tlc/index.js +11 -2
- package/dist/tlc/index.js.map +1 -1
- package/dist/udc/index.js +11 -2
- package/dist/udc/index.js.map +1 -1
- package/package.json +17 -13
- package/dist/chunk-3OK4JVCA.js.map +0 -1
- package/dist/chunk-AHIDYNLW.js.map +0 -1
- package/dist/chunk-C5WHAJXI.js.map +0 -1
- package/dist/chunk-D5QOJWWA.js.map +0 -1
- package/dist/chunk-DX6SH342.js.map +0 -1
- package/dist/chunk-GJJ6NIDQ.js.map +0 -1
- package/dist/chunk-IJYCM5NU.js.map +0 -1
- package/dist/chunk-INW2BUCX.js.map +0 -1
- package/dist/chunk-KNGZ7NJF.js.map +0 -1
- package/dist/chunk-KOHT5EA3.js.map +0 -1
- package/dist/chunk-VP4ER7MD.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,52 +1,58 @@
|
|
|
1
1
|
# `@the_library/standard-adapters`
|
|
2
2
|
|
|
3
|
-
Runtime `StandardAdapter` implementations for every international identifier and classification standard defined in the companion package [`@the_library/canonical-schemas`](
|
|
3
|
+
Runtime `StandardAdapter` implementations for every international identifier and classification standard defined in the companion package [`@the_library/canonical-schemas`](https://www.npmjs.com/package/@the_library/canonical-schemas). This package ships **executable code** — normalization, validation, check-digit algorithms, Linked Data URIs and external API lookups. `canonical-schemas` ships the JSON definitions and TypeScript interfaces those implementations satisfy.
|
|
4
4
|
|
|
5
5
|
> If `canonical-schemas` answers "what is an ISBN and what props does it contribute?", `standard-adapters` answers "given a string, is it a valid ISBN, and how do I fetch metadata for it?"
|
|
6
6
|
|
|
7
|
+
These standards are how the World Library speaks the language of existing library catalogues; the reasons are explained in [Why canonical definitions](https://www.npmjs.com/package/@the_library/canonical-schemas#why-canonical-definitions) and in the SDK's [Why it is designed this way](https://www.npmjs.com/package/@the_library/public#why-it-is-designed-this-way).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install @the_library/standard-adapters
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`@the_library/canonical-schemas` is a peer dependency (its types describe the adapters); npm 7+ installs it automatically. ESM only.
|
|
18
|
+
|
|
7
19
|
---
|
|
8
20
|
|
|
9
21
|
## Licence
|
|
10
22
|
|
|
11
|
-
Published under the **D-Open Code Sovereign Licence
|
|
23
|
+
Published under the **D-Open Code Sovereign Licence 1.1 (unified edition)** (`LicenseRef-DOCSL-1.1`), the same licence covering `canonical-schemas`: non-commercial use of unmodified copies only. See the [`LICENSE`](./LICENSE) file. Third-party components: [`THIRD_PARTY_NOTICES`](./THIRD_PARTY_NOTICES). See the [full text](https://registry.worldbibliotech.com/licence) and [Licences in detail](https://www.npmjs.com/package/@the_library/canonical-schemas#licences-in-detail).
|
|
12
24
|
|
|
13
25
|
---
|
|
14
26
|
|
|
15
27
|
## Package layout
|
|
16
28
|
|
|
17
29
|
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
bbk/index.ts BBKAdapter — classification, no external API
|
|
36
|
-
tlc/index.ts TLCAdapter — classification, no external API
|
|
37
|
-
cc/index.ts CCAdapter — classification, no external API
|
|
38
|
-
|
|
39
|
-
tsup.config.ts Per-adapter entry points → subpath exports
|
|
40
|
-
vitest.config.ts include: src/**/*.test.ts
|
|
30
|
+
src/
|
|
31
|
+
index.ts Barrel export — all 11 adapters + apiKeyDictionary
|
|
32
|
+
api-keys.ts apiKeyDictionary singleton (set/get/require)
|
|
33
|
+
|
|
34
|
+
isbn/index.ts ISBNAdapter — Open Library + Google Books APIs
|
|
35
|
+
isbn/types.ts OpenLibraryBookResult, GoogleBooksVolumeResult
|
|
36
|
+
issn/index.ts ISSNAdapter — ISSN Portal API
|
|
37
|
+
isni/index.ts ISNIAdapter — ISNI SRU API
|
|
38
|
+
orcid/index.ts ORCIDAdapter — ORCID public record + search APIs
|
|
39
|
+
|
|
40
|
+
ddc/index.ts DDCAdapter — classification, no external API
|
|
41
|
+
lcc/index.ts LCCAdapter — classification, no external API
|
|
42
|
+
udc/index.ts UDCAdapter — classification, no external API
|
|
43
|
+
clc/index.ts CLCAdapter — classification, no external API
|
|
44
|
+
bbk/index.ts BBKAdapter — classification, no external API
|
|
45
|
+
tlc/index.ts TLCAdapter — classification, no external API
|
|
46
|
+
cc/index.ts CCAdapter — classification, no external API
|
|
41
47
|
```
|
|
42
48
|
|
|
43
|
-
Each identifier standard (`isbn`, `issn`, `isni`, `orcid`) also has a `types.ts` declaring the shape of its external API responses
|
|
49
|
+
Each identifier standard (`isbn`, `issn`, `isni`, `orcid`) also has a `types.ts` declaring the shape of its external API responses and a `*.test.ts` covering `normalize` / `validate` / `toLinkedDataUri`, plus an `INTEGRATION`-gated live-API test (see [Testing](#testing)). `ddc` has a test file too. Classification standards have no external lookup — a classifier assigns the notation — so they carry no `types.ts` and an empty `apis: {}`.
|
|
44
50
|
|
|
45
51
|
---
|
|
46
52
|
|
|
47
53
|
## The `StandardAdapter` contract
|
|
48
54
|
|
|
49
|
-
Every
|
|
55
|
+
Every adapter implements the interface defined in `@the_library/canonical-schemas/types/StandardAdapter`:
|
|
50
56
|
|
|
51
57
|
```typescript
|
|
52
58
|
export interface StandardAdapter<TProps, TApis> {
|
|
@@ -60,13 +66,13 @@ export interface StandardAdapter<TProps, TApis> {
|
|
|
60
66
|
}
|
|
61
67
|
```
|
|
62
68
|
|
|
63
|
-
- **`normalize`** — canonicalizes input into the standard's authoritative storage form (e.g. ISBN-10 → ISBN-13, hyphens stripped). This is the form
|
|
64
|
-
- **`display`** —
|
|
65
|
-
- **`validate`** — runs pattern matching and, where applicable, the standard's check-digit algorithm (`isbn-13-luhn`, `iso7064-mod11-2`). Returns `{ valid, error? }` rather than throwing, so callers can
|
|
66
|
-
- **`toLinkedDataUri`** —
|
|
67
|
-
- **`apis`** — a map of `StandardApiAdapter
|
|
69
|
+
- **`normalize`** — canonicalizes input into the standard's authoritative storage form (e.g. ISBN-10 → ISBN-13, hyphens stripped). This is the form stored in records.
|
|
70
|
+
- **`display`** — formats the normalized value for people (e.g. `978-0-262-03384-8`).
|
|
71
|
+
- **`validate`** — runs pattern matching and, where applicable, the standard's check-digit algorithm (`isbn-13-luhn`, `iso7064-mod11-2`). Returns `{ valid, error? }` rather than throwing, so callers can show the reason inline.
|
|
72
|
+
- **`toLinkedDataUri`** — the RDF/Linked Data URI (`urn:isbn:…`, `https://orcid.org/…`, `https://isni.org/isni/…`, `https://id.loc.gov/authorities/classification/…`).
|
|
73
|
+
- **`apis`** — a map of `StandardApiAdapter` objects (`{ apiId, name, fetch(props) }`) for standards with external lookups; empty (`{}`) for classification standards.
|
|
68
74
|
|
|
69
|
-
Governance policy (see `canonical-schemas/governance/GOVERNANCE.md
|
|
75
|
+
Governance policy (see [`GOVERNANCE.md`](https://unpkg.com/@the_library/canonical-schemas/governance/GOVERNANCE.md)) requires each adapter's `apis` keys to match the `externalApis[].id` entries of the corresponding `standards/<id>.json` 1:1. The `@the_library/db_schemas` compiler enforces standard existence, `uriScheme` presence and prop-name collisions for `uidStrategy` / `instanceUidStrategy`, but it does not cross-check `externalApis[].id` against an adapter's `apis` keys: keeping the two in sync is a code-review convention, not a compiler-enforced invariant.
|
|
70
76
|
|
|
71
77
|
### Example: `ISBNAdapter`
|
|
72
78
|
|
|
@@ -76,10 +82,11 @@ import { ISBNAdapter } from '@the_library/standard-adapters/isbn';
|
|
|
76
82
|
ISBNAdapter.normalize('0-262-03384-4'); // '9780262033848'
|
|
77
83
|
ISBNAdapter.display('9780262033848'); // '978-0-262-03384-8'
|
|
78
84
|
ISBNAdapter.validate('978-0-262-03384-8'); // { valid: true }
|
|
85
|
+
ISBNAdapter.validate('978-0-262-03384-9'); // { valid: false, error: 'Check digit mismatch: expected 8, got 9' }
|
|
79
86
|
ISBNAdapter.toLinkedDataUri('9780262033848'); // 'urn:isbn:9780262033848'
|
|
80
87
|
|
|
81
88
|
const meta = await ISBNAdapter.apis.openlibrary.fetch({ isbn: '9780262033848' });
|
|
82
|
-
// { title
|
|
89
|
+
// OpenLibraryBookResult: { title?, authors?, publishDate?, pageCount?, coverUrl?, description? }
|
|
83
90
|
```
|
|
84
91
|
|
|
85
92
|
### Example: a classification adapter (no external API)
|
|
@@ -87,15 +94,16 @@ const meta = await ISBNAdapter.apis.openlibrary.fetch({ isbn: '9780262033848' })
|
|
|
87
94
|
```typescript
|
|
88
95
|
import { DDCAdapter } from '@the_library/standard-adapters/ddc';
|
|
89
96
|
|
|
90
|
-
DDCAdapter.validate('813.54');
|
|
91
|
-
DDCAdapter.
|
|
97
|
+
DDCAdapter.validate('813.54'); // { valid: true }
|
|
98
|
+
DDCAdapter.toLinkedDataUri('813.54'); // 'https://id.loc.gov/authorities/classification/813.54'
|
|
99
|
+
DDCAdapter.apis; // {}
|
|
92
100
|
```
|
|
93
101
|
|
|
94
102
|
---
|
|
95
103
|
|
|
96
104
|
## `apiKeyDictionary`
|
|
97
105
|
|
|
98
|
-
Adapters that call an API requiring credentials (`googlebooks` today; `requiresApiKey: true` in the standard's `externalApis[]` entry) read from a package-local singleton rather than
|
|
106
|
+
Adapters that call an API requiring credentials (`googlebooks` today; `requiresApiKey: true` in the standard's `externalApis[]` entry) read the key from a package-local singleton rather than taking it as an argument:
|
|
99
107
|
|
|
100
108
|
```typescript
|
|
101
109
|
import { apiKeyDictionary } from '@the_library/standard-adapters';
|
|
@@ -105,20 +113,20 @@ apiKeyDictionary.set('googlebooks', import.meta.env.VITE_GOOGLE_BOOKS_API_KEY);
|
|
|
105
113
|
|
|
106
114
|
- `set(apiId, value)` — throws if `value` is empty.
|
|
107
115
|
- `get(apiId)` — returns `undefined` if unset.
|
|
108
|
-
- `require(apiId)` — used
|
|
116
|
+
- `require(apiId)` — used by the adapters; throws immediately, naming the missing key, if it isn't configured. Fail fast at configuration time, not mid-request.
|
|
109
117
|
|
|
110
|
-
This singleton, and all network calls, live entirely in this package. `canonical-schemas` has no
|
|
118
|
+
This singleton, and all network calls, live entirely in this package. `canonical-schemas` has no runtime code and no dependency on `fetch`.
|
|
111
119
|
|
|
112
120
|
---
|
|
113
121
|
|
|
114
122
|
## Standards implemented
|
|
115
123
|
|
|
116
|
-
| Adapter | Standard ID | External APIs | Check digit |
|
|
124
|
+
| Adapter | Standard ID | External APIs (`apis` keys) | Check digit |
|
|
117
125
|
|---|---|---|---|
|
|
118
|
-
| `ISBNAdapter` | `isbn` |
|
|
119
|
-
| `ISSNAdapter` | `issn` |
|
|
120
|
-
| `ISNIAdapter` | `isni` |
|
|
121
|
-
| `ORCIDAdapter` | `orcid` |
|
|
126
|
+
| `ISBNAdapter` | `isbn` | `openlibrary`, `googlebooks` (API key) | `isbn-13-luhn` |
|
|
127
|
+
| `ISSNAdapter` | `issn` | `issn-portal` | `iso7064-mod11-2` |
|
|
128
|
+
| `ISNIAdapter` | `isni` | `isni-sru` (search) | `iso7064-mod11-2` |
|
|
129
|
+
| `ORCIDAdapter` | `orcid` | `orcid-lookup`, `orcid-public-api` (search) | `iso7064-mod11-2` |
|
|
122
130
|
| `DDCAdapter` | `ddc` | — | — |
|
|
123
131
|
| `LCCAdapter` | `lcc` | — | — |
|
|
124
132
|
| `UDCAdapter` | `udc` | — | — |
|
|
@@ -127,7 +135,7 @@ This singleton, and all network calls, live entirely in this package. `canonical
|
|
|
127
135
|
| `TLCAdapter` | `tlc` | — | — |
|
|
128
136
|
| `CCAdapter` | `cc` | — | — |
|
|
129
137
|
|
|
130
|
-
|
|
138
|
+
Governance metadata for each standard (governing body, ISO reference, revision cycle, field mappings) lives in the matching `standards/<id>.json` file of `canonical-schemas`, not here: this package implements behaviour, it doesn't restate governance facts.
|
|
131
139
|
|
|
132
140
|
---
|
|
133
141
|
|
|
@@ -137,23 +145,23 @@ Full governance metadata (governing body, ISO reference, revision cycle, field m
|
|
|
137
145
|
@the_library/standard-adapters
|
|
138
146
|
│
|
|
139
147
|
▼
|
|
140
|
-
|
|
141
|
-
│
|
|
142
|
-
│
|
|
143
|
-
│
|
|
148
|
+
@the_library/public — the generated model classes (Book, Person, Tag, …)
|
|
149
|
+
│ import adapters by subpath, e.g. "@the_library/standard-adapters/isbn"
|
|
150
|
+
│ generate a validate<Standard>() method per standard a model uses,
|
|
151
|
+
│ and use the adapters' normalize() when building a record's sfcuid()
|
|
144
152
|
▼
|
|
145
|
-
|
|
153
|
+
the World Library apps
|
|
146
154
|
```
|
|
147
155
|
|
|
148
|
-
The
|
|
156
|
+
The model generator in `@the_library/public` reads each canonical model's `uidStrategy` / `instanceUidStrategy` and imports the matching adapter through its **subpath export**. The adapters' `apis` lookups are not wired into the generated classes: call them directly.
|
|
149
157
|
|
|
150
|
-
|
|
158
|
+
Import by subpath (`@the_library/standard-adapters/ddc`) rather than the root barrel, so bundlers only pull in the adapters actually used.
|
|
151
159
|
|
|
152
160
|
---
|
|
153
161
|
|
|
154
162
|
## Build
|
|
155
163
|
|
|
156
|
-
`tsup.config.ts` declares one entry point per adapter plus the root barrel, producing per-adapter ESM output and matching `.d.ts` files. `package.json`'s `exports` map exposes each as a subpath (`./isbn`, `./issn`, `./isni`, `./orcid`, `./ddc`, `./lcc`, `./udc`, `./clc`, `./bbk`, `./tlc`, `./cc`) so a consumer that only needs `DDCAdapter` doesn't bundle the `fetch`-calling identifier adapters.
|
|
164
|
+
`tsup.config.ts` declares one entry point per adapter plus the root barrel, producing per-adapter ESM output and matching `.d.ts` files. `package.json`'s `exports` map exposes each as a subpath (`./isbn`, `./issn`, `./isni`, `./orcid`, `./ddc`, `./lcc`, `./udc`, `./clc`, `./bbk`, `./tlc`, `./cc`), so a consumer that only needs `DDCAdapter` doesn't bundle the `fetch`-calling identifier adapters.
|
|
157
165
|
|
|
158
166
|
```sh
|
|
159
167
|
pnpm run build # tsup — builds dist/, one output per adapter
|
|
@@ -165,21 +173,21 @@ pnpm run build # tsup — builds dist/, one output per adapter
|
|
|
165
173
|
|
|
166
174
|
```sh
|
|
167
175
|
pnpm test # vitest run — normalize/validate/toLinkedDataUri, no network
|
|
168
|
-
pnpm run test:integration # INTEGRATION=true vitest run — also
|
|
176
|
+
pnpm run test:integration # INTEGRATION=true vitest run — also calls the live external APIs
|
|
169
177
|
```
|
|
170
178
|
|
|
171
|
-
|
|
179
|
+
Live-API assertions are gated behind `describe.skipIf(!process.env.INTEGRATION)`, so ordinary `pnpm test` runs are fast, deterministic and offline; check-digit and normalization logic is covered without any network dependency.
|
|
172
180
|
|
|
173
181
|
---
|
|
174
182
|
|
|
175
183
|
## Adding a new standard
|
|
176
184
|
|
|
177
|
-
A new standard always
|
|
185
|
+
A new standard always needs **two coordinated pull requests**, reviewed and merged together per governance policy (enforced by review, not by the build — see the note above):
|
|
178
186
|
|
|
179
187
|
1. **`canonical-schemas`** — add `standards/<id>.json` (`StandardDefinition`), including `externalApis[]` if applicable.
|
|
180
|
-
2. **`standard-adapters`** (this package) — add `src/<id>/index.ts` implementing `StandardAdapter`,
|
|
188
|
+
2. **`standard-adapters`** (this package) — add `src/<id>/index.ts` implementing `StandardAdapter`, with `apis` keys matching the JSON's `externalApis[].id` entries 1:1; add the entry point to `tsup.config.ts` and the subpath to `package.json#exports`; export it from `src/index.ts`.
|
|
181
189
|
|
|
182
|
-
|
|
190
|
+
A new standard is a coordinated **minor** version bump of both packages (see [`GOVERNANCE.md`](https://unpkg.com/@the_library/canonical-schemas/governance/GOVERNANCE.md)).
|
|
183
191
|
|
|
184
192
|
---
|
|
185
193
|
|
|
@@ -187,6 +195,6 @@ See [`canonical-schemas/governance/GOVERNANCE.md`](../canonical-schemas/governan
|
|
|
187
195
|
|
|
188
196
|
| Package | Role |
|
|
189
197
|
|---|---|
|
|
190
|
-
| [`@the_library/canonical-schemas`](
|
|
191
|
-
| [
|
|
192
|
-
|
|
|
198
|
+
| [`@the_library/canonical-schemas`](https://www.npmjs.com/package/@the_library/canonical-schemas) | The standard definitions (JSON) and the `StandardAdapter` / `StandardDefinition` interfaces this package implements |
|
|
199
|
+
| [`@the_library/public`](https://www.npmjs.com/package/@the_library/public) | The SDK; its generated model classes use these adapters |
|
|
200
|
+
| `@the_library/db_schemas` | Build-time compiler (part of the monorepo, not published); enforces `uidStrategy` standard existence, `uriScheme` and prop collisions, but does not cross-check `apis` keys against `externalApis[]` |
|
package/dist/bbk/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
BBKAdapter
|
|
8
|
+
} from "../chunk-5RNEFYG4.js";
|
|
9
|
+
export {
|
|
10
|
+
BBKAdapter
|
|
11
|
+
};
|
|
3
12
|
//# sourceMappingURL=index.js.map
|
package/dist/bbk/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/cc/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
CCAdapter
|
|
8
|
+
} from "../chunk-OMNF76QQ.js";
|
|
9
|
+
export {
|
|
10
|
+
CCAdapter
|
|
11
|
+
};
|
|
3
12
|
//# sourceMappingURL=index.js.map
|
package/dist/cc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/bbk/index.ts
|
|
2
8
|
var BBKAdapter = {
|
|
3
9
|
standardId: "bbk",
|
|
@@ -21,6 +27,7 @@ var BBKAdapter = {
|
|
|
21
27
|
apis: {}
|
|
22
28
|
};
|
|
23
29
|
|
|
24
|
-
export {
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
export {
|
|
31
|
+
BBKAdapter
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-5RNEFYG4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bbk/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\n\ninterface BBKProps extends Record<string, string | null> { bbkNotation: string | null; }\n\ntype BBKApis = Record<string, never>;\n\nexport const BBKAdapter: StandardAdapter<BBKProps, BBKApis> = {\n standardId: 'bbk',\n uriScheme: 'BBK',\n\n normalize(value: string): string {\n return value.trim();\n },\n\n display(value: string): string {\n return BBKAdapter.normalize(value);\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'BBK notation is absent' };\n const normalized = BBKAdapter.normalize(value);\n if (!/^[0-9А-Яа-яA-Za-z\\.\\-\\s]+$/.test(normalized))\n return { valid: false, error: `BBK notation does not match pattern: ${normalized}` };\n return { valid: true };\n },\n\n toLinkedDataUri(value: string): string {\n return `https://bbk.rsl.ru/external/${BBKAdapter.normalize(value)}`;\n },\n\n apis: {},\n};\n"],"mappings":";;;;;;;AAaO,IAAM,aAAiD;AAAA,EAC5D,YAAY;AAAA,EACZ,WAAY;AAAA,EAEZ,UAAU,OAAuB;AAC/B,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA,EAEA,QAAQ,OAAuB;AAC7B,WAAO,WAAW,UAAU,KAAK;AAAA,EACnC;AAAA,EAEA,SAAS,OAAoD;AAC3D,QAAI,CAAC,MAAO,QAAO,EAAE,OAAO,OAAO,OAAO,yBAAyB;AACnE,UAAM,aAAa,WAAW,UAAU,KAAK;AAC7C,QAAI,CAAC,6BAA6B,KAAK,UAAU;AAC/C,aAAO,EAAE,OAAO,OAAO,OAAO,wCAAwC,UAAU,GAAG;AACrF,WAAO,EAAE,OAAO,KAAK;AAAA,EACvB;AAAA,EAEA,gBAAgB,OAAuB;AACrC,WAAO,+BAA+B,WAAW,UAAU,KAAK,CAAC;AAAA,EACnE;AAAA,EAEA,MAAM,CAAC;AACT;","names":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/lcc/index.ts
|
|
2
8
|
var LCCAdapter = {
|
|
3
9
|
standardId: "lcc",
|
|
@@ -21,6 +27,7 @@ var LCCAdapter = {
|
|
|
21
27
|
apis: {}
|
|
22
28
|
};
|
|
23
29
|
|
|
24
|
-
export {
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
export {
|
|
31
|
+
LCCAdapter
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-5W3ZWMUQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lcc/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\n\ninterface LCCProps extends Record<string, string | null> { lccNotation: string | null; }\n\ntype LCCApis = Record<string, never>;\n\nexport const LCCAdapter: StandardAdapter<LCCProps, LCCApis> = {\n standardId: 'lcc',\n uriScheme: 'LCC',\n\n normalize(value: string): string {\n return value.trim();\n },\n\n display(value: string): string {\n return LCCAdapter.normalize(value);\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'LCC notation is absent' };\n const normalized = LCCAdapter.normalize(value);\n if (!/^[A-Z0-9\\.\\s]+$/.test(normalized))\n return { valid: false, error: `LCC notation does not match pattern: ${normalized}` };\n return { valid: true };\n },\n\n toLinkedDataUri(value: string): string {\n return `https://id.loc.gov/authorities/classification/${LCCAdapter.normalize(value)}`;\n },\n\n apis: {},\n};\n"],"mappings":";;;;;;;AAaO,IAAM,aAAiD;AAAA,EAC5D,YAAY;AAAA,EACZ,WAAY;AAAA,EAEZ,UAAU,OAAuB;AAC/B,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA,EAEA,QAAQ,OAAuB;AAC7B,WAAO,WAAW,UAAU,KAAK;AAAA,EACnC;AAAA,EAEA,SAAS,OAAoD;AAC3D,QAAI,CAAC,MAAO,QAAO,EAAE,OAAO,OAAO,OAAO,yBAAyB;AACnE,UAAM,aAAa,WAAW,UAAU,KAAK;AAC7C,QAAI,CAAC,kBAAkB,KAAK,UAAU;AACpC,aAAO,EAAE,OAAO,OAAO,OAAO,wCAAwC,UAAU,GAAG;AACrF,WAAO,EAAE,OAAO,KAAK;AAAA,EACvB;AAAA,EAEA,gBAAgB,OAAuB;AACrC,WAAO,iDAAiD,WAAW,UAAU,KAAK,CAAC;AAAA,EACrF;AAAA,EAEA,MAAM,CAAC;AACT;","names":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/tlc/index.ts
|
|
2
8
|
var TLCAdapter = {
|
|
3
9
|
standardId: "tlc",
|
|
@@ -21,6 +27,7 @@ var TLCAdapter = {
|
|
|
21
27
|
apis: {}
|
|
22
28
|
};
|
|
23
29
|
|
|
24
|
-
export {
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
export {
|
|
31
|
+
TLCAdapter
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-ADV2G3VE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tlc/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\n\ninterface TLCProps extends Record<string, string | null> { tlcNotation: string | null; }\n\ntype TLCApis = Record<string, never>;\n\nexport const TLCAdapter: StandardAdapter<TLCProps, TLCApis> = {\n standardId: 'tlc',\n uriScheme: 'TLC',\n\n normalize(value: string): string {\n return value.trim();\n },\n\n display(value: string): string {\n return TLCAdapter.normalize(value);\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'TLC notation is absent' };\n const normalized = TLCAdapter.normalize(value);\n if (!/^[A-Z0-9\\.\\-\\s]+$/.test(normalized))\n return { valid: false, error: `TLC notation does not match pattern: ${normalized}` };\n return { valid: true };\n },\n\n toLinkedDataUri(value: string): string {\n return `https://nlt.go.th/tlc/${TLCAdapter.normalize(value)}`;\n },\n\n apis: {},\n};\n"],"mappings":";;;;;;;AAaO,IAAM,aAAiD;AAAA,EAC5D,YAAY;AAAA,EACZ,WAAY;AAAA,EAEZ,UAAU,OAAuB;AAC/B,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA,EAEA,QAAQ,OAAuB;AAC7B,WAAO,WAAW,UAAU,KAAK;AAAA,EACnC;AAAA,EAEA,SAAS,OAAoD;AAC3D,QAAI,CAAC,MAAO,QAAO,EAAE,OAAO,OAAO,OAAO,yBAAyB;AACnE,UAAM,aAAa,WAAW,UAAU,KAAK;AAC7C,QAAI,CAAC,oBAAoB,KAAK,UAAU;AACtC,aAAO,EAAE,OAAO,OAAO,OAAO,wCAAwC,UAAU,GAAG;AACrF,WAAO,EAAE,OAAO,KAAK;AAAA,EACvB;AAAA,EAEA,gBAAgB,OAAuB;AACrC,WAAO,yBAAyB,WAAW,UAAU,KAAK,CAAC;AAAA,EAC7D;AAAA,EAEA,MAAM,CAAC;AACT;","names":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/orcid/index.ts
|
|
2
8
|
function validateORCIDMod11_2(compact) {
|
|
3
9
|
if (compact.length !== 16) return { valid: false, error: `Expected 16 chars, got ${compact.length}` };
|
|
@@ -77,6 +83,7 @@ var ORCIDAdapter = {
|
|
|
77
83
|
}
|
|
78
84
|
};
|
|
79
85
|
|
|
80
|
-
export {
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
export {
|
|
87
|
+
ORCIDAdapter
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=chunk-B3OKVAXL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/orcid/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, StandardApiAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\nimport type { OrcidPublicRecordResult, OrcidPublicSearchResult } from './types';\n\ninterface ORCIDProps extends Record<string, string | null> { orcidId: string | null; }\n\ntype ORCIDApis = {\n 'orcid-lookup': StandardApiAdapter<ORCIDProps, OrcidPublicRecordResult>;\n 'orcid-public-api': StandardApiAdapter<ORCIDProps, OrcidPublicSearchResult[]>;\n};\n\nfunction validateORCIDMod11_2(compact: string): ValidationResult {\n if (compact.length !== 16) return { valid: false, error: `Expected 16 chars, got ${compact.length}` };\n let p = 0;\n for (let i = 0; i < 15; i++) {\n const d = parseInt(compact[i], 10);\n if (isNaN(d)) return { valid: false, error: `Non-digit at position ${i}` };\n p = ((p + d) * 2) % 11;\n }\n const checkVal = (12 - p) % 11;\n const checkChar = checkVal === 10 ? 'X' : String(checkVal);\n if (compact[15].toUpperCase() !== checkChar)\n return { valid: false, error: `Check digit mismatch: expected ${checkChar}, got ${compact[15]}` };\n return { valid: true };\n}\n\nconst ORCID_API_BASE = 'https://pub.orcid.org/v3.0';\nconst ORCID_HEADERS = { Accept: 'application/vnd.orcid+json' };\n\nexport const ORCIDAdapter: StandardAdapter<ORCIDProps, ORCIDApis> = {\n standardId: 'orcid',\n uriScheme: 'ORCID',\n\n normalize(value: string): string {\n const clean = value.replace(/\\s/g, '');\n if (clean.length === 16 && !clean.includes('-'))\n return `${clean.slice(0, 4)}-${clean.slice(4, 8)}-${clean.slice(8, 12)}-${clean.slice(12)}`;\n return clean;\n },\n\n display(value: string): string {\n return ORCIDAdapter.normalize(value);\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'ORCID iD is absent' };\n const normalized = ORCIDAdapter.normalize(value);\n if (!/^[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]$/.test(normalized))\n return { valid: false, error: `ORCID iD does not match pattern: ${normalized}` };\n return validateORCIDMod11_2(normalized.replace(/-/g, ''));\n },\n\n toLinkedDataUri(value: string): string {\n return `https://orcid.org/${ORCIDAdapter.normalize(value)}`;\n },\n\n apis: {\n 'orcid-lookup': {\n apiId: 'orcid-lookup',\n name: 'ORCID Public Record API',\n async fetch({ orcidId }): Promise<OrcidPublicRecordResult> {\n if (!orcidId) return {};\n const res = await fetch(`${ORCID_API_BASE}/${orcidId}/record`, { headers: ORCID_HEADERS });\n if (!res.ok) return {};\n const data = await res.json() as Record<string, unknown>;\n const person = (data.person ?? {}) as Record<string, unknown>;\n const name = (person.name ?? {}) as Record<string, unknown>;\n return {\n orcidId,\n givenNames: (name['given-names'] as { value?: string } | undefined)?.value,\n familyName: (name['family-name'] as { value?: string } | undefined)?.value,\n biography: (person.biography as { content?: string } | undefined)?.content ?? undefined,\n };\n },\n },\n 'orcid-public-api': {\n apiId: 'orcid-public-api',\n name: 'ORCID Public Search API',\n async fetch({ orcidId }): Promise<OrcidPublicSearchResult[]> {\n if (!orcidId) return [];\n const res = await fetch(\n `${ORCID_API_BASE}/search?q=orcid:${orcidId}&rows=10`,\n { headers: ORCID_HEADERS }\n );\n if (!res.ok) return [];\n const data = await res.json() as { result?: unknown[] };\n return (data.result ?? [])\n .map((r: unknown) => {\n const item = r as Record<string, unknown>;\n const oid = (item['orcid-identifier'] as Record<string, unknown> | undefined)?.path as string;\n return { orcidId: oid ?? '' };\n })\n .filter(r => r.orcidId);\n },\n },\n },\n};\n"],"mappings":";;;;;;;AAiBA,SAAS,qBAAqB,SAAmC;AAC/D,MAAI,QAAQ,WAAW,GAAI,QAAO,EAAE,OAAO,OAAO,OAAO,0BAA0B,QAAQ,MAAM,GAAG;AACp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@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/api-keys.ts
|
|
2
8
|
var _keys = /* @__PURE__ */ new Map();
|
|
3
9
|
var apiKeyDictionary = {
|
|
@@ -103,6 +109,8 @@ var ISBNAdapter = {
|
|
|
103
109
|
}
|
|
104
110
|
};
|
|
105
111
|
|
|
106
|
-
export {
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
export {
|
|
113
|
+
apiKeyDictionary,
|
|
114
|
+
ISBNAdapter
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=chunk-BJQSNRJI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api-keys.ts","../src/isbn/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nexport interface ApiKeyDictionary {\n set(apiId: string, value: string): void;\n get(apiId: string): string | undefined;\n require(apiId: string): string;\n}\n\nconst _keys = new Map<string, string>();\n\nexport const apiKeyDictionary: ApiKeyDictionary = {\n set(apiId: string, value: string): void {\n if (!value) throw new Error(`[apiKeyDictionary] Empty value passed for apiId \"${apiId}\".`);\n _keys.set(apiId, value);\n },\n\n get(apiId: string): string | undefined {\n return _keys.get(apiId);\n },\n\n require(apiId: string): string {\n const key = _keys.get(apiId);\n if (!key) throw new Error(\n `[${apiId}] API key is not configured. ` +\n `Call apiKeyDictionary.set(\"${apiId}\", \"<your-key>\") before using this adapter.`\n );\n return key;\n },\n};\n","/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, StandardApiAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\nimport { apiKeyDictionary } from '../api-keys';\nimport type { OpenLibraryBookResult, GoogleBooksVolumeResult } from './types';\n\ninterface ISBNProps extends Record<string, string | null> { isbn: string | null; }\n\ntype ISBNApis = {\n openlibrary: StandardApiAdapter<ISBNProps, OpenLibraryBookResult>;\n googlebooks: StandardApiAdapter<ISBNProps, GoogleBooksVolumeResult>;\n};\n\nfunction validateISBN13Luhn(isbn13: string): ValidationResult {\n if (isbn13.length !== 13) return { valid: false, error: `Expected 13 digits, got ${isbn13.length}` };\n let sum = 0;\n for (let i = 0; i < 12; i++) sum += parseInt(isbn13[i], 10) * (i % 2 === 0 ? 1 : 3);\n const expected = (10 - (sum % 10)) % 10;\n if (expected !== parseInt(isbn13[12], 10))\n return { valid: false, error: `Check digit mismatch: expected ${expected}, got ${isbn13[12]}` };\n return { valid: true };\n}\n\nexport const ISBNAdapter: StandardAdapter<ISBNProps, ISBNApis> = {\n standardId: 'isbn',\n uriScheme: 'ISBN',\n\n normalize(value: string): string {\n const digits = value.replace(/[\\s-]/g, '');\n if (digits.length === 10) {\n const base = '978' + digits.slice(0, 9);\n let sum = 0;\n for (let i = 0; i < 12; i++) sum += parseInt(base[i], 10) * (i % 2 === 0 ? 1 : 3);\n return base + (10 - (sum % 10)) % 10;\n }\n return digits;\n },\n\n display(value: string): string {\n const n = ISBNAdapter.normalize(value);\n if (n.length === 13) return `${n.slice(0, 3)}-${n[3]}-${n.slice(4, 7)}-${n.slice(7, 12)}-${n[12]}`;\n return n;\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'ISBN is absent' };\n const normalized = ISBNAdapter.normalize(value);\n if (!/^97[89][0-9]{10}$/.test(normalized))\n return { valid: false, error: `ISBN does not match pattern: ${normalized}` };\n return validateISBN13Luhn(normalized);\n },\n\n toLinkedDataUri(value: string): string {\n return `urn:isbn:${ISBNAdapter.normalize(value)}`;\n },\n\n apis: {\n openlibrary: {\n apiId: 'openlibrary',\n name: 'Open Library Books API',\n async fetch({ isbn }): Promise<OpenLibraryBookResult> {\n if (!isbn) return {};\n const res = await fetch(\n `https://openlibrary.org/api/books?bibkeys=ISBN:${isbn}&format=json&jscmd=data`\n );\n if (!res.ok) return {};\n const data = await res.json() as Record<string, unknown>;\n const book = (data[`ISBN:${isbn}`] ?? {}) as Record<string, unknown>;\n return {\n title: book.title as string | undefined,\n authors: (book.authors as { name: string }[] | undefined)?.map(a => a.name),\n publishDate: book.publish_date as string | undefined,\n pageCount: book.number_of_pages as number | undefined,\n coverUrl: (book.cover as { medium?: string } | undefined)?.medium,\n description: (book.excerpts as { text: string }[] | undefined)?.[0]?.text,\n };\n },\n },\n googlebooks: {\n apiId: 'googlebooks',\n name: 'Google Books API',\n async fetch({ isbn }): Promise<GoogleBooksVolumeResult> {\n if (!isbn) return {};\n const key = apiKeyDictionary.require('googlebooks');\n const res = await fetch(\n `https://www.googleapis.com/books/v1/volumes?q=isbn:${isbn}&key=${key}`\n );\n if (!res.ok) return {};\n const data = await res.json() as { items?: { volumeInfo: Record<string, unknown> }[] };\n const info = data.items?.[0]?.volumeInfo ?? {};\n return {\n title: info.title as string | undefined,\n authors: info.authors as string[] | undefined,\n publishedDate: info.publishedDate as string | undefined,\n pageCount: info.pageCount as number | undefined,\n language: info.language as string | undefined,\n description: info.description as string | undefined,\n thumbnail: (info.imageLinks as { thumbnail?: string } | und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AK,OAA2C;AAAA,UAC9D,aAAc,KAAK,WAA8C,CAAC,GAAG;AAAA,QACvE;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa;AAAA,MACX,OAAO;AAAA,MACP,MAAO;AAAA,MACP,MAAM,MAAM,EAAE,KAAK,GAAqC;AACtD,YAAI,CAAC,KAAM,QAAO,CAAC;AACnB,cAAM,MAAO,iBAAiB,QAAQ,aAAa;AACnD,cAAM,MAAO,MAAM;AAAA,UACjB,sDAAsD,IAAI,QAAQ,GAAG;AAAA,QACvE;AACA,YAAI,CAAC,IAAI,GAAI,QAAO,CAAC;AACrB,cAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,cAAM,OAAO,KAAK,QAAQ,CAAC,GAAG,cAAc,CAAC;AAC7C,eAAO;AAAA,UACL,OAAe,KAAK;AAAA,UACpB,SAAe,KAAK;AAAA,UACpB,eAAe,KAAK;AAAA,UACpB,WAAe,KAAK;AAAA,UACpB,UAAe,KAAK;AAAA,UACpB,aAAe,KAAK;AAAA,UACpB,WAAgB,KAAK,YAAmD;AAAA,QAC1E;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/ddc/index.ts
|
|
2
8
|
var DDCAdapter = {
|
|
3
9
|
standardId: "ddc",
|
|
@@ -23,6 +29,7 @@ var DDCAdapter = {
|
|
|
23
29
|
apis: {}
|
|
24
30
|
};
|
|
25
31
|
|
|
26
|
-
export {
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
export {
|
|
33
|
+
DDCAdapter
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-HQICVT3W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ddc/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\n\ninterface DDCProps extends Record<string, string | null> { ddcNotation: string | null; }\n\ntype DDCApis = Record<string, never>;\n\nexport const DDCAdapter: StandardAdapter<DDCProps, DDCApis> = {\n standardId: 'ddc',\n uriScheme: 'DDC',\n\n normalize(value: string): string {\n let trimmed = value.trim();\n if (trimmed.includes('.')) trimmed = trimmed.replace(/\\.?0+$/, '');\n return trimmed;\n },\n\n display(value: string): string {\n return DDCAdapter.normalize(value);\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'DDC notation is absent' };\n const normalized = DDCAdapter.normalize(value);\n if (!/^[0-9]{3}(\\.[0-9]+)?$/.test(normalized))\n return { valid: false, error: `DDC notation does not match pattern: ${normalized}` };\n return { valid: true };\n },\n\n toLinkedDataUri(value: string): string {\n return `https://id.loc.gov/authorities/classification/${DDCAdapter.normalize(value)}`;\n },\n\n apis: {},\n};\n"],"mappings":";;;;;;;AAaO,IAAM,aAAiD;AAAA,EAC5D,YAAY;AAAA,EACZ,WAAY;AAAA,EAEZ,UAAU,OAAuB;AAC/B,QAAI,UAAU,MAAM,KAAK;AACzB,QAAI,QAAQ,SAAS,GAAG,EAAG,WAAU,QAAQ,QAAQ,UAAU,EAAE;AACjE,WAAO;AAAA,EACT;AAAA,EAEA,QAAQ,OAAuB;AAC7B,WAAO,WAAW,UAAU,KAAK;AAAA,EACnC;AAAA,EAEA,SAAS,OAAoD;AAC3D,QAAI,CAAC,MAAO,QAAO,EAAE,OAAO,OAAO,OAAO,yBAAyB;AACnE,UAAM,aAAa,WAAW,UAAU,KAAK;AAC7C,QAAI,CAAC,wBAAwB,KAAK,UAAU;AAC1C,aAAO,EAAE,OAAO,OAAO,OAAO,wCAAwC,UAAU,GAAG;AACrF,WAAO,EAAE,OAAO,KAAK;AAAA,EACvB;AAAA,EAEA,gBAAgB,OAAuB;AACrC,WAAO,iDAAiD,WAAW,UAAU,KAAK,CAAC;AAAA,EACrF;AAAA,EAEA,MAAM,CAAC;AACT;","names":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/issn/index.ts
|
|
2
8
|
function validateISSNMod11_2(issn) {
|
|
3
9
|
const clean = issn.replace("-", "");
|
|
@@ -53,6 +59,7 @@ var ISSNAdapter = {
|
|
|
53
59
|
}
|
|
54
60
|
};
|
|
55
61
|
|
|
56
|
-
export {
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
export {
|
|
63
|
+
ISSNAdapter
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=chunk-HWMSPPAK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/issn/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, StandardApiAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\nimport type { IssnPortalResult } from './types';\n\ninterface ISSNProps extends Record<string, string | null> { issn: string | null; }\n\ntype ISSNApis = {\n 'issn-portal': StandardApiAdapter<ISSNProps, IssnPortalResult>;\n};\n\nfunction validateISSNMod11_2(issn: string): ValidationResult {\n const clean = issn.replace('-', '');\n if (clean.length !== 8) return { valid: false, error: `Expected 8 chars, got ${clean.length}` };\n const weights = [8, 7, 6, 5, 4, 3, 2];\n let sum = 0;\n for (let i = 0; i < 7; i++) sum += parseInt(clean[i], 10) * weights[i];\n const remainder = sum % 11;\n const checkVal = remainder === 0 ? 0 : 11 - remainder;\n const checkChar = checkVal === 10 ? 'X' : String(checkVal);\n if (clean[7].toUpperCase() !== checkChar)\n return { valid: false, error: `Check digit mismatch: expected ${checkChar}, got ${clean[7]}` };\n return { valid: true };\n}\n\nexport const ISSNAdapter: StandardAdapter<ISSNProps, ISSNApis> = {\n standardId: 'issn',\n uriScheme: 'ISSN',\n\n normalize(value: string): string {\n const digits = value.replace(/[\\s-]/g, '');\n if (digits.length === 8) return `${digits.slice(0, 4)}-${digits.slice(4)}`;\n return value.trim();\n },\n\n display(value: string): string {\n return ISSNAdapter.normalize(value);\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'ISSN is absent' };\n const normalized = ISSNAdapter.normalize(value);\n if (!/^[0-9]{4}-[0-9]{3}[0-9X]$/.test(normalized))\n return { valid: false, error: `ISSN does not match pattern: ${normalized}` };\n return validateISSNMod11_2(normalized);\n },\n\n toLinkedDataUri(value: string): string {\n return `https://portal.issn.org/resource/ISSN/${ISSNAdapter.normalize(value)}`;\n },\n\n apis: {\n 'issn-portal': {\n apiId: 'issn-portal',\n name: 'ISSN Portal',\n async fetch({ issn }): Promise<IssnPortalResult> {\n if (!issn) return {};\n const res = await fetch(`https://portal.issn.org/resource/ISSN/${issn}?format=json`);\n if (!res.ok) return {};\n const data = await res.json() as Record<string, unknown>;\n return {\n title: data['dc:title'] as string | undefined,\n medium: data['dc:format'] as string | undefined,\n country: data['dc:publisher'] as string | undefined,\n issn,\n };\n },\n },\n },\n};\n"],"mappings":";;;;;;;AAgBA,SAAS,oBAAoB,MAAgC;AAC3D,QAAM,QAAQ,KAAK,QAAQ,KAAK,EAAE;AAClC,MAAI,MAAM,WAAW,EAAG,QAAO,EAAE,OAAO,OAAO,OAAO,yBAAyB,MAAM,MAAM,GAAG;AAC9F,QAAM,UAAU,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACpC,MAAI,MAAM;AACV,WAAS,IAAI,GAAG,IAAI,GAAG,IAAK,QAAO,SAAS,MAAM,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;AACrE,QAAM,YAAY,MAAM;AACxB,QAAM,WAAY,cAAc,IAAI,IAAI,KAAK;AAC7C,QAAM,YAAY,aAAa,KAAK,MAAM,OAAO,QAAQ;AACzD,MAAI,MAAM,CAAC,EAAE,YAAY,MAAM;AAC7B,WAAO,EAAE,OAAO,OAAO,OAAO,kCAAkC,SAAS,SAAS,MAAM,CAAC,CAAC,GAAG;AAC/F,SAAO,EAAE,OAAO,KAAK;AACvB;AAEO,IAAM,cAAoD;AAAA,EAC/D,YAAY;AAAA,EACZ,WAAY;AAAA,EAEZ,UAAU,OAAuB;AAC/B,UAAM,SAAS,MAAM,QAAQ,UAAU,EAAE;AACzC,QAAI,OAAO,WAAW,EAAG,QAAO,GAAG,OAAO,MAAM,GAAG,CAAC,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC;AACxE,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA,EAEA,QAAQ,OAAuB;AAC7B,WAAO,YAAY,UAAU,KAAK;AAAA,EACpC;AAAA,EAEA,SAAS,OAAoD;AAC3D,QAAI,CAAC,MAAO,QAAO,EAAE,OAAO,OAAO,OAAO,iBAAiB;AAC3D,UAAM,aAAa,YAAY,UAAU,KAAK;AAC9C,QAAI,CAAC,4BAA4B,KAAK,UAAU;AAC9C,aAAO,EAAE,OAAO,OAAO,OAAO,gCAAgC,UAAU,GAAG;AAC7E,WAAO,oBAAoB,UAAU;AAAA,EACvC;AAAA,EAEA,gBAAgB,OAAuB;AACrC,WAAO,yCAAyC,YAAY,UAAU,KAAK,CAAC;AAAA,EAC9E;AAAA,EAEA,MAAM;AAAA,IACJ,eAAe;AAAA,MACb,OAAO;AAAA,MACP,MAAO;AAAA,MACP,MAAM,MAAM,EAAE,KAAK,GAA8B;AAC/C,YAAI,CAAC,KAAM,QAAO,CAAC;AACnB,cAAM,MAAM,MAAM,MAAM,yCAAyC,IAAI,cAAc;AACnF,YAAI,CAAC,IAAI,GAAI,QAAO,CAAC;AACrB,cAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,eAAO;AAAA,UACL,OAAS,KAAK,UAAU;AAAA,UACxB,QAAS,KAAK,WAAW;AAAA,UACzB,SAAS,KAAK,cAAc;AAAA,UAC5B;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/cc/index.ts
|
|
2
8
|
var CCAdapter = {
|
|
3
9
|
standardId: "cc",
|
|
@@ -21,6 +27,7 @@ var CCAdapter = {
|
|
|
21
27
|
apis: {}
|
|
22
28
|
};
|
|
23
29
|
|
|
24
|
-
export {
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
export {
|
|
31
|
+
CCAdapter
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-OMNF76QQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cc/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\n\ninterface CCProps extends Record<string, string | null> { ccNotation: string | null; }\n\ntype CCApis = Record<string, never>;\n\nexport const CCAdapter: StandardAdapter<CCProps, CCApis> = {\n standardId: 'cc',\n uriScheme: 'CC',\n\n normalize(value: string): string {\n return value.trim();\n },\n\n display(value: string): string {\n return CCAdapter.normalize(value);\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'CC notation is absent' };\n const normalized = CCAdapter.normalize(value);\n if (!/^[A-Za-z0-9\\:\\,\\;\\-\\.\\'\\s]+$/.test(normalized))\n return { valid: false, error: `CC notation does not match pattern: ${normalized}` };\n return { valid: true };\n },\n\n toLinkedDataUri(value: string): string {\n return `https://isko.org/cc/${CCAdapter.normalize(value)}`;\n },\n\n apis: {},\n};\n"],"mappings":";;;;;;;AAaO,IAAM,YAA8C;AAAA,EACzD,YAAY;AAAA,EACZ,WAAY;AAAA,EAEZ,UAAU,OAAuB;AAC/B,WAAO,MAAM,KAAK;AAAA,EACpB;AAAA,EAEA,QAAQ,OAAuB;AAC7B,WAAO,UAAU,UAAU,KAAK;AAAA,EAClC;AAAA,EAEA,SAAS,OAAoD;AAC3D,QAAI,CAAC,MAAO,QAAO,EAAE,OAAO,OAAO,OAAO,wBAAwB;AAClE,UAAM,aAAa,UAAU,UAAU,KAAK;AAC5C,QAAI,CAAC,+BAA+B,KAAK,UAAU;AACjD,aAAO,EAAE,OAAO,OAAO,OAAO,uCAAuC,UAAU,GAAG;AACpF,WAAO,EAAE,OAAO,KAAK;AAAA,EACvB;AAAA,EAEA,gBAAgB,OAAuB;AACrC,WAAO,uBAAuB,UAAU,UAAU,KAAK,CAAC;AAAA,EAC1D;AAAA,EAEA,MAAM,CAAC;AACT;","names":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1
|
|
3
|
+
Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).
|
|
4
|
+
Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
// src/isni/index.ts
|
|
2
8
|
function validateISNIMod11_2(compact) {
|
|
3
9
|
if (compact.length !== 16) return { valid: false, error: `Expected 16 chars, got ${compact.length}` };
|
|
@@ -60,6 +66,7 @@ var ISNIAdapter = {
|
|
|
60
66
|
}
|
|
61
67
|
};
|
|
62
68
|
|
|
63
|
-
export {
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
export {
|
|
70
|
+
ISNIAdapter
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=chunk-Q72TUYFB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isni/index.ts"],"sourcesContent":["/*\n * D-Open Code Sovereign Licence 1.1 · © 2026 Antoine LUCAS · SPDX-License-Identifier: LicenseRef-DOCSL-1.1\n * Non-commercial use of unmodified copies only. By using this file you accept the Licence, incl. USD 50M liquidated damages (s 16.4).\n * Full text: https://registry.worldbibliotech.com/licence and the LICENSE file · Contact: admin@pondenterprise.com\n */\n\nimport type { StandardAdapter, StandardApiAdapter, ValidationResult }\n from '@the_library/canonical-schemas/types/StandardAdapter';\nimport type { IsniSruResult } from './types';\n\ninterface ISNIProps extends Record<string, string | null> { isniId: string | null; }\n\ntype ISNIApis = {\n 'isni-sru': StandardApiAdapter<ISNIProps, IsniSruResult[]>;\n};\n\nfunction validateISNIMod11_2(compact: string): ValidationResult {\n if (compact.length !== 16) return { valid: false, error: `Expected 16 chars, got ${compact.length}` };\n let p = 0;\n for (let i = 0; i < 15; i++) {\n const d = parseInt(compact[i], 10);\n if (isNaN(d)) return { valid: false, error: `Non-digit character at position ${i}` };\n p = ((p + d) * 2) % 11;\n }\n const checkVal = (12 - p) % 11;\n const checkChar = checkVal === 10 ? 'X' : String(checkVal);\n if (compact[15].toUpperCase() !== checkChar)\n return { valid: false, error: `Check digit mismatch: expected ${checkChar}, got ${compact[15]}` };\n return { valid: true };\n}\n\nexport const ISNIAdapter: StandardAdapter<ISNIProps, ISNIApis> = {\n standardId: 'isni',\n uriScheme: 'ISNI',\n\n normalize(value: string): string {\n return value.replace(/[\\s-]/g, '');\n },\n\n display(value: string): string {\n const compact = ISNIAdapter.normalize(value);\n if (compact.length === 16)\n return `${compact.slice(0, 4)} ${compact.slice(4, 8)} ${compact.slice(8, 12)} ${compact.slice(12)}`;\n return compact;\n },\n\n validate(value: string | null | undefined): ValidationResult {\n if (!value) return { valid: false, error: 'ISNI is absent' };\n const compact = ISNIAdapter.normalize(value);\n if (!/^[0-9]{15}[0-9X]$/.test(compact))\n return { valid: false, error: `ISNI does not match pattern: ${compact}` };\n return validateISNIMod11_2(compact);\n },\n\n toLinkedDataUri(value: string): string {\n return `https://isni.org/isni/${ISNIAdapter.normalize(value)}`;\n },\n\n apis: {\n 'isni-sru': {\n apiId: 'isni-sru',\n name: 'ISNI SRU API',\n async fetch({ isniId }): Promise<IsniSruResult[]> {\n if (!isniId) return [];\n const query = `pica.isn%3D${encodeURIComponent(isniId)}`;\n const url = `https://isni.oclc.org/sru/DB=1.2/?operation=searchRetrieve&query=${query}&recordSchema=isni-b&maximumRecords=10`;\n const res = await fetch(url, { headers: { Accept: 'application/xml' } });\n if (!res.ok) return [];\n const text = await res.text();\n const isniMatch = text.match(/<isniUnformatted>([0-9X]+)<\\/isniUnformatted>/);\n const forenameMatch = text.match(/<forename>([^<]+)<\\/forename>/);\n const surnameMatch = text.match(/<surname>([^<]+)<\\/surname>/);\n if (!isniMatch) return [];\n return [{\n isni: isniMatch[1],\n forename: forenameMatch?.[1],\n surname: surnameMatch?.[1],\n }];\n },\n },\n },\n};\n"],"mappings":";;;;;;;AAgBA,SAAS,oBAAoB,SAAmC;AAC9D,MAAI,QAAQ,WAAW,GAAI,QAAO,EAAE,OAAO,OAAO,OAAO,0BAA0B,QAAQ,MAAM,GAAG;AACpG,MAAI,IAAI;AACR,WAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AAC3B,UAAM,IAAI,SAAS,QAAQ,CAAC,GAAG,EAAE;AACjC,QAAI,MAAM,CAAC,EAAG,QAAO,EAAE,OAAO,OAAO,OAAO,mCAAmC,CAAC,GAAG;AACnF,SAAM,IAAI,KAAK,IAAK;AAAA,EACtB;AACA,QAAM,YAAa,KAAK,KAAK;AAC7B,QAAM,YAAY,aAAa,KAAK,MAAM,OAAO,QAAQ;AACzD,MAAI,QAAQ,EAAE,EAAE,YAAY,MAAM;AAChC,WAAO,EAAE,OAAO,OAAO,OAAO,kCAAkC,SAAS,SAAS,QAAQ,EAAE,CAAC,GAAG;AAClG,SAAO,EAAE,OAAO,KAAK;AACvB;AAEO,IAAM,cAAoD;AAAA,EAC/D,YAAY;AAAA,EACZ,WAAY;AAAA,EAEZ,UAAU,OAAuB;AAC/B,WAAO,MAAM,QAAQ,UAAU,EAAE;AAAA,EACnC;AAAA,EAEA,QAAQ,OAAuB;AAC7B,UAAM,UAAU,YAAY,UAAU,KAAK;AAC3C,QAAI,QAAQ,WAAW;AACrB,aAAO,GAAG,QAAQ,MAAM,GAAG,CAAC,CAAC,IAAI,QAAQ,M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