@biblioteksentralen/bmdb-search 0.0.0-beta.4 → 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 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
- // src/client.ts
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
@@ -1018,6 +1018,9 @@ interface components {
1018
1018
  /** @description Specifies the material that accompanyies the item, typically of document type "Combined document" or "Language Course" */
1019
1019
  accompanyingMaterial?: string;
1020
1020
  notes?: components["schemas"]["Note"][];
1021
+ kulturfond?: {
1022
+ status: boolean;
1023
+ };
1021
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.
1022
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.
1023
1026
  * Examples:
@@ -1130,6 +1133,19 @@ interface operations {
1130
1133
  };
1131
1134
  }
1132
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
+
1133
1149
  type BmdbApiSchemas = components["schemas"];
1134
1150
  type BmdbApiPaths = paths;
1135
1151
 
@@ -1144,4 +1160,4 @@ type BmdbWork = BmdbApiSchemas["Work"];
1144
1160
  type BmdbExpression = BmdbApiSchemas["Expression"];
1145
1161
  type BmdbManifestation = BmdbApiSchemas["Manifestation"];
1146
1162
 
1147
- 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
@@ -1018,6 +1018,9 @@ interface components {
1018
1018
  /** @description Specifies the material that accompanyies the item, typically of document type "Combined document" or "Language Course" */
1019
1019
  accompanyingMaterial?: string;
1020
1020
  notes?: components["schemas"]["Note"][];
1021
+ kulturfond?: {
1022
+ status: boolean;
1023
+ };
1021
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.
1022
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.
1023
1026
  * Examples:
@@ -1130,6 +1133,19 @@ interface operations {
1130
1133
  };
1131
1134
  }
1132
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
+
1133
1149
  type BmdbApiSchemas = components["schemas"];
1134
1150
  type BmdbApiPaths = paths;
1135
1151
 
@@ -1144,4 +1160,4 @@ type BmdbWork = BmdbApiSchemas["Work"];
1144
1160
  type BmdbExpression = BmdbApiSchemas["Expression"];
1145
1161
  type BmdbManifestation = BmdbApiSchemas["Manifestation"];
1146
1162
 
1147
- 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
- // src/client.ts
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biblioteksentralen/bmdb-search",
3
- "version": "0.0.0-beta.4",
3
+ "version": "0.0.0-beta.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Client for searching Bibliotekenes metadatabrønn (BMDB)",