@biblioteksentralen/bmdb-search 0.0.0-beta.1
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/CHANGELOG.md +3 -0
- package/README.md +83 -0
- package/dist/index.cjs +30 -0
- package/dist/index.d.cts +1040 -0
- package/dist/index.d.ts +1040 -0
- package/dist/index.js +22 -0
- package/package.json +57 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import createFetchClient from 'openapi-fetch';
|
|
2
|
+
import createReactQueryClient from 'openapi-react-query';
|
|
3
|
+
|
|
4
|
+
// src/client.ts
|
|
5
|
+
var createBmdbSearchClient = ({
|
|
6
|
+
clientIdentifier,
|
|
7
|
+
version = "v2",
|
|
8
|
+
...options
|
|
9
|
+
}) => {
|
|
10
|
+
const baseUrl = `${options.baseUrl?.replace(/(.*)\/$/, "$1") ?? ""}/bmdb/api/${version}/`;
|
|
11
|
+
const client = createFetchClient({ ...options, baseUrl });
|
|
12
|
+
client.use({
|
|
13
|
+
onRequest({ request }) {
|
|
14
|
+
request.headers.set("client-identifier", clientIdentifier);
|
|
15
|
+
return request;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return client;
|
|
19
|
+
};
|
|
20
|
+
var createBmdbSearchHooks = (args) => createReactQueryClient("searchClient" in args ? args.searchClient : createBmdbSearchClient(args));
|
|
21
|
+
|
|
22
|
+
export { createBmdbSearchClient, createBmdbSearchHooks };
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@biblioteksentralen/bmdb-search",
|
|
3
|
+
"version": "0.0.0-beta.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Client for searching Bibliotekenes metadatabrønn (BMDB)",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"README.md",
|
|
24
|
+
"CHANGELOG.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"dist/**/*.{js,cjs,mjs,ts,d.ts,d.cts,yaml}"
|
|
27
|
+
],
|
|
28
|
+
"author": "Biblioteksentralen",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"openapi-fetch": "^0.13.4",
|
|
32
|
+
"openapi-react-query": "^0.5.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@dataplattform/api-specifications": "x",
|
|
36
|
+
"@dataplattform/eslint-config": "x",
|
|
37
|
+
"@types/node": "^22.15.3",
|
|
38
|
+
"eslint": "^9.26.0",
|
|
39
|
+
"prettier": "^3.2.5",
|
|
40
|
+
"tsup": "^8.0.2",
|
|
41
|
+
"tsx": "^4.16.2",
|
|
42
|
+
"typescript": "5.6.2",
|
|
43
|
+
"vitest": "^3.1.2"
|
|
44
|
+
},
|
|
45
|
+
"prettier": {
|
|
46
|
+
"printWidth": 120,
|
|
47
|
+
"quoteProps": "consistent"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"type-check": "tsc --noEmit",
|
|
51
|
+
"clean": "rimraf dist src/generated",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"lint:package": "attw --pack",
|
|
54
|
+
"test": "pnpm vitest -w=false",
|
|
55
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --dts-resolve --treeshake"
|
|
56
|
+
}
|
|
57
|
+
}
|