@biblioteksentralen/bmdb-search 0.0.0-beta.5 → 0.0.0-beta.6
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/dist/index.cjs +12 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +12 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,17 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
6
6
|
|
|
7
7
|
var createFetchClient__default = /*#__PURE__*/_interopDefault(createFetchClient);
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// ../api-specifications/dist/utils/formatIsbdTitle.js
|
|
10
|
+
var formatIsbdTitle = (data, options = {}) => {
|
|
11
|
+
const { title, parallelTitles = [] } = data;
|
|
12
|
+
if (title.titleType === "uniform_title_music") {
|
|
13
|
+
return formatUniformTitleMusic(title);
|
|
14
|
+
} else {
|
|
15
|
+
return [title, ...parallelTitles].map((title2) => formatSingleTitle(title2, options)).join(" = ");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var formatSingleTitle = ({ mainTitle, subtitle, partNumber, partTitle }, options) => mainTitle + (subtitle && !options.skipSubtitle ? ` : ${subtitle}` : "") + (partNumber ? `. ${partNumber}` : "") + (partTitle ? `. ${partTitle}` : "");
|
|
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}` : "");
|
|
10
20
|
var createBmdbFetchClient = ({
|
|
11
21
|
clientIdentifier,
|
|
12
22
|
version = "v1",
|
|
@@ -28,3 +38,4 @@ var createBmdbFetchClient = ({
|
|
|
28
38
|
};
|
|
29
39
|
|
|
30
40
|
exports.createBmdbFetchClient = createBmdbFetchClient;
|
|
41
|
+
exports.formatIsbdTitle = formatIsbdTitle;
|
package/dist/index.d.cts
CHANGED
|
@@ -1133,6 +1133,19 @@ interface operations {
|
|
|
1133
1133
|
};
|
|
1134
1134
|
}
|
|
1135
1135
|
|
|
1136
|
+
type BmdbApiSchemas$1 = components["schemas"];
|
|
1137
|
+
|
|
1138
|
+
type TitleLike = Pick<BmdbApiSchemas$1["Title"], "mainTitle" | "subtitle" | "partNumber" | "partTitle" | "titleType">;
|
|
1139
|
+
type UniformTitleMusicLike = Pick<BmdbApiSchemas$1["UniformTitleMusic"], "titleType" | "form" | "instrumentation" | "serialNumber" | "opusNumber" | "thematicCatalogueNumber" | "part" | "key" | "arrangement">;
|
|
1140
|
+
type FormatIsbdTitleProps = {
|
|
1141
|
+
title: TitleLike | UniformTitleMusicLike;
|
|
1142
|
+
parallelTitles?: TitleLike[];
|
|
1143
|
+
};
|
|
1144
|
+
type FormatIsbdTitleOptions = {
|
|
1145
|
+
skipSubtitle?: boolean;
|
|
1146
|
+
};
|
|
1147
|
+
declare const formatIsbdTitle: (data: FormatIsbdTitleProps, options?: FormatIsbdTitleOptions) => string;
|
|
1148
|
+
|
|
1136
1149
|
type BmdbApiSchemas = components["schemas"];
|
|
1137
1150
|
type BmdbApiPaths = paths;
|
|
1138
1151
|
|
|
@@ -1147,4 +1160,4 @@ type BmdbWork = BmdbApiSchemas["Work"];
|
|
|
1147
1160
|
type BmdbExpression = BmdbApiSchemas["Expression"];
|
|
1148
1161
|
type BmdbManifestation = BmdbApiSchemas["Manifestation"];
|
|
1149
1162
|
|
|
1150
|
-
export { type BmdbExpression, type BmdbManifestation, type BmdbSearchClient, type BmdbSearchClientOptions, type BmdbWork, createBmdbFetchClient };
|
|
1163
|
+
export { type BmdbExpression, type BmdbManifestation, type BmdbSearchClient, type BmdbSearchClientOptions, type BmdbWork, createBmdbFetchClient, formatIsbdTitle };
|
package/dist/index.d.ts
CHANGED
|
@@ -1133,6 +1133,19 @@ interface operations {
|
|
|
1133
1133
|
};
|
|
1134
1134
|
}
|
|
1135
1135
|
|
|
1136
|
+
type BmdbApiSchemas$1 = components["schemas"];
|
|
1137
|
+
|
|
1138
|
+
type TitleLike = Pick<BmdbApiSchemas$1["Title"], "mainTitle" | "subtitle" | "partNumber" | "partTitle" | "titleType">;
|
|
1139
|
+
type UniformTitleMusicLike = Pick<BmdbApiSchemas$1["UniformTitleMusic"], "titleType" | "form" | "instrumentation" | "serialNumber" | "opusNumber" | "thematicCatalogueNumber" | "part" | "key" | "arrangement">;
|
|
1140
|
+
type FormatIsbdTitleProps = {
|
|
1141
|
+
title: TitleLike | UniformTitleMusicLike;
|
|
1142
|
+
parallelTitles?: TitleLike[];
|
|
1143
|
+
};
|
|
1144
|
+
type FormatIsbdTitleOptions = {
|
|
1145
|
+
skipSubtitle?: boolean;
|
|
1146
|
+
};
|
|
1147
|
+
declare const formatIsbdTitle: (data: FormatIsbdTitleProps, options?: FormatIsbdTitleOptions) => string;
|
|
1148
|
+
|
|
1136
1149
|
type BmdbApiSchemas = components["schemas"];
|
|
1137
1150
|
type BmdbApiPaths = paths;
|
|
1138
1151
|
|
|
@@ -1147,4 +1160,4 @@ type BmdbWork = BmdbApiSchemas["Work"];
|
|
|
1147
1160
|
type BmdbExpression = BmdbApiSchemas["Expression"];
|
|
1148
1161
|
type BmdbManifestation = BmdbApiSchemas["Manifestation"];
|
|
1149
1162
|
|
|
1150
|
-
export { type BmdbExpression, type BmdbManifestation, type BmdbSearchClient, type BmdbSearchClientOptions, type BmdbWork, createBmdbFetchClient };
|
|
1163
|
+
export { type BmdbExpression, type BmdbManifestation, type BmdbSearchClient, type BmdbSearchClientOptions, type BmdbWork, createBmdbFetchClient, formatIsbdTitle };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import createFetchClient from 'openapi-fetch';
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// ../api-specifications/dist/utils/formatIsbdTitle.js
|
|
4
|
+
var formatIsbdTitle = (data, options = {}) => {
|
|
5
|
+
const { title, parallelTitles = [] } = data;
|
|
6
|
+
if (title.titleType === "uniform_title_music") {
|
|
7
|
+
return formatUniformTitleMusic(title);
|
|
8
|
+
} else {
|
|
9
|
+
return [title, ...parallelTitles].map((title2) => formatSingleTitle(title2, options)).join(" = ");
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var formatSingleTitle = ({ mainTitle, subtitle, partNumber, partTitle }, options) => mainTitle + (subtitle && !options.skipSubtitle ? ` : ${subtitle}` : "") + (partNumber ? `. ${partNumber}` : "") + (partTitle ? `. ${partTitle}` : "");
|
|
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}` : "");
|
|
4
14
|
var createBmdbFetchClient = ({
|
|
5
15
|
clientIdentifier,
|
|
6
16
|
version = "v1",
|
|
@@ -21,4 +31,4 @@ var createBmdbFetchClient = ({
|
|
|
21
31
|
return client;
|
|
22
32
|
};
|
|
23
33
|
|
|
24
|
-
export { createBmdbFetchClient };
|
|
34
|
+
export { createBmdbFetchClient, formatIsbdTitle };
|