@biblioteksentralen/bmdb-search 0.0.0-beta.3 → 0.0.0-beta.5
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/README.md +30 -49
- package/dist/index.cjs +2 -6
- package/dist/index.d.cts +141 -102
- package/dist/index.d.ts +141 -102
- package/dist/index.js +2 -4
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
# @biblioteksentralen/bmdb-search
|
|
2
2
|
|
|
3
|
-
TypeScript client for searching Bibliotekenes metadatabrønn (BMDB).
|
|
3
|
+
TypeScript client for searching Bibliotekenes metadatabrønn (BMDB) using [openapi-fetch](https://openapi-ts.dev/openapi-fetch/).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Options
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Client identification policy
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The API does not require authentication, but clients should identify themselves using a descriptive
|
|
10
|
+
name and a contact address in the `clientIdentifier` string. We will only contact you about usage of the API.
|
|
11
|
+
|
|
12
|
+
## Usage examples
|
|
13
|
+
|
|
14
|
+
### Search works
|
|
10
15
|
|
|
11
16
|
```typescript
|
|
12
|
-
import {
|
|
17
|
+
import { createBmdbFetchClient } from "@biblioteksentralen/bmdb-search";
|
|
13
18
|
|
|
14
|
-
const bmdbSearchClient =
|
|
15
|
-
|
|
16
|
-
baseUrl: "https://search.data.bs.no",
|
|
17
|
-
});
|
|
19
|
+
const bmdbSearchClient = createBmdbFetchClient({ clientIdentifier: "client-unique-description" });
|
|
20
|
+
const { data, error } = await bmdbSearchClient.GET("/works/search", { params: { query: { query: "test" } } });
|
|
18
21
|
```
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
The arguments and response are fully typed.
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
### Usage with tanstack-query, openapi-react-query and next.js
|
|
26
|
+
|
|
27
|
+
Using [tanstack](https://tanstack.com/query/latest) for fetching with state management and [openapi-react-query](https://openapi-ts.dev/openapi-react-query/) for typing.
|
|
28
|
+
|
|
29
|
+
Add a rewrite in the next.js config file to be able to use the frontend host without violating the content service policy:
|
|
23
30
|
|
|
24
31
|
```typescript
|
|
25
32
|
// next.config.js or similar
|
|
@@ -36,14 +43,9 @@ const config = {
|
|
|
36
43
|
];
|
|
37
44
|
},
|
|
38
45
|
};
|
|
39
|
-
|
|
40
|
-
// File utilizing search client
|
|
41
|
-
import { createBmdbSearchClient } from "@biblioteksentralen/bmdb-search";
|
|
42
|
-
|
|
43
|
-
const bmdbSearchClient = createBmdbSearchClient({ clientIdentifier: "client-unique-description" });
|
|
44
46
|
```
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
If necessary, skip in middleware to exempt the API paths from internationalization etc:
|
|
47
49
|
|
|
48
50
|
```typescript
|
|
49
51
|
// middleware.ts
|
|
@@ -55,41 +57,20 @@ export const config = {
|
|
|
55
57
|
};
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Search works using client
|
|
61
|
-
|
|
62
|
-
Uses [openapi-fetch](https://openapi-ts.dev/openapi-fetch/) to generate a typed search client.
|
|
60
|
+
Create hooks and fetch data:
|
|
63
61
|
|
|
64
62
|
```typescript
|
|
65
|
-
import {
|
|
63
|
+
import { createBmdbFetchClient } from "@biblioteksentralen/bmdb-search";
|
|
64
|
+
import createReactQueryClient from "openapi-react-query";
|
|
66
65
|
|
|
67
|
-
const bmdbSearchClient =
|
|
68
|
-
const {
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
The arguments and response are fully typed.
|
|
72
|
-
|
|
73
|
-
### Search works using react hooks
|
|
74
|
-
|
|
75
|
-
Uses [tanstack](https://tanstack.com/query/latest) for fetch management and [openapi-react-query](https://openapi-ts.dev/openapi-react-query/) for typing.
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
import { createBmdbSearchHooks } from "@biblioteksentralen/bmdb-search";
|
|
79
|
-
|
|
80
|
-
const { useQuery, useInfiniteQuery, useSuspenseQuery, queryOptions } = createBmdbSearchHooks({
|
|
81
|
-
clientIdentifier: "client-unique-description",
|
|
82
|
-
});
|
|
66
|
+
const bmdbSearchClient = createBmdbFetchClient({ clientIdentifier: "client-unique-description" });
|
|
67
|
+
const { useQuery } = createReactQueryClient(bmdbSearchClient);
|
|
83
68
|
|
|
84
|
-
const Component = (
|
|
85
|
-
const { data, error, isLoading } = useQuery("/works/search", { params: { query: { query: "test" } } });
|
|
86
|
-
return <div>
|
|
69
|
+
const Component = () => {
|
|
70
|
+
const { data, error, isLoading } = useQuery("get", "/works/search", { params: { query: { query: "test" } } });
|
|
71
|
+
if (isLoading) return <div>Loading</div>;
|
|
72
|
+
if (error) return <div>Something went wrong</div>;
|
|
73
|
+
return <div>Found {data?.total} works</div>;
|
|
87
74
|
};
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Options
|
|
91
|
-
|
|
92
|
-
### Client identification policy
|
|
93
75
|
|
|
94
|
-
|
|
95
|
-
name and a contact address in the `clientIdentifier` string. We will only contact you about usage of the API.
|
|
76
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var createFetchClient = require('openapi-fetch');
|
|
4
|
-
var createReactQueryClient = require('openapi-react-query');
|
|
5
4
|
|
|
6
5
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
6
|
|
|
8
7
|
var createFetchClient__default = /*#__PURE__*/_interopDefault(createFetchClient);
|
|
9
|
-
var createReactQueryClient__default = /*#__PURE__*/_interopDefault(createReactQueryClient);
|
|
10
8
|
|
|
11
9
|
// src/client.ts
|
|
12
|
-
var
|
|
10
|
+
var createBmdbFetchClient = ({
|
|
13
11
|
clientIdentifier,
|
|
14
12
|
version = "v1",
|
|
15
13
|
...options
|
|
@@ -28,7 +26,5 @@ var createBmdbSearchClient = ({
|
|
|
28
26
|
});
|
|
29
27
|
return client;
|
|
30
28
|
};
|
|
31
|
-
var createBmdbSearchHooks = (args) => createReactQueryClient__default.default("searchClient" in args ? args.searchClient : createBmdbSearchClient(args));
|
|
32
29
|
|
|
33
|
-
exports.
|
|
34
|
-
exports.createBmdbSearchHooks = createBmdbSearchHooks;
|
|
30
|
+
exports.createBmdbFetchClient = createBmdbFetchClient;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ClientOptions, Client } from 'openapi-fetch';
|
|
2
|
-
import { OpenapiQueryClient } from 'openapi-react-query';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -30,11 +29,19 @@ interface paths {
|
|
|
30
29
|
}
|
|
31
30
|
interface components {
|
|
32
31
|
schemas: {
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @description Facet type, this is the value given to the search facet parameter. The facet should always exists in as a corresponding filter.
|
|
34
|
+
*
|
|
35
|
+
* @enum {string}
|
|
36
|
+
*/
|
|
37
|
+
WorkFacetType: "work_type" | "expression_type" | "manifestation_medium" | "creator" | "collection" | "subject" | "original_language" | "genre" | "age_limit" | "age_group" | "grep_subject" | "kulturfond" | "fiction";
|
|
38
|
+
/**
|
|
39
|
+
* @description Sorting type, this is the value given to the search facet parameter.
|
|
40
|
+
*
|
|
41
|
+
* @enum {string}
|
|
42
|
+
*/
|
|
43
|
+
WorkSort: "relevance.desc" | "updateTime.desc" | "updateTime.asc" | "publicationDate.desc" | "publicationDate.asc" | "firstPublicationDate.desc" | "firstPublicationDate.asc";
|
|
44
|
+
WorkFilter: {
|
|
38
45
|
identifier?: string;
|
|
39
46
|
work_id?: string;
|
|
40
47
|
expression_id?: string;
|
|
@@ -42,12 +49,64 @@ interface components {
|
|
|
42
49
|
work_type?: string;
|
|
43
50
|
expression_type?: string;
|
|
44
51
|
manifestation_medium?: string;
|
|
45
|
-
work_origin?: string;
|
|
46
|
-
origin?: string;
|
|
47
52
|
title?: string;
|
|
48
53
|
creator?: string;
|
|
49
54
|
collection?: string;
|
|
50
55
|
subject?: string;
|
|
56
|
+
kulturfond?: boolean;
|
|
57
|
+
original_language?: string;
|
|
58
|
+
genre?: string;
|
|
59
|
+
age_limit?: string;
|
|
60
|
+
age_group?: string;
|
|
61
|
+
grep_subject?: string;
|
|
62
|
+
fiction?: boolean;
|
|
63
|
+
abridger?: string;
|
|
64
|
+
actor?: string;
|
|
65
|
+
antecedent?: string;
|
|
66
|
+
arranger?: string;
|
|
67
|
+
artist?: string;
|
|
68
|
+
author?: string;
|
|
69
|
+
book_designer?: string;
|
|
70
|
+
colorist?: string;
|
|
71
|
+
commentary_writer?: string;
|
|
72
|
+
commenter?: string;
|
|
73
|
+
compilation_editor?: string;
|
|
74
|
+
compiler?: string;
|
|
75
|
+
composer?: string;
|
|
76
|
+
conceptor?: string;
|
|
77
|
+
conductor?: string;
|
|
78
|
+
consultant?: string;
|
|
79
|
+
contributor?: string;
|
|
80
|
+
copyright_holder?: string;
|
|
81
|
+
cover_designer?: string;
|
|
82
|
+
curator?: string;
|
|
83
|
+
degree_granting_institution?: string;
|
|
84
|
+
designer?: string;
|
|
85
|
+
director?: string;
|
|
86
|
+
editor?: string;
|
|
87
|
+
enacting_jurisdiction?: string;
|
|
88
|
+
game_developer?: string;
|
|
89
|
+
honoree?: string;
|
|
90
|
+
illustrator?: string;
|
|
91
|
+
instrumentalist?: string;
|
|
92
|
+
interviewee?: string;
|
|
93
|
+
interviewer?: string;
|
|
94
|
+
issuing_body?: string;
|
|
95
|
+
lead?: string;
|
|
96
|
+
librettist?: string;
|
|
97
|
+
lyricist?: string;
|
|
98
|
+
musician?: string;
|
|
99
|
+
narrator?: string;
|
|
100
|
+
other?: string;
|
|
101
|
+
performer?: string;
|
|
102
|
+
photographer?: string;
|
|
103
|
+
project_director?: string;
|
|
104
|
+
publisher?: string;
|
|
105
|
+
reteller?: string;
|
|
106
|
+
screenwriter?: string;
|
|
107
|
+
singer?: string;
|
|
108
|
+
translator?: string;
|
|
109
|
+
voice_actor?: string;
|
|
51
110
|
};
|
|
52
111
|
/** @enum {string} */
|
|
53
112
|
LanguageCode: "abk" | "ach" | "afr" | "akk" | "alb" | "amh" | "ang" | "ara" | "arc" | "arm" | "aze" | "bam" | "baq" | "bel" | "bem" | "ben" | "bis" | "bnt" | "bos" | "bre" | "bul" | "bur" | "byn" | "cat" | "ceb" | "che" | "chi" | "chu" | "cic" | "ckb" | "cmn" | "cnr" | "cop" | "cze" | "dan" | "dut" | "egy" | "eng" | "enm" | "epo" | "est" | "ewe" | "fao" | "fat" | "fij" | "fin" | "fiu" | "fkv" | "fre" | "frm" | "fro" | "fry" | "ful" | "gaa" | "geo" | "ger" | "gez" | "gla" | "gle" | "glg" | "gmh" | "got" | "grc" | "gre" | "guj" | "hau" | "heb" | "hil" | "hin" | "hrv" | "hun" | "ibo" | "ice" | "iku" | "ilo" | "ind" | "ipk" | "ira" | "ita" | "jpn" | "kal" | "kan" | "kaz" | "khm" | "kho" | "kik" | "kin" | "kmr" | "kon" | "kor" | "kua" | "kur" | "lao" | "lat" | "lav" | "lin" | "lit" | "lkt" | "lug" | "mac" | "mao" | "mar" | "may" | "mlg" | "mlt" | "mnk" | "mol" | "mon" | "mul" | "myn" | "nds" | "nep" | "nic" | "nno" | "nob" | "nom" | "non" | "nor" | "nso" | "oci" | "orm" | "pan" | "per" | "pli" | "pol" | "por" | "pra" | "pro" | "prs" | "pus" | "roh" | "rom" | "rum" | "run" | "rus" | "sah" | "san" | "sat" | "sco" | "sgn" | "sin" | "sit" | "sjd" | "sje" | "sjk" | "sjt" | "sju" | "slo" | "slv" | "sma" | "sme" | "smi" | "smj" | "smn" | "smo" | "sms" | "som" | "sot" | "spa" | "srp" | "sux" | "swa" | "swe" | "syr" | "tam" | "tay" | "tel" | "tgl" | "tha" | "tib" | "tir" | "tkl" | "tmh" | "ton" | "tur" | "ukr" | "urd" | "uzb" | "vie" | "wel" | "wen" | "wol" | "xho" | "yid" | "yor" | "ypk" | "yue" | "zul" | "und" | "zxx";
|
|
@@ -334,7 +393,6 @@ interface components {
|
|
|
334
393
|
name: components["schemas"]["LanguageMap"];
|
|
335
394
|
/** @description The qualifier is used to anchor the subject to a specific category in the Dewey hierarchy when the focus term is a phenomenon which appears in more than one place in the hierarchy, e.g. "Kjærlighet : psykologi" */
|
|
336
395
|
qualifier?: components["schemas"]["LanguageMap"];
|
|
337
|
-
specification?: components["schemas"]["LanguageMap"];
|
|
338
396
|
/** @description Internal note on the entity, e.g. field of use. */
|
|
339
397
|
scopeNote?: string;
|
|
340
398
|
/** @description {@link https://deweyno.pansoft.de Norsk WebDewey } classification number. */
|
|
@@ -638,72 +696,12 @@ interface components {
|
|
|
638
696
|
/** @description URI for the corresponding concept in National Library's [Vocabulary of target groups (nortarget)](https://www.nb.no/nbvok/tg/nb/). */
|
|
639
697
|
nortargetUri: string;
|
|
640
698
|
};
|
|
641
|
-
/** @enum {string} */
|
|
642
|
-
LibrarySystem: "bibliofil" | "cicero" | "quria" | "mikromarc";
|
|
643
|
-
Origin: {
|
|
644
|
-
id: string;
|
|
645
|
-
/** @constant */
|
|
646
|
-
name: "promus";
|
|
647
|
-
} | {
|
|
648
|
-
id: string;
|
|
649
|
-
/** @constant */
|
|
650
|
-
name: "ax";
|
|
651
|
-
} | {
|
|
652
|
-
id: string;
|
|
653
|
-
catalogue: string;
|
|
654
|
-
librarySystem: components["schemas"]["LibrarySystem"];
|
|
655
|
-
/** @constant */
|
|
656
|
-
name: "catalogueHarvester";
|
|
657
|
-
} | {
|
|
658
|
-
id: string;
|
|
659
|
-
/** @constant */
|
|
660
|
-
name: "filmoteket";
|
|
661
|
-
} | {
|
|
662
|
-
id: string;
|
|
663
|
-
/** @constant */
|
|
664
|
-
name: "mediastore";
|
|
665
|
-
} | {
|
|
666
|
-
id: string;
|
|
667
|
-
/** @constant */
|
|
668
|
-
name: "nmbf";
|
|
669
|
-
} | {
|
|
670
|
-
id: string;
|
|
671
|
-
/** @constant */
|
|
672
|
-
name: "bokbasen";
|
|
673
|
-
} | {
|
|
674
|
-
id: string;
|
|
675
|
-
/** @constant */
|
|
676
|
-
name: "ingram";
|
|
677
|
-
} | {
|
|
678
|
-
id: string;
|
|
679
|
-
/** @constant */
|
|
680
|
-
name: "gardners";
|
|
681
|
-
} | {
|
|
682
|
-
/** @constant */
|
|
683
|
-
name: "katt";
|
|
684
|
-
} | {
|
|
685
|
-
id: string;
|
|
686
|
-
/** @constant */
|
|
687
|
-
name: "kulturradet";
|
|
688
|
-
} | {
|
|
689
|
-
id: string;
|
|
690
|
-
/** @constant */
|
|
691
|
-
name: "grep";
|
|
692
|
-
} | {
|
|
693
|
-
id: string;
|
|
694
|
-
/** @constant */
|
|
695
|
-
name: "noraf";
|
|
696
|
-
} | {
|
|
697
|
-
id?: string;
|
|
698
|
-
/** @constant */
|
|
699
|
-
name: "script";
|
|
700
|
-
};
|
|
701
699
|
/** @description A Work is defined as "The intellectual or artistic content of a distinct creation" (Library Reference Model)
|
|
702
700
|
*
|
|
703
701
|
* It is the top level and most abstract entity in the WEMI stack (Work, Expression, Manifestation, Item), and serves to cluster all expressions of what one could consider "the same book" (or e.g. same play, film, game, etc.) in different formats and languages.
|
|
704
702
|
*
|
|
705
703
|
* While the work is an abstract entity, convention is to assign it a title, language and year in order to aid with identifying the work. */
|
|
706
|
-
|
|
704
|
+
BaseWork: {
|
|
707
705
|
/** @constant */
|
|
708
706
|
type: "Work";
|
|
709
707
|
/** @description Cordata work ID. */
|
|
@@ -767,8 +765,6 @@ interface components {
|
|
|
767
765
|
/** @description Whether the work has been created or adapted for users with special needs. */
|
|
768
766
|
accessibleContentFeature?: components["schemas"]["AccessibleContentFeature"];
|
|
769
767
|
biographicContent?: string;
|
|
770
|
-
/** @description Original data source */
|
|
771
|
-
origin: components["schemas"]["Origin"];
|
|
772
768
|
};
|
|
773
769
|
NumberOfPlayers: {
|
|
774
770
|
local?: {
|
|
@@ -853,10 +849,51 @@ interface components {
|
|
|
853
849
|
numberOfPerformers?: number;
|
|
854
850
|
}[];
|
|
855
851
|
};
|
|
852
|
+
ExpressionIllustrationsOptions: {
|
|
853
|
+
/** @constant */
|
|
854
|
+
code: "color_illustrations";
|
|
855
|
+
/** @constant */
|
|
856
|
+
name: "Illustrasjoner i farger";
|
|
857
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
858
|
+
/** @constant */
|
|
859
|
+
type: "expression_illustrations_option";
|
|
860
|
+
} | {
|
|
861
|
+
/** @constant */
|
|
862
|
+
code: "illustrations";
|
|
863
|
+
/** @constant */
|
|
864
|
+
name: "Illustrasjoner";
|
|
865
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
866
|
+
/** @constant */
|
|
867
|
+
type: "expression_illustrations_option";
|
|
868
|
+
} | {
|
|
869
|
+
/** @constant */
|
|
870
|
+
code: "not_illustrated";
|
|
871
|
+
/** @constant */
|
|
872
|
+
name: "Ikke illustrert";
|
|
873
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
874
|
+
/** @constant */
|
|
875
|
+
type: "expression_illustrations_option";
|
|
876
|
+
} | {
|
|
877
|
+
/** @constant */
|
|
878
|
+
code: "tactile_color_illustrations";
|
|
879
|
+
/** @constant */
|
|
880
|
+
name: "Taktile illustrasjoner i farger";
|
|
881
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
882
|
+
/** @constant */
|
|
883
|
+
type: "expression_illustrations_option";
|
|
884
|
+
} | {
|
|
885
|
+
/** @constant */
|
|
886
|
+
code: "tactile_illustrations";
|
|
887
|
+
/** @constant */
|
|
888
|
+
name: "Taktile illustrasjoner";
|
|
889
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
890
|
+
/** @constant */
|
|
891
|
+
type: "expression_illustrations_option";
|
|
892
|
+
};
|
|
856
893
|
/** @description An Expression is defined as "A distinct combination of signs conveying intellectual or artistic content" {@link https://www.iflastandards.info/lrm/lrmer#E3 Library Reference Model }
|
|
857
894
|
*
|
|
858
895
|
* It is the second level entity in the WEMI stack (Work, Expression, Manifestation, Item), and serves to group Manifestations of the same language and type - that is to say all manifestations using the same semiotic signs to convey the content. */
|
|
859
|
-
|
|
896
|
+
BaseExpression: {
|
|
860
897
|
/** @constant */
|
|
861
898
|
type: "Expression";
|
|
862
899
|
id: string;
|
|
@@ -888,8 +925,7 @@ interface components {
|
|
|
888
925
|
instrumentations?: components["schemas"]["Instrumentation"][];
|
|
889
926
|
/** @description If the expression is a translation and the translation was not carried out directly from the original language(s) of the work, but via one or more intermediate languages, this field contains the intermediate languages. */
|
|
890
927
|
intermediateTranslationLanguages?: components["schemas"]["Language"][];
|
|
891
|
-
|
|
892
|
-
origin: components["schemas"]["Origin"];
|
|
928
|
+
illustrations?: components["schemas"]["ExpressionIllustrationsOptions"];
|
|
893
929
|
};
|
|
894
930
|
/** @description A Manifestation is defined as "A set of all carriers that are assumed to share the same characteristics as to intellectual or artistic content and aspects of physical form. That set is defined by both the overall content and the production plan for its carrier or carriers" {@link https://www.iflastandards.info/lrm/lrmer#E4 Library Reference Model }
|
|
895
931
|
*
|
|
@@ -982,6 +1018,9 @@ interface components {
|
|
|
982
1018
|
/** @description Specifies the material that accompanyies the item, typically of document type "Combined document" or "Language Course" */
|
|
983
1019
|
accompanyingMaterial?: string;
|
|
984
1020
|
notes?: components["schemas"]["Note"][];
|
|
1021
|
+
kulturfond?: {
|
|
1022
|
+
status: boolean;
|
|
1023
|
+
};
|
|
985
1024
|
/** @description If the manifestation is a so-called aggregate manifestation, i.e. a manifestation containing multiple works, the list of works contained in the manifestation will be found here. Each of the works only make up a part of the manifestation.
|
|
986
1025
|
* If the collection of works is itself considered a work, that work and its corresponding expression will be found under the `work` and `expression` properties, respectively. If not, those properties will be undefined.
|
|
987
1026
|
* Examples:
|
|
@@ -993,21 +1032,19 @@ interface components {
|
|
|
993
1032
|
* itself is considered to be a work on its own, so this work is found under `work`, and the corresponding
|
|
994
1033
|
* expression under `expression`. */
|
|
995
1034
|
containedWorks?: {
|
|
996
|
-
work: components["schemas"]["
|
|
997
|
-
expression: components["schemas"]["
|
|
1035
|
+
work: components["schemas"]["BaseWork"];
|
|
1036
|
+
expression: components["schemas"]["BaseExpression"];
|
|
998
1037
|
}[];
|
|
999
|
-
/** @description Original data source */
|
|
1000
|
-
origin: components["schemas"]["Origin"];
|
|
1001
1038
|
};
|
|
1002
1039
|
/** ExpressionWithManifestations */
|
|
1003
|
-
|
|
1040
|
+
Expression: {
|
|
1004
1041
|
manifestations?: components["schemas"]["Manifestation"][];
|
|
1005
1042
|
aggregateManifestations?: components["schemas"]["Manifestation"][];
|
|
1006
|
-
} & components["schemas"]["
|
|
1007
|
-
/**
|
|
1008
|
-
|
|
1009
|
-
expressions?: components["schemas"]["
|
|
1010
|
-
} & components["schemas"]["
|
|
1043
|
+
} & components["schemas"]["BaseExpression"];
|
|
1044
|
+
/** Work */
|
|
1045
|
+
Work: {
|
|
1046
|
+
expressions?: components["schemas"]["Expression"][];
|
|
1047
|
+
} & components["schemas"]["BaseWork"];
|
|
1011
1048
|
FacetTerm: {
|
|
1012
1049
|
/** @description The facet terms searchable value. */
|
|
1013
1050
|
value: string;
|
|
@@ -1016,28 +1053,36 @@ interface components {
|
|
|
1016
1053
|
/** @description The number of occurrences in the search result, based on works. */
|
|
1017
1054
|
occurrences?: number;
|
|
1018
1055
|
};
|
|
1019
|
-
|
|
1020
|
-
type: components["schemas"]["
|
|
1056
|
+
WorkFacet: {
|
|
1057
|
+
type: components["schemas"]["WorkFacetType"];
|
|
1021
1058
|
/** @description A displayable (human readable) facet name. */
|
|
1022
1059
|
name?: string;
|
|
1023
1060
|
terms: components["schemas"]["FacetTerm"][];
|
|
1024
1061
|
};
|
|
1062
|
+
AdvanvedQueryError: {
|
|
1063
|
+
/** @enum {string} */
|
|
1064
|
+
code: "field_unknown" | "field_unspecified" | "binary_operator_invalid" | "query_invalid";
|
|
1065
|
+
message: string;
|
|
1066
|
+
};
|
|
1025
1067
|
GetWorkSearch200ResponseV2: {
|
|
1026
1068
|
/** @description The total number of results in the whole search result. */
|
|
1027
1069
|
total?: number;
|
|
1028
1070
|
results: {
|
|
1029
|
-
work: components["schemas"]["
|
|
1071
|
+
work: components["schemas"]["Work"];
|
|
1030
1072
|
representativeManifestationId: string;
|
|
1031
1073
|
}[];
|
|
1032
1074
|
/** @description If this is false, we haven't reached the end of the search result yet, if it's false we have, and if it's missing or null we don't know. */
|
|
1033
1075
|
endOfResults: boolean;
|
|
1034
1076
|
/** @description This array contains the requested facets, and their terms. Each facet type should only appear once in the array. */
|
|
1035
|
-
facets?: components["schemas"]["
|
|
1077
|
+
facets?: components["schemas"]["WorkFacet"][];
|
|
1036
1078
|
/**
|
|
1037
1079
|
* @description Indicates what kind of search was performed, based on parsed input query.
|
|
1038
1080
|
* @enum {string}
|
|
1039
1081
|
*/
|
|
1040
1082
|
queryType?: "empty" | "standard" | "advanced";
|
|
1083
|
+
/** @description Parsing errors from advanced query. When they occur, the request is treated as a standard search. */
|
|
1084
|
+
advancedQueryErrors?: components["schemas"]["AdvanvedQueryError"][];
|
|
1085
|
+
sorting: components["schemas"]["WorkSort"];
|
|
1041
1086
|
};
|
|
1042
1087
|
};
|
|
1043
1088
|
responses: never;
|
|
@@ -1059,15 +1104,15 @@ interface operations {
|
|
|
1059
1104
|
size?: number;
|
|
1060
1105
|
/** @description Page number (deafult 1). */
|
|
1061
1106
|
page?: number;
|
|
1062
|
-
facet?: components["schemas"]["
|
|
1107
|
+
facet?: components["schemas"]["WorkFacetType"][];
|
|
1063
1108
|
/** @description Retun this number of facet terms for each requested facet (deafult 10). */
|
|
1064
1109
|
facet_terms_size?: number;
|
|
1065
1110
|
/** @description Sorting */
|
|
1066
|
-
sort?: components["schemas"]["
|
|
1111
|
+
sort?: components["schemas"]["WorkSort"];
|
|
1067
1112
|
/** @description Each filter accepts multiple comma-separated values that are OR'ed together.
|
|
1068
1113
|
* The filters themselves are AND'ed together.
|
|
1069
1114
|
* */
|
|
1070
|
-
filter?: components["schemas"]["
|
|
1115
|
+
filter?: components["schemas"]["WorkFilter"];
|
|
1071
1116
|
};
|
|
1072
1117
|
header?: never;
|
|
1073
1118
|
path?: never;
|
|
@@ -1096,16 +1141,10 @@ type BmdbSearchClientOptions = ClientOptions & {
|
|
|
1096
1141
|
version?: "v1";
|
|
1097
1142
|
};
|
|
1098
1143
|
type BmdbSearchClient = Client<BmdbApiPaths>;
|
|
1099
|
-
declare const
|
|
1100
|
-
|
|
1101
|
-
type BmdbSearchHooks = OpenapiQueryClient<BmdbApiPaths>;
|
|
1102
|
-
type BmdbSearchHooksArgs = {
|
|
1103
|
-
searchClient: BmdbSearchClient;
|
|
1104
|
-
} | BmdbSearchClientOptions;
|
|
1105
|
-
declare const createBmdbSearchHooks: (args: BmdbSearchHooksArgs) => BmdbSearchHooks;
|
|
1144
|
+
declare const createBmdbFetchClient: ({ clientIdentifier, version, ...options }: BmdbSearchClientOptions) => BmdbSearchClient;
|
|
1106
1145
|
|
|
1107
|
-
type BmdbWork = BmdbApiSchemas["
|
|
1108
|
-
type BmdbExpression = BmdbApiSchemas["
|
|
1146
|
+
type BmdbWork = BmdbApiSchemas["Work"];
|
|
1147
|
+
type BmdbExpression = BmdbApiSchemas["Expression"];
|
|
1109
1148
|
type BmdbManifestation = BmdbApiSchemas["Manifestation"];
|
|
1110
1149
|
|
|
1111
|
-
export { type BmdbExpression, type BmdbManifestation, type BmdbSearchClient, type BmdbSearchClientOptions, type
|
|
1150
|
+
export { type BmdbExpression, type BmdbManifestation, type BmdbSearchClient, type BmdbSearchClientOptions, type BmdbWork, createBmdbFetchClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ClientOptions, Client } from 'openapi-fetch';
|
|
2
|
-
import { OpenapiQueryClient } from 'openapi-react-query';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -30,11 +29,19 @@ interface paths {
|
|
|
30
29
|
}
|
|
31
30
|
interface components {
|
|
32
31
|
schemas: {
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @description Facet type, this is the value given to the search facet parameter. The facet should always exists in as a corresponding filter.
|
|
34
|
+
*
|
|
35
|
+
* @enum {string}
|
|
36
|
+
*/
|
|
37
|
+
WorkFacetType: "work_type" | "expression_type" | "manifestation_medium" | "creator" | "collection" | "subject" | "original_language" | "genre" | "age_limit" | "age_group" | "grep_subject" | "kulturfond" | "fiction";
|
|
38
|
+
/**
|
|
39
|
+
* @description Sorting type, this is the value given to the search facet parameter.
|
|
40
|
+
*
|
|
41
|
+
* @enum {string}
|
|
42
|
+
*/
|
|
43
|
+
WorkSort: "relevance.desc" | "updateTime.desc" | "updateTime.asc" | "publicationDate.desc" | "publicationDate.asc" | "firstPublicationDate.desc" | "firstPublicationDate.asc";
|
|
44
|
+
WorkFilter: {
|
|
38
45
|
identifier?: string;
|
|
39
46
|
work_id?: string;
|
|
40
47
|
expression_id?: string;
|
|
@@ -42,12 +49,64 @@ interface components {
|
|
|
42
49
|
work_type?: string;
|
|
43
50
|
expression_type?: string;
|
|
44
51
|
manifestation_medium?: string;
|
|
45
|
-
work_origin?: string;
|
|
46
|
-
origin?: string;
|
|
47
52
|
title?: string;
|
|
48
53
|
creator?: string;
|
|
49
54
|
collection?: string;
|
|
50
55
|
subject?: string;
|
|
56
|
+
kulturfond?: boolean;
|
|
57
|
+
original_language?: string;
|
|
58
|
+
genre?: string;
|
|
59
|
+
age_limit?: string;
|
|
60
|
+
age_group?: string;
|
|
61
|
+
grep_subject?: string;
|
|
62
|
+
fiction?: boolean;
|
|
63
|
+
abridger?: string;
|
|
64
|
+
actor?: string;
|
|
65
|
+
antecedent?: string;
|
|
66
|
+
arranger?: string;
|
|
67
|
+
artist?: string;
|
|
68
|
+
author?: string;
|
|
69
|
+
book_designer?: string;
|
|
70
|
+
colorist?: string;
|
|
71
|
+
commentary_writer?: string;
|
|
72
|
+
commenter?: string;
|
|
73
|
+
compilation_editor?: string;
|
|
74
|
+
compiler?: string;
|
|
75
|
+
composer?: string;
|
|
76
|
+
conceptor?: string;
|
|
77
|
+
conductor?: string;
|
|
78
|
+
consultant?: string;
|
|
79
|
+
contributor?: string;
|
|
80
|
+
copyright_holder?: string;
|
|
81
|
+
cover_designer?: string;
|
|
82
|
+
curator?: string;
|
|
83
|
+
degree_granting_institution?: string;
|
|
84
|
+
designer?: string;
|
|
85
|
+
director?: string;
|
|
86
|
+
editor?: string;
|
|
87
|
+
enacting_jurisdiction?: string;
|
|
88
|
+
game_developer?: string;
|
|
89
|
+
honoree?: string;
|
|
90
|
+
illustrator?: string;
|
|
91
|
+
instrumentalist?: string;
|
|
92
|
+
interviewee?: string;
|
|
93
|
+
interviewer?: string;
|
|
94
|
+
issuing_body?: string;
|
|
95
|
+
lead?: string;
|
|
96
|
+
librettist?: string;
|
|
97
|
+
lyricist?: string;
|
|
98
|
+
musician?: string;
|
|
99
|
+
narrator?: string;
|
|
100
|
+
other?: string;
|
|
101
|
+
performer?: string;
|
|
102
|
+
photographer?: string;
|
|
103
|
+
project_director?: string;
|
|
104
|
+
publisher?: string;
|
|
105
|
+
reteller?: string;
|
|
106
|
+
screenwriter?: string;
|
|
107
|
+
singer?: string;
|
|
108
|
+
translator?: string;
|
|
109
|
+
voice_actor?: string;
|
|
51
110
|
};
|
|
52
111
|
/** @enum {string} */
|
|
53
112
|
LanguageCode: "abk" | "ach" | "afr" | "akk" | "alb" | "amh" | "ang" | "ara" | "arc" | "arm" | "aze" | "bam" | "baq" | "bel" | "bem" | "ben" | "bis" | "bnt" | "bos" | "bre" | "bul" | "bur" | "byn" | "cat" | "ceb" | "che" | "chi" | "chu" | "cic" | "ckb" | "cmn" | "cnr" | "cop" | "cze" | "dan" | "dut" | "egy" | "eng" | "enm" | "epo" | "est" | "ewe" | "fao" | "fat" | "fij" | "fin" | "fiu" | "fkv" | "fre" | "frm" | "fro" | "fry" | "ful" | "gaa" | "geo" | "ger" | "gez" | "gla" | "gle" | "glg" | "gmh" | "got" | "grc" | "gre" | "guj" | "hau" | "heb" | "hil" | "hin" | "hrv" | "hun" | "ibo" | "ice" | "iku" | "ilo" | "ind" | "ipk" | "ira" | "ita" | "jpn" | "kal" | "kan" | "kaz" | "khm" | "kho" | "kik" | "kin" | "kmr" | "kon" | "kor" | "kua" | "kur" | "lao" | "lat" | "lav" | "lin" | "lit" | "lkt" | "lug" | "mac" | "mao" | "mar" | "may" | "mlg" | "mlt" | "mnk" | "mol" | "mon" | "mul" | "myn" | "nds" | "nep" | "nic" | "nno" | "nob" | "nom" | "non" | "nor" | "nso" | "oci" | "orm" | "pan" | "per" | "pli" | "pol" | "por" | "pra" | "pro" | "prs" | "pus" | "roh" | "rom" | "rum" | "run" | "rus" | "sah" | "san" | "sat" | "sco" | "sgn" | "sin" | "sit" | "sjd" | "sje" | "sjk" | "sjt" | "sju" | "slo" | "slv" | "sma" | "sme" | "smi" | "smj" | "smn" | "smo" | "sms" | "som" | "sot" | "spa" | "srp" | "sux" | "swa" | "swe" | "syr" | "tam" | "tay" | "tel" | "tgl" | "tha" | "tib" | "tir" | "tkl" | "tmh" | "ton" | "tur" | "ukr" | "urd" | "uzb" | "vie" | "wel" | "wen" | "wol" | "xho" | "yid" | "yor" | "ypk" | "yue" | "zul" | "und" | "zxx";
|
|
@@ -334,7 +393,6 @@ interface components {
|
|
|
334
393
|
name: components["schemas"]["LanguageMap"];
|
|
335
394
|
/** @description The qualifier is used to anchor the subject to a specific category in the Dewey hierarchy when the focus term is a phenomenon which appears in more than one place in the hierarchy, e.g. "Kjærlighet : psykologi" */
|
|
336
395
|
qualifier?: components["schemas"]["LanguageMap"];
|
|
337
|
-
specification?: components["schemas"]["LanguageMap"];
|
|
338
396
|
/** @description Internal note on the entity, e.g. field of use. */
|
|
339
397
|
scopeNote?: string;
|
|
340
398
|
/** @description {@link https://deweyno.pansoft.de Norsk WebDewey } classification number. */
|
|
@@ -638,72 +696,12 @@ interface components {
|
|
|
638
696
|
/** @description URI for the corresponding concept in National Library's [Vocabulary of target groups (nortarget)](https://www.nb.no/nbvok/tg/nb/). */
|
|
639
697
|
nortargetUri: string;
|
|
640
698
|
};
|
|
641
|
-
/** @enum {string} */
|
|
642
|
-
LibrarySystem: "bibliofil" | "cicero" | "quria" | "mikromarc";
|
|
643
|
-
Origin: {
|
|
644
|
-
id: string;
|
|
645
|
-
/** @constant */
|
|
646
|
-
name: "promus";
|
|
647
|
-
} | {
|
|
648
|
-
id: string;
|
|
649
|
-
/** @constant */
|
|
650
|
-
name: "ax";
|
|
651
|
-
} | {
|
|
652
|
-
id: string;
|
|
653
|
-
catalogue: string;
|
|
654
|
-
librarySystem: components["schemas"]["LibrarySystem"];
|
|
655
|
-
/** @constant */
|
|
656
|
-
name: "catalogueHarvester";
|
|
657
|
-
} | {
|
|
658
|
-
id: string;
|
|
659
|
-
/** @constant */
|
|
660
|
-
name: "filmoteket";
|
|
661
|
-
} | {
|
|
662
|
-
id: string;
|
|
663
|
-
/** @constant */
|
|
664
|
-
name: "mediastore";
|
|
665
|
-
} | {
|
|
666
|
-
id: string;
|
|
667
|
-
/** @constant */
|
|
668
|
-
name: "nmbf";
|
|
669
|
-
} | {
|
|
670
|
-
id: string;
|
|
671
|
-
/** @constant */
|
|
672
|
-
name: "bokbasen";
|
|
673
|
-
} | {
|
|
674
|
-
id: string;
|
|
675
|
-
/** @constant */
|
|
676
|
-
name: "ingram";
|
|
677
|
-
} | {
|
|
678
|
-
id: string;
|
|
679
|
-
/** @constant */
|
|
680
|
-
name: "gardners";
|
|
681
|
-
} | {
|
|
682
|
-
/** @constant */
|
|
683
|
-
name: "katt";
|
|
684
|
-
} | {
|
|
685
|
-
id: string;
|
|
686
|
-
/** @constant */
|
|
687
|
-
name: "kulturradet";
|
|
688
|
-
} | {
|
|
689
|
-
id: string;
|
|
690
|
-
/** @constant */
|
|
691
|
-
name: "grep";
|
|
692
|
-
} | {
|
|
693
|
-
id: string;
|
|
694
|
-
/** @constant */
|
|
695
|
-
name: "noraf";
|
|
696
|
-
} | {
|
|
697
|
-
id?: string;
|
|
698
|
-
/** @constant */
|
|
699
|
-
name: "script";
|
|
700
|
-
};
|
|
701
699
|
/** @description A Work is defined as "The intellectual or artistic content of a distinct creation" (Library Reference Model)
|
|
702
700
|
*
|
|
703
701
|
* It is the top level and most abstract entity in the WEMI stack (Work, Expression, Manifestation, Item), and serves to cluster all expressions of what one could consider "the same book" (or e.g. same play, film, game, etc.) in different formats and languages.
|
|
704
702
|
*
|
|
705
703
|
* While the work is an abstract entity, convention is to assign it a title, language and year in order to aid with identifying the work. */
|
|
706
|
-
|
|
704
|
+
BaseWork: {
|
|
707
705
|
/** @constant */
|
|
708
706
|
type: "Work";
|
|
709
707
|
/** @description Cordata work ID. */
|
|
@@ -767,8 +765,6 @@ interface components {
|
|
|
767
765
|
/** @description Whether the work has been created or adapted for users with special needs. */
|
|
768
766
|
accessibleContentFeature?: components["schemas"]["AccessibleContentFeature"];
|
|
769
767
|
biographicContent?: string;
|
|
770
|
-
/** @description Original data source */
|
|
771
|
-
origin: components["schemas"]["Origin"];
|
|
772
768
|
};
|
|
773
769
|
NumberOfPlayers: {
|
|
774
770
|
local?: {
|
|
@@ -853,10 +849,51 @@ interface components {
|
|
|
853
849
|
numberOfPerformers?: number;
|
|
854
850
|
}[];
|
|
855
851
|
};
|
|
852
|
+
ExpressionIllustrationsOptions: {
|
|
853
|
+
/** @constant */
|
|
854
|
+
code: "color_illustrations";
|
|
855
|
+
/** @constant */
|
|
856
|
+
name: "Illustrasjoner i farger";
|
|
857
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
858
|
+
/** @constant */
|
|
859
|
+
type: "expression_illustrations_option";
|
|
860
|
+
} | {
|
|
861
|
+
/** @constant */
|
|
862
|
+
code: "illustrations";
|
|
863
|
+
/** @constant */
|
|
864
|
+
name: "Illustrasjoner";
|
|
865
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
866
|
+
/** @constant */
|
|
867
|
+
type: "expression_illustrations_option";
|
|
868
|
+
} | {
|
|
869
|
+
/** @constant */
|
|
870
|
+
code: "not_illustrated";
|
|
871
|
+
/** @constant */
|
|
872
|
+
name: "Ikke illustrert";
|
|
873
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
874
|
+
/** @constant */
|
|
875
|
+
type: "expression_illustrations_option";
|
|
876
|
+
} | {
|
|
877
|
+
/** @constant */
|
|
878
|
+
code: "tactile_color_illustrations";
|
|
879
|
+
/** @constant */
|
|
880
|
+
name: "Taktile illustrasjoner i farger";
|
|
881
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
882
|
+
/** @constant */
|
|
883
|
+
type: "expression_illustrations_option";
|
|
884
|
+
} | {
|
|
885
|
+
/** @constant */
|
|
886
|
+
code: "tactile_illustrations";
|
|
887
|
+
/** @constant */
|
|
888
|
+
name: "Taktile illustrasjoner";
|
|
889
|
+
preferred_name: components["schemas"]["LanguageMapWithEnglish"];
|
|
890
|
+
/** @constant */
|
|
891
|
+
type: "expression_illustrations_option";
|
|
892
|
+
};
|
|
856
893
|
/** @description An Expression is defined as "A distinct combination of signs conveying intellectual or artistic content" {@link https://www.iflastandards.info/lrm/lrmer#E3 Library Reference Model }
|
|
857
894
|
*
|
|
858
895
|
* It is the second level entity in the WEMI stack (Work, Expression, Manifestation, Item), and serves to group Manifestations of the same language and type - that is to say all manifestations using the same semiotic signs to convey the content. */
|
|
859
|
-
|
|
896
|
+
BaseExpression: {
|
|
860
897
|
/** @constant */
|
|
861
898
|
type: "Expression";
|
|
862
899
|
id: string;
|
|
@@ -888,8 +925,7 @@ interface components {
|
|
|
888
925
|
instrumentations?: components["schemas"]["Instrumentation"][];
|
|
889
926
|
/** @description If the expression is a translation and the translation was not carried out directly from the original language(s) of the work, but via one or more intermediate languages, this field contains the intermediate languages. */
|
|
890
927
|
intermediateTranslationLanguages?: components["schemas"]["Language"][];
|
|
891
|
-
|
|
892
|
-
origin: components["schemas"]["Origin"];
|
|
928
|
+
illustrations?: components["schemas"]["ExpressionIllustrationsOptions"];
|
|
893
929
|
};
|
|
894
930
|
/** @description A Manifestation is defined as "A set of all carriers that are assumed to share the same characteristics as to intellectual or artistic content and aspects of physical form. That set is defined by both the overall content and the production plan for its carrier or carriers" {@link https://www.iflastandards.info/lrm/lrmer#E4 Library Reference Model }
|
|
895
931
|
*
|
|
@@ -982,6 +1018,9 @@ interface components {
|
|
|
982
1018
|
/** @description Specifies the material that accompanyies the item, typically of document type "Combined document" or "Language Course" */
|
|
983
1019
|
accompanyingMaterial?: string;
|
|
984
1020
|
notes?: components["schemas"]["Note"][];
|
|
1021
|
+
kulturfond?: {
|
|
1022
|
+
status: boolean;
|
|
1023
|
+
};
|
|
985
1024
|
/** @description If the manifestation is a so-called aggregate manifestation, i.e. a manifestation containing multiple works, the list of works contained in the manifestation will be found here. Each of the works only make up a part of the manifestation.
|
|
986
1025
|
* If the collection of works is itself considered a work, that work and its corresponding expression will be found under the `work` and `expression` properties, respectively. If not, those properties will be undefined.
|
|
987
1026
|
* Examples:
|
|
@@ -993,21 +1032,19 @@ interface components {
|
|
|
993
1032
|
* itself is considered to be a work on its own, so this work is found under `work`, and the corresponding
|
|
994
1033
|
* expression under `expression`. */
|
|
995
1034
|
containedWorks?: {
|
|
996
|
-
work: components["schemas"]["
|
|
997
|
-
expression: components["schemas"]["
|
|
1035
|
+
work: components["schemas"]["BaseWork"];
|
|
1036
|
+
expression: components["schemas"]["BaseExpression"];
|
|
998
1037
|
}[];
|
|
999
|
-
/** @description Original data source */
|
|
1000
|
-
origin: components["schemas"]["Origin"];
|
|
1001
1038
|
};
|
|
1002
1039
|
/** ExpressionWithManifestations */
|
|
1003
|
-
|
|
1040
|
+
Expression: {
|
|
1004
1041
|
manifestations?: components["schemas"]["Manifestation"][];
|
|
1005
1042
|
aggregateManifestations?: components["schemas"]["Manifestation"][];
|
|
1006
|
-
} & components["schemas"]["
|
|
1007
|
-
/**
|
|
1008
|
-
|
|
1009
|
-
expressions?: components["schemas"]["
|
|
1010
|
-
} & components["schemas"]["
|
|
1043
|
+
} & components["schemas"]["BaseExpression"];
|
|
1044
|
+
/** Work */
|
|
1045
|
+
Work: {
|
|
1046
|
+
expressions?: components["schemas"]["Expression"][];
|
|
1047
|
+
} & components["schemas"]["BaseWork"];
|
|
1011
1048
|
FacetTerm: {
|
|
1012
1049
|
/** @description The facet terms searchable value. */
|
|
1013
1050
|
value: string;
|
|
@@ -1016,28 +1053,36 @@ interface components {
|
|
|
1016
1053
|
/** @description The number of occurrences in the search result, based on works. */
|
|
1017
1054
|
occurrences?: number;
|
|
1018
1055
|
};
|
|
1019
|
-
|
|
1020
|
-
type: components["schemas"]["
|
|
1056
|
+
WorkFacet: {
|
|
1057
|
+
type: components["schemas"]["WorkFacetType"];
|
|
1021
1058
|
/** @description A displayable (human readable) facet name. */
|
|
1022
1059
|
name?: string;
|
|
1023
1060
|
terms: components["schemas"]["FacetTerm"][];
|
|
1024
1061
|
};
|
|
1062
|
+
AdvanvedQueryError: {
|
|
1063
|
+
/** @enum {string} */
|
|
1064
|
+
code: "field_unknown" | "field_unspecified" | "binary_operator_invalid" | "query_invalid";
|
|
1065
|
+
message: string;
|
|
1066
|
+
};
|
|
1025
1067
|
GetWorkSearch200ResponseV2: {
|
|
1026
1068
|
/** @description The total number of results in the whole search result. */
|
|
1027
1069
|
total?: number;
|
|
1028
1070
|
results: {
|
|
1029
|
-
work: components["schemas"]["
|
|
1071
|
+
work: components["schemas"]["Work"];
|
|
1030
1072
|
representativeManifestationId: string;
|
|
1031
1073
|
}[];
|
|
1032
1074
|
/** @description If this is false, we haven't reached the end of the search result yet, if it's false we have, and if it's missing or null we don't know. */
|
|
1033
1075
|
endOfResults: boolean;
|
|
1034
1076
|
/** @description This array contains the requested facets, and their terms. Each facet type should only appear once in the array. */
|
|
1035
|
-
facets?: components["schemas"]["
|
|
1077
|
+
facets?: components["schemas"]["WorkFacet"][];
|
|
1036
1078
|
/**
|
|
1037
1079
|
* @description Indicates what kind of search was performed, based on parsed input query.
|
|
1038
1080
|
* @enum {string}
|
|
1039
1081
|
*/
|
|
1040
1082
|
queryType?: "empty" | "standard" | "advanced";
|
|
1083
|
+
/** @description Parsing errors from advanced query. When they occur, the request is treated as a standard search. */
|
|
1084
|
+
advancedQueryErrors?: components["schemas"]["AdvanvedQueryError"][];
|
|
1085
|
+
sorting: components["schemas"]["WorkSort"];
|
|
1041
1086
|
};
|
|
1042
1087
|
};
|
|
1043
1088
|
responses: never;
|
|
@@ -1059,15 +1104,15 @@ interface operations {
|
|
|
1059
1104
|
size?: number;
|
|
1060
1105
|
/** @description Page number (deafult 1). */
|
|
1061
1106
|
page?: number;
|
|
1062
|
-
facet?: components["schemas"]["
|
|
1107
|
+
facet?: components["schemas"]["WorkFacetType"][];
|
|
1063
1108
|
/** @description Retun this number of facet terms for each requested facet (deafult 10). */
|
|
1064
1109
|
facet_terms_size?: number;
|
|
1065
1110
|
/** @description Sorting */
|
|
1066
|
-
sort?: components["schemas"]["
|
|
1111
|
+
sort?: components["schemas"]["WorkSort"];
|
|
1067
1112
|
/** @description Each filter accepts multiple comma-separated values that are OR'ed together.
|
|
1068
1113
|
* The filters themselves are AND'ed together.
|
|
1069
1114
|
* */
|
|
1070
|
-
filter?: components["schemas"]["
|
|
1115
|
+
filter?: components["schemas"]["WorkFilter"];
|
|
1071
1116
|
};
|
|
1072
1117
|
header?: never;
|
|
1073
1118
|
path?: never;
|
|
@@ -1096,16 +1141,10 @@ type BmdbSearchClientOptions = ClientOptions & {
|
|
|
1096
1141
|
version?: "v1";
|
|
1097
1142
|
};
|
|
1098
1143
|
type BmdbSearchClient = Client<BmdbApiPaths>;
|
|
1099
|
-
declare const
|
|
1100
|
-
|
|
1101
|
-
type BmdbSearchHooks = OpenapiQueryClient<BmdbApiPaths>;
|
|
1102
|
-
type BmdbSearchHooksArgs = {
|
|
1103
|
-
searchClient: BmdbSearchClient;
|
|
1104
|
-
} | BmdbSearchClientOptions;
|
|
1105
|
-
declare const createBmdbSearchHooks: (args: BmdbSearchHooksArgs) => BmdbSearchHooks;
|
|
1144
|
+
declare const createBmdbFetchClient: ({ clientIdentifier, version, ...options }: BmdbSearchClientOptions) => BmdbSearchClient;
|
|
1106
1145
|
|
|
1107
|
-
type BmdbWork = BmdbApiSchemas["
|
|
1108
|
-
type BmdbExpression = BmdbApiSchemas["
|
|
1146
|
+
type BmdbWork = BmdbApiSchemas["Work"];
|
|
1147
|
+
type BmdbExpression = BmdbApiSchemas["Expression"];
|
|
1109
1148
|
type BmdbManifestation = BmdbApiSchemas["Manifestation"];
|
|
1110
1149
|
|
|
1111
|
-
export { type BmdbExpression, type BmdbManifestation, type BmdbSearchClient, type BmdbSearchClientOptions, type
|
|
1150
|
+
export { type BmdbExpression, type BmdbManifestation, type BmdbSearchClient, type BmdbSearchClientOptions, type BmdbWork, createBmdbFetchClient };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import createFetchClient from 'openapi-fetch';
|
|
2
|
-
import createReactQueryClient from 'openapi-react-query';
|
|
3
2
|
|
|
4
3
|
// src/client.ts
|
|
5
|
-
var
|
|
4
|
+
var createBmdbFetchClient = ({
|
|
6
5
|
clientIdentifier,
|
|
7
6
|
version = "v1",
|
|
8
7
|
...options
|
|
@@ -21,6 +20,5 @@ var createBmdbSearchClient = ({
|
|
|
21
20
|
});
|
|
22
21
|
return client;
|
|
23
22
|
};
|
|
24
|
-
var createBmdbSearchHooks = (args) => createReactQueryClient("searchClient" in args ? args.searchClient : createBmdbSearchClient(args));
|
|
25
23
|
|
|
26
|
-
export {
|
|
24
|
+
export { createBmdbFetchClient };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biblioteksentralen/bmdb-search",
|
|
3
|
-
"version": "0.0.0-beta.
|
|
3
|
+
"version": "0.0.0-beta.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Client for searching Bibliotekenes metadatabrønn (BMDB)",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"author": "Biblioteksentralen",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"openapi-fetch": "^0.13.4"
|
|
32
|
-
"openapi-react-query": "^0.5.1"
|
|
31
|
+
"openapi-fetch": "^0.13.4"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@dataplattform/api-specifications": "x",
|