@biblioteksentralen/bmdb-search 0.0.0-beta.6 → 0.0.0-beta.7
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 +4 -1
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,10 @@ name and a contact address in the `clientIdentifier` string. We will only contac
|
|
|
16
16
|
```typescript
|
|
17
17
|
import { createBmdbFetchClient } from "@biblioteksentralen/bmdb-search";
|
|
18
18
|
|
|
19
|
-
const bmdbSearchClient = createBmdbFetchClient({
|
|
19
|
+
const bmdbSearchClient = createBmdbFetchClient({
|
|
20
|
+
clientIdentifier: "client-unique-description",
|
|
21
|
+
host: "https://search.data.bs.no",
|
|
22
|
+
});
|
|
20
23
|
const { data, error } = await bmdbSearchClient.GET("/works/search", { params: { query: { query: "test" } } });
|
|
21
24
|
```
|
|
22
25
|
|
package/dist/index.cjs
CHANGED
|
@@ -19,10 +19,16 @@ var formatSingleTitle = ({ mainTitle, subtitle, partNumber, partTitle }, options
|
|
|
19
19
|
var formatUniformTitleMusic = ({ form, instrumentation, serialNumber, opusNumber, thematicCatalogueNumber, part, key, arrangement }) => form + (instrumentation ? ` ${instrumentation}` : "") + (serialNumber ? `, ${serialNumber}` : "") + (opusNumber ? `, ${opusNumber}` : "") + (thematicCatalogueNumber ? `, ${thematicCatalogueNumber}` : "") + (part ? `, ${part}` : "") + (key ? `, ${key}` : "") + (arrangement ? `, ${arrangement}` : "");
|
|
20
20
|
var createBmdbFetchClient = ({
|
|
21
21
|
clientIdentifier,
|
|
22
|
+
host,
|
|
22
23
|
version = "v1",
|
|
23
24
|
...options
|
|
24
25
|
}) => {
|
|
25
|
-
|
|
26
|
+
try {
|
|
27
|
+
new URL(host);
|
|
28
|
+
} catch {
|
|
29
|
+
throw new Error(`Invalid host URL: ${host}`);
|
|
30
|
+
}
|
|
31
|
+
const baseUrl = `${host.replace(/(.*)\/$/, "$1")}/bmdb/api/${version}/`;
|
|
26
32
|
const client = createFetchClient__default.default({
|
|
27
33
|
baseUrl,
|
|
28
34
|
querySerializer: { array: { style: "form", explode: false } },
|
package/dist/index.d.cts
CHANGED
|
@@ -1151,10 +1151,11 @@ type BmdbApiPaths = paths;
|
|
|
1151
1151
|
|
|
1152
1152
|
type BmdbSearchClientOptions = ClientOptions & {
|
|
1153
1153
|
clientIdentifier: string;
|
|
1154
|
+
host: string;
|
|
1154
1155
|
version?: "v1";
|
|
1155
1156
|
};
|
|
1156
1157
|
type BmdbSearchClient = Client<BmdbApiPaths>;
|
|
1157
|
-
declare const createBmdbFetchClient: ({ clientIdentifier, version, ...options }: BmdbSearchClientOptions) => BmdbSearchClient;
|
|
1158
|
+
declare const createBmdbFetchClient: ({ clientIdentifier, host, version, ...options }: BmdbSearchClientOptions) => BmdbSearchClient;
|
|
1158
1159
|
|
|
1159
1160
|
type BmdbWork = BmdbApiSchemas["Work"];
|
|
1160
1161
|
type BmdbExpression = BmdbApiSchemas["Expression"];
|
package/dist/index.d.ts
CHANGED
|
@@ -1151,10 +1151,11 @@ type BmdbApiPaths = paths;
|
|
|
1151
1151
|
|
|
1152
1152
|
type BmdbSearchClientOptions = ClientOptions & {
|
|
1153
1153
|
clientIdentifier: string;
|
|
1154
|
+
host: string;
|
|
1154
1155
|
version?: "v1";
|
|
1155
1156
|
};
|
|
1156
1157
|
type BmdbSearchClient = Client<BmdbApiPaths>;
|
|
1157
|
-
declare const createBmdbFetchClient: ({ clientIdentifier, version, ...options }: BmdbSearchClientOptions) => BmdbSearchClient;
|
|
1158
|
+
declare const createBmdbFetchClient: ({ clientIdentifier, host, version, ...options }: BmdbSearchClientOptions) => BmdbSearchClient;
|
|
1158
1159
|
|
|
1159
1160
|
type BmdbWork = BmdbApiSchemas["Work"];
|
|
1160
1161
|
type BmdbExpression = BmdbApiSchemas["Expression"];
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,16 @@ var formatSingleTitle = ({ mainTitle, subtitle, partNumber, partTitle }, options
|
|
|
13
13
|
var formatUniformTitleMusic = ({ form, instrumentation, serialNumber, opusNumber, thematicCatalogueNumber, part, key, arrangement }) => form + (instrumentation ? ` ${instrumentation}` : "") + (serialNumber ? `, ${serialNumber}` : "") + (opusNumber ? `, ${opusNumber}` : "") + (thematicCatalogueNumber ? `, ${thematicCatalogueNumber}` : "") + (part ? `, ${part}` : "") + (key ? `, ${key}` : "") + (arrangement ? `, ${arrangement}` : "");
|
|
14
14
|
var createBmdbFetchClient = ({
|
|
15
15
|
clientIdentifier,
|
|
16
|
+
host,
|
|
16
17
|
version = "v1",
|
|
17
18
|
...options
|
|
18
19
|
}) => {
|
|
19
|
-
|
|
20
|
+
try {
|
|
21
|
+
new URL(host);
|
|
22
|
+
} catch {
|
|
23
|
+
throw new Error(`Invalid host URL: ${host}`);
|
|
24
|
+
}
|
|
25
|
+
const baseUrl = `${host.replace(/(.*)\/$/, "$1")}/bmdb/api/${version}/`;
|
|
20
26
|
const client = createFetchClient({
|
|
21
27
|
baseUrl,
|
|
22
28
|
querySerializer: { array: { style: "form", explode: false } },
|