@biblioteksentralen/bmdb-search 0.0.0-beta.2 → 0.0.0-beta.20

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/README.md +22 -73
  3. package/dist/chunk-2QYZKLEL.js +14925 -0
  4. package/dist/chunk-2UT5GPVV.js +14918 -0
  5. package/dist/chunk-4KUQHSGO.js +14910 -0
  6. package/dist/chunk-4VULP744.js +14913 -0
  7. package/dist/chunk-5JZ4HY2B.js +14926 -0
  8. package/dist/chunk-BVNV6FFF.js +14904 -0
  9. package/dist/chunk-DVQJTRK7.js +14933 -0
  10. package/dist/chunk-EKMSXG47.js +14883 -0
  11. package/dist/chunk-FCYYVSPY.js +14921 -0
  12. package/dist/chunk-FGDMIEV7.js +14920 -0
  13. package/dist/chunk-GHEYNKFF.js +14925 -0
  14. package/dist/chunk-KDDO7YJH.js +14908 -0
  15. package/dist/chunk-M2UJFDEC.js +14882 -0
  16. package/dist/chunk-QMLCZJ6K.js +14912 -0
  17. package/dist/chunk-QT2QDC5N.js +14917 -0
  18. package/dist/chunk-RERLCLDA.js +14925 -0
  19. package/dist/chunk-RLDOKHJ3.js +14925 -0
  20. package/dist/chunk-SCW6JR36.js +14914 -0
  21. package/dist/chunk-WKMPBILR.js +14882 -0
  22. package/dist/chunk-YCL7ZI3P.js +14913 -0
  23. package/dist/chunk-YGPHHSGQ.js +14934 -0
  24. package/dist/index-DN1eQZzZ.d.cts +3799 -0
  25. package/dist/index-DN1eQZzZ.d.ts +3799 -0
  26. package/dist/index.cjs +14946 -10
  27. package/dist/index.d-0-6GpZp8.d.cts +3780 -0
  28. package/dist/index.d-0-6GpZp8.d.ts +3780 -0
  29. package/dist/index.d-6UQ5XFBK.d.cts +3788 -0
  30. package/dist/index.d-6UQ5XFBK.d.ts +3788 -0
  31. package/dist/index.d-B3mlbY2i.d.cts +3796 -0
  32. package/dist/index.d-B3mlbY2i.d.ts +3796 -0
  33. package/dist/index.d-B4s2-oCb.d.cts +3799 -0
  34. package/dist/index.d-B4s2-oCb.d.ts +3799 -0
  35. package/dist/index.d-BGTL1nsQ.d.cts +3744 -0
  36. package/dist/index.d-BGTL1nsQ.d.ts +3744 -0
  37. package/dist/index.d-BO699FkZ.d.cts +3717 -0
  38. package/dist/index.d-BO699FkZ.d.ts +3717 -0
  39. package/dist/index.d-BOCWNFjn.d.cts +3786 -0
  40. package/dist/index.d-BOCWNFjn.d.ts +3786 -0
  41. package/dist/index.d-BRVlQviG.d.cts +3714 -0
  42. package/dist/index.d-BRVlQviG.d.ts +3714 -0
  43. package/dist/index.d-BU4v5yDq.d.cts +3723 -0
  44. package/dist/index.d-BU4v5yDq.d.ts +3723 -0
  45. package/dist/index.d-BcLZJncu.d.cts +3733 -0
  46. package/dist/index.d-BcLZJncu.d.ts +3733 -0
  47. package/dist/index.d-BfxCal8r.d.cts +3809 -0
  48. package/dist/index.d-BfxCal8r.d.ts +3809 -0
  49. package/dist/index.d-Bhag4Gh8.d.cts +3786 -0
  50. package/dist/index.d-Bhag4Gh8.d.ts +3786 -0
  51. package/dist/index.d-BlocHY5f.d.cts +3783 -0
  52. package/dist/index.d-BlocHY5f.d.ts +3783 -0
  53. package/dist/index.d-Bo-CqceL.d.cts +3783 -0
  54. package/dist/index.d-Bo-CqceL.d.ts +3783 -0
  55. package/dist/index.d-Bodx7_L7.d.cts +3727 -0
  56. package/dist/index.d-Bodx7_L7.d.ts +3727 -0
  57. package/dist/index.d-C4LgMWzi.d.cts +3719 -0
  58. package/dist/index.d-C4LgMWzi.d.ts +3719 -0
  59. package/dist/index.d-C6eF-acI.d.cts +3729 -0
  60. package/dist/index.d-C6eF-acI.d.ts +3729 -0
  61. package/dist/index.d-CNblIfVJ.d.cts +3719 -0
  62. package/dist/index.d-CNblIfVJ.d.ts +3719 -0
  63. package/dist/index.d-CZ2KeHo_.d.cts +3736 -0
  64. package/dist/index.d-CZ2KeHo_.d.ts +3736 -0
  65. package/dist/index.d-Cf5CW9gT.d.cts +3794 -0
  66. package/dist/index.d-Cf5CW9gT.d.ts +3794 -0
  67. package/dist/index.d-Cus2SItb.d.cts +3757 -0
  68. package/dist/index.d-Cus2SItb.d.ts +3757 -0
  69. package/dist/index.d-D9GgnKVt.d.cts +3719 -0
  70. package/dist/index.d-D9GgnKVt.d.ts +3719 -0
  71. package/dist/index.d-DArQCHIQ.d.cts +3732 -0
  72. package/dist/index.d-DArQCHIQ.d.ts +3732 -0
  73. package/dist/index.d-DU2K2cS8.d.cts +3723 -0
  74. package/dist/index.d-DU2K2cS8.d.ts +3723 -0
  75. package/dist/index.d-DVE8OW7s.d.cts +3719 -0
  76. package/dist/index.d-DVE8OW7s.d.ts +3719 -0
  77. package/dist/index.d-DjvA_yQE.d.cts +3727 -0
  78. package/dist/index.d-DjvA_yQE.d.ts +3727 -0
  79. package/dist/index.d-DpZv9OdT.d.cts +3731 -0
  80. package/dist/index.d-DpZv9OdT.d.ts +3731 -0
  81. package/dist/index.d-DpdSdqnT.d.cts +3724 -0
  82. package/dist/index.d-DpdSdqnT.d.ts +3724 -0
  83. package/dist/index.d-DwhKG4ud.d.cts +3733 -0
  84. package/dist/index.d-DwhKG4ud.d.ts +3733 -0
  85. package/dist/index.d-FE6qJIAV.d.cts +3732 -0
  86. package/dist/index.d-FE6qJIAV.d.ts +3732 -0
  87. package/dist/index.d-NhVnbzyE.d.cts +3790 -0
  88. package/dist/index.d-NhVnbzyE.d.ts +3790 -0
  89. package/dist/index.d-PHogkINT.d.cts +3763 -0
  90. package/dist/index.d-PHogkINT.d.ts +3763 -0
  91. package/dist/index.d-TVZmpsrx.d.cts +3726 -0
  92. package/dist/index.d-TVZmpsrx.d.ts +3726 -0
  93. package/dist/index.d-jCNpGioP.d.cts +3784 -0
  94. package/dist/index.d-jCNpGioP.d.ts +3784 -0
  95. package/dist/index.d-n05R9qC0.d.cts +3784 -0
  96. package/dist/index.d-n05R9qC0.d.ts +3784 -0
  97. package/dist/index.d-sYxaQMGR.d.cts +3730 -0
  98. package/dist/index.d-sYxaQMGR.d.ts +3730 -0
  99. package/dist/index.d.cts +16 -1103
  100. package/dist/index.d.ts +16 -1103
  101. package/dist/index.js +16 -8
  102. package/dist/v1/index.cjs +14940 -0
  103. package/dist/v1/index.d.cts +2 -0
  104. package/dist/v1/index.d.ts +2 -0
  105. package/dist/v1/index.js +1 -0
  106. package/package.json +19 -10
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
1
  # @biblioteksentralen/bmdb-search
2
2
 
3
- TODO
3
+ ## 0.0.0-beta.16
4
+
5
+ - [BREAKING] `/{profile}` prefix for all routes
6
+ - Removed `clientIdentifier`
7
+
8
+ ## 0.0.0-beta.14
9
+
10
+ - Refactored `Work.subjects` model
package/README.md CHANGED
@@ -1,95 +1,44 @@
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
- ## Setup
5
+ ## Options
6
6
 
7
- ### Server context
7
+ ## Usage examples
8
8
 
9
- When used in a non-browser context, the `baseUrl` can be supplied directly, e.g.
9
+ ### Search works
10
10
 
11
11
  ```typescript
12
- import { createBmdbSearchClient } from "@biblioteksentralen/bmdb-search";
12
+ import { createBmdbFetchClient } from "@biblioteksentralen/bmdb-search";
13
13
 
14
- const bmdbSearchClient = createBmdbSearchClient({
15
- clientIdentifier: "client-unique-description",
16
- baseUrl: "https://search.data.bs.no",
14
+ const bmdbSearchClient = createBmdbFetchClient({
15
+ host: "https://search.data.bs.no",
17
16
  });
18
- ```
19
-
20
- ### Browser context
21
17
 
22
- In browsers, a content security policy typically has to be taken into account. One approach is to use URL rewrites. If for example using Next.js, this can be achieved using the config file:
23
-
24
- ```typescript
25
- // next.config.js or similar
26
- const searchApiHost = "https://search.data.bs.no";
27
-
28
- const config = {
29
- // ... other config ...
30
- rewrites() {
31
- return [
32
- {
33
- source: "/bmdb/api/:path*",
34
- destination: `${searchApiHost}/bmdb/api/:path*`,
35
- },
36
- ];
37
- },
38
- };
39
-
40
- // File utilizing search client
41
- import { createBmdbSearchClient } from "@biblioteksentralen/bmdb-search";
42
-
43
- const bmdbSearchClient = createBmdbSearchClient({ clientIdentifier: "client-unique-description" });
44
- ```
45
-
46
- For Next.js it might also have to be exempt from handling in middleware (e.g. internationalization):
47
-
48
- ```typescript
49
- // middleware.ts
50
- export const config = {
51
- matcher: [
52
- // ...other
53
- "/((?!|bmdb/api|_next/static).*)",
54
- ],
55
- };
56
- ```
57
-
58
- ## Usage examples
59
-
60
- ### Search works using client
61
-
62
- Uses [openapi-fetch](https://openapi-ts.dev/openapi-fetch/) to generate a typed search client.
63
-
64
- ```typescript
65
- import { createBmdbSearchClient } from "@biblioteksentralen/bmdb-search";
66
-
67
- const bmdbSearchClient = createBmdbSearchClient({ clientIdentifier: "client-unique-description" });
68
- const { data, error } = await bmdbSearchClient.GET("/works/search", { query: { query: "test" } });
18
+ const { data, error } = await bmdbSearchClient.GET("/works/search", { params: { query: { query: "test" } } });
69
19
  ```
70
20
 
71
21
  The arguments and response are fully typed.
72
22
 
73
- ### Search works using react hooks
23
+ ### Usage with tanstack-query, openapi-react-query and React hooks
74
24
 
75
- Uses [tanstack](https://tanstack.com/query/latest) for fetch management and [openapi-react-query](https://openapi-ts.dev/openapi-react-query/) for typing.
25
+ 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.
76
26
 
77
27
  ```typescript
78
- import { createBmdbSearchHooks } from "@biblioteksentralen/bmdb-search";
28
+ import { createBmdbFetchClient } from "@biblioteksentralen/bmdb-search";
29
+ import createReactQueryClient from "openapi-react-query";
79
30
 
80
- const { useQuery, useInfiniteQuery, useSuspenseQuery, queryOptions } = createBmdbSearchHooks({
81
- clientIdentifier: "client-unique-description",
31
+ const bmdbSearchClient = createBmdbFetchClient({
32
+ host: "https://search.data.bs.no"
82
33
  });
83
34
 
84
- const Component = (props) => {
85
- const { data, error, isLoading } = useQuery("/works/search", { query: { query: "test" } });
86
- return <div>Hello</div>
87
- };
88
- ```
35
+ const { useQuery } = createReactQueryClient(bmdbSearchClient);
89
36
 
90
- ## Options
91
-
92
- ### Client identification policy
37
+ const Component = () => {
38
+ const { data, error, isLoading } = useQuery("get", "/works/search", { params: { query: { query: "test" } } });
39
+ if (isLoading) return <div>Loading</div>;
40
+ if (error) return <div>Something went wrong</div>;
41
+ return <div>Found {data?.total} works</div>;
42
+ };
93
43
 
94
- The API does not require authentication, but clients should identify themselves using a descriptive
95
- name and a contact address in the `clientIdentifier` string. We will only contact you about usage of the API.
44
+ ```