@natlibfi/melinda-commons 12.0.4 → 12.0.5

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.
@@ -62,7 +62,7 @@ jobs:
62
62
  # Setup .npmrc file to publish to npm
63
63
  - uses: actions/setup-node@v3
64
64
  with:
65
- node-version: '14.x'
65
+ node-version: '16.x'
66
66
  registry-url: 'https://registry.npmjs.org'
67
67
  - run: npm ci
68
68
  - run: npm publish
package/dist/error.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /**
9
8
  *
10
9
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -32,19 +31,16 @@ exports.default = void 0;
32
31
  * for the JavaScript code in this file.
33
32
  *
34
33
  */
34
+
35
35
  class _default extends Error {
36
36
  constructor(status, payload) {
37
37
  for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
38
38
  params[_key - 2] = arguments[_key];
39
39
  }
40
-
41
40
  super(params);
42
41
  this.status = status; // eslint-disable-line functional/no-this-expression
43
-
44
42
  this.payload = payload; // eslint-disable-line functional/no-this-expression
45
43
  }
46
-
47
44
  }
48
-
49
45
  exports.default = _default;
50
46
  //# sourceMappingURL=error.js.map
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","names":["Error","constructor","status","payload","params"],"sources":["../src/error.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default class extends Error {\n constructor(status, payload, ...params) {\n super(params);\n this.status = status; // eslint-disable-line functional/no-this-expression\n this.payload = payload; // eslint-disable-line functional/no-this-expression\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEe,uBAAcA,KAAd,CAAoB;EACjCC,WAAW,CAACC,MAAD,EAASC,OAAT,EAA6B;IAAA,kCAARC,MAAQ;MAARA,MAAQ;IAAA;;IACtC,MAAMA,MAAN;IACA,KAAKF,MAAL,GAAcA,MAAd,CAFsC,CAEhB;;IACtB,KAAKC,OAAL,GAAeA,OAAf,CAHsC,CAGd;EACzB;;AALgC"}
1
+ {"version":3,"file":"error.js","names":["Error","constructor","status","payload","params"],"sources":["../src/error.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default class extends Error {\n constructor(status, payload, ...params) {\n super(params);\n this.status = status; // eslint-disable-line functional/no-this-expression\n this.payload = payload; // eslint-disable-line functional/no-this-expression\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEe,uBAAcA,KAAK,CAAC;EACjCC,WAAW,CAACC,MAAM,EAAEC,OAAO,EAAa;IAAA,kCAARC,MAAM;MAANA,MAAM;IAAA;IACpC,KAAK,CAACA,MAAM,CAAC;IACb,IAAI,CAACF,MAAM,GAAGA,MAAM,CAAC,CAAC;IACtB,IAAI,CAACC,OAAO,GAAGA,OAAO,CAAC,CAAC;EAC1B;AACF;AAAC"}
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _chai = require("chai");
6
-
7
5
  var _error = _interopRequireDefault(require("./error"));
8
-
9
6
  /**
10
7
  *
11
8
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -33,6 +30,7 @@ var _error = _interopRequireDefault(require("./error"));
33
30
  * for the JavaScript code in this file.
34
31
  *
35
32
  */
33
+
36
34
  describe('error', () => {
37
35
  it('Should construct the expected instance', () => {
38
36
  const error = new _error.default(200, 'foobar');
@@ -1 +1 @@
1
- {"version":3,"file":"error.spec.js","names":["describe","it","error","CommonsError","expect","to","be","an","instanceOf","Error","status","equal","payload"],"sources":["../src/error.spec.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {expect} from 'chai';\nimport CommonsError from './error';\n\ndescribe('error', () => {\n it('Should construct the expected instance', () => {\n const error = new CommonsError(200, 'foobar');\n\n expect(error).to.be.an.instanceOf(Error);\n expect(error.status).to.equal(200);\n expect(error.payload).to.equal('foobar');\n });\n});\n"],"mappings":";;;;AA4BA;;AACA;;AA7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKAA,QAAQ,CAAC,OAAD,EAAU,MAAM;EACtBC,EAAE,CAAC,wCAAD,EAA2C,MAAM;IACjD,MAAMC,KAAK,GAAG,IAAIC,cAAJ,CAAiB,GAAjB,EAAsB,QAAtB,CAAd;IAEA,IAAAC,YAAA,EAAOF,KAAP,EAAcG,EAAd,CAAiBC,EAAjB,CAAoBC,EAApB,CAAuBC,UAAvB,CAAkCC,KAAlC;IACA,IAAAL,YAAA,EAAOF,KAAK,CAACQ,MAAb,EAAqBL,EAArB,CAAwBM,KAAxB,CAA8B,GAA9B;IACA,IAAAP,YAAA,EAAOF,KAAK,CAACU,OAAb,EAAsBP,EAAtB,CAAyBM,KAAzB,CAA+B,QAA/B;EACD,CANC,CAAF;AAOD,CARO,CAAR"}
1
+ {"version":3,"file":"error.spec.js","names":["describe","it","error","CommonsError","expect","to","be","an","instanceOf","Error","status","equal","payload"],"sources":["../src/error.spec.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {expect} from 'chai';\nimport CommonsError from './error';\n\ndescribe('error', () => {\n it('Should construct the expected instance', () => {\n const error = new CommonsError(200, 'foobar');\n\n expect(error).to.be.an.instanceOf(Error);\n expect(error.status).to.equal(200);\n expect(error.payload).to.equal('foobar');\n });\n});\n"],"mappings":";;;AA4BA;AACA;AA7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKAA,QAAQ,CAAC,OAAO,EAAE,MAAM;EACtBC,EAAE,CAAC,wCAAwC,EAAE,MAAM;IACjD,MAAMC,KAAK,GAAG,IAAIC,cAAY,CAAC,GAAG,EAAE,QAAQ,CAAC;IAE7C,IAAAC,YAAM,EAACF,KAAK,CAAC,CAACG,EAAE,CAACC,EAAE,CAACC,EAAE,CAACC,UAAU,CAACC,KAAK,CAAC;IACxC,IAAAL,YAAM,EAACF,KAAK,CAACQ,MAAM,CAAC,CAACL,EAAE,CAACM,KAAK,CAAC,GAAG,CAAC;IAClC,IAAAP,YAAM,EAACF,KAAK,CAACU,OAAO,CAAC,CAACP,EAAE,CAACM,KAAK,CAAC,QAAQ,CAAC;EAC1C,CAAC,CAAC;AACJ,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -21,13 +20,9 @@ Object.defineProperty(exports, "createSubrecordPicker", {
21
20
  return _subRecordPicker.createSubrecordPicker;
22
21
  }
23
22
  });
24
-
25
23
  var _marcRecord = require("@natlibfi/marc-record");
26
-
27
24
  var _subRecordPicker = require("./subRecordPicker");
28
-
29
25
  var _utils = require("./utils");
30
-
31
26
  Object.keys(_utils).forEach(function (key) {
32
27
  if (key === "default" || key === "__esModule") return;
33
28
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -39,9 +34,7 @@ Object.keys(_utils).forEach(function (key) {
39
34
  }
40
35
  });
41
36
  });
42
-
43
37
  var _error = _interopRequireDefault(require("./error"));
44
-
45
38
  /**
46
39
  *
47
40
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -69,6 +62,7 @@ var _error = _interopRequireDefault(require("./error"));
69
62
  * for the JavaScript code in this file.
70
63
  *
71
64
  */
65
+
72
66
  // Aleph creates partial subfields...
73
67
  _marcRecord.MarcRecord.setValidationOptions({
74
68
  subfieldValues: false
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["MarcRecord","setValidationOptions","subfieldValues"],"sources":["../src/index.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {MarcRecord} from '@natlibfi/marc-record';\n\n// Aleph creates partial subfields...\nMarcRecord.setValidationOptions({subfieldValues: false});\n\nimport {createSubrecordPicker} from './subRecordPicker';\n\nexport * from './utils';\n\nexport {default as Error} from './error';\nexport {createSubrecordPicker};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA;;AAKA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AArCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACAA,sBAAA,CAAWC,oBAAX,CAAgC;EAACC,cAAc,EAAE;AAAjB,CAAhC"}
1
+ {"version":3,"file":"index.js","names":["MarcRecord","setValidationOptions","subfieldValues"],"sources":["../src/index.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {MarcRecord} from '@natlibfi/marc-record';\n\n// Aleph creates partial subfields...\nMarcRecord.setValidationOptions({subfieldValues: false});\n\nimport {createSubrecordPicker} from './subRecordPicker';\n\nexport * from './utils';\n\nexport {default as Error} from './error';\nexport {createSubrecordPicker};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BA;AAKA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;AArCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACAA,sBAAU,CAACC,oBAAoB,CAAC;EAACC,cAAc,EAAE;AAAK,CAAC,CAAC"}
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSubrecordPicker = createSubrecordPicker;
9
-
10
8
  var _sruClient = _interopRequireDefault(require("@natlibfi/sru-client"));
11
-
12
9
  var _marcRecordSerializers = require("@natlibfi/marc-record-serializers");
13
-
14
10
  var _debug = _interopRequireDefault(require("debug"));
15
-
16
11
  var _error = require("./error");
17
-
18
12
  /**
19
13
  *
20
14
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -42,14 +36,13 @@ var _error = require("./error");
42
36
  * for the JavaScript code in this file.
43
37
  *
44
38
  */
39
+
45
40
  function createSubrecordPicker(sruUrl) {
46
41
  let retrieveAll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
47
-
48
42
  if (sruUrl === undefined) {
49
43
  // eslint-disable-line functional/no-conditional-statement
50
44
  throw new _error.Error(400, 'Invalid sru url');
51
45
  }
52
-
53
46
  const debug = (0, _debug.default)('@natlibfi/melinda-commons:subRecordPicker');
54
47
  debug(`SRU client url: ${sruUrl}`);
55
48
  const sruClient = (0, _sruClient.default)({
@@ -61,7 +54,6 @@ function createSubrecordPicker(sruUrl) {
61
54
  readSomeSubrecords,
62
55
  readAllSubrecords
63
56
  };
64
-
65
57
  function readSomeSubrecords(recordId) {
66
58
  let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
67
59
  debug(`Picking subrecords for ${recordId}`);
@@ -86,7 +78,6 @@ function createSubrecordPicker(sruUrl) {
86
78
  }).on('error', err => reject(err));
87
79
  });
88
80
  }
89
-
90
81
  function readAllSubrecords(recordId) {
91
82
  debug(`Picking subrecords for ${recordId}`);
92
83
  return new Promise((resolve, reject) => {
@@ -1 +1 @@
1
- {"version":3,"file":"subRecordPicker.js","names":["createSubrecordPicker","sruUrl","retrieveAll","undefined","ApiError","debug","createDebugLogger","sruClient","createSruClient","url","recordSchema","readSomeSubrecords","readAllSubrecords","recordId","offset","Promise","resolve","reject","promises","searchRetrieve","startRecord","on","xmlString","push","MARCXML","from","subfieldValues","nextRecordOffset","records","all","error","err"],"sources":["../src/subRecordPicker.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createSruClient from '@natlibfi/sru-client';\nimport {MARCXML} from '@natlibfi/marc-record-serializers';\nimport createDebugLogger from 'debug';\nimport {Error as ApiError} from './error';\n\nexport function createSubrecordPicker(sruUrl, retrieveAll = false) {\n if (sruUrl === undefined) { // eslint-disable-line functional/no-conditional-statement\n throw new ApiError(400, 'Invalid sru url');\n }\n\n const debug = createDebugLogger('@natlibfi/melinda-commons:subRecordPicker');\n debug(`SRU client url: ${sruUrl}`);\n const sruClient = createSruClient({url: sruUrl, recordSchema: 'marcxml', retrieveAll});\n\n return {readSomeSubrecords, readAllSubrecords};\n\n function readSomeSubrecords(recordId, offset = 1) {\n debug(`Picking subrecords for ${recordId}`);\n return new Promise((resolve, reject) => {\n const promises = [];\n sruClient.searchRetrieve(`melinda.partsofhost=${recordId}`, {startRecord: offset})\n .on('record', xmlString => {\n promises.push(MARCXML.from(xmlString, {subfieldValues: false})); // eslint-disable-line functional/immutable-data\n })\n .on('end', async nextRecordOffset => {\n try {\n const records = await Promise.all(promises);\n resolve({nextRecordOffset, records});\n } catch (error) {\n reject(error);\n }\n })\n .on('error', err => reject(err));\n });\n }\n\n function readAllSubrecords(recordId) {\n debug(`Picking subrecords for ${recordId}`);\n return new Promise((resolve, reject) => {\n const promises = [];\n sruClient.searchRetrieve(`melinda.partsofhost=${recordId}`)\n .on('record', xmlString => {\n promises.push(MARCXML.from(xmlString, {subfieldValues: false})); // eslint-disable-line functional/immutable-data\n })\n .on('end', async () => {\n try {\n const records = await Promise.all(promises);\n resolve({records});\n } catch (error) {\n reject(error);\n }\n })\n .on('error', err => reject(err));\n });\n }\n}\n"],"mappings":";;;;;;;;;AA4BA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOO,SAASA,qBAAT,CAA+B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OAZN,EAYeU,GAAG,IAAId,MAAM,CAACc,GAAD,CAZ5B;IAaD,CAfM,CAAP;EAgBD;;EAED,SAASnB,iBAAT,CAA2BC,QAA3B,EAAqC;IACnCR,KAAK,CAAE,0BAAyBQ,QAAS,EAApC,CAAL;IACA,OAAO,IAAIE,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;MACtC,MAAMC,QAAQ,GAAG,EAAjB;MACAX,SAAS,CAACY,cAAV,CAA0B,uBAAsBN,QAAS,EAAzD,EACGQ,EADH,CACM,QADN,EACgBC,SAAS,IAAI;QACzBJ,QAAQ,CAACK,IAAT,CAAcC,8BAAA,CAAQC,IAAR,CAAaH,SAAb,EAAwB;UAACI,cAAc,EAAE;QAAjB,CAAxB,CAAd,EADyB,CACwC;MAClE,CAHH,EAIGL,EAJH,CAIM,KAJN,EAIa,YAAY;QACrB,IAAI;UACF,MAAMO,OAAO,GAAG,MAAMb,OAAO,CAACc,GAAR,CAAYX,QAAZ,CAAtB;UACAF,OAAO,CAAC;YAACY;UAAD,CAAD,CAAP;QACD,CAHD,CAGE,OAAOE,KAAP,EAAc;UACdb,MAAM,CAACa,KAAD,CAAN;QACD;MACF,CAXH,EAYGT,EAZH,CAYM,OAZN,EAYeU,GAAG,IAAId,MAAM,CAACc,GAAD,CAZ5B;IAaD,CAfM,CAAP;EAgBD;AACF"}
1
+ {"version":3,"file":"subRecordPicker.js","names":["createSubrecordPicker","sruUrl","retrieveAll","undefined","ApiError","debug","createDebugLogger","sruClient","createSruClient","url","recordSchema","readSomeSubrecords","readAllSubrecords","recordId","offset","Promise","resolve","reject","promises","searchRetrieve","startRecord","on","xmlString","push","MARCXML","from","subfieldValues","nextRecordOffset","records","all","error","err"],"sources":["../src/subRecordPicker.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createSruClient from '@natlibfi/sru-client';\nimport {MARCXML} from '@natlibfi/marc-record-serializers';\nimport createDebugLogger from 'debug';\nimport {Error as ApiError} from './error';\n\nexport function createSubrecordPicker(sruUrl, retrieveAll = false) {\n if (sruUrl === undefined) { // eslint-disable-line functional/no-conditional-statement\n throw new ApiError(400, 'Invalid sru url');\n }\n\n const debug = createDebugLogger('@natlibfi/melinda-commons:subRecordPicker');\n debug(`SRU client url: ${sruUrl}`);\n const sruClient = createSruClient({url: sruUrl, recordSchema: 'marcxml', retrieveAll});\n\n return {readSomeSubrecords, readAllSubrecords};\n\n function readSomeSubrecords(recordId, offset = 1) {\n debug(`Picking subrecords for ${recordId}`);\n return new Promise((resolve, reject) => {\n const promises = [];\n sruClient.searchRetrieve(`melinda.partsofhost=${recordId}`, {startRecord: offset})\n .on('record', xmlString => {\n promises.push(MARCXML.from(xmlString, {subfieldValues: false})); // eslint-disable-line functional/immutable-data\n })\n .on('end', async nextRecordOffset => {\n try {\n const records = await Promise.all(promises);\n resolve({nextRecordOffset, records});\n } catch (error) {\n reject(error);\n }\n })\n .on('error', err => reject(err));\n });\n }\n\n function readAllSubrecords(recordId) {\n debug(`Picking subrecords for ${recordId}`);\n return new Promise((resolve, reject) => {\n const promises = [];\n sruClient.searchRetrieve(`melinda.partsofhost=${recordId}`)\n .on('record', xmlString => {\n promises.push(MARCXML.from(xmlString, {subfieldValues: false})); // eslint-disable-line functional/immutable-data\n })\n .on('end', async () => {\n try {\n const records = await Promise.all(promises);\n resolve({records});\n } catch (error) {\n reject(error);\n }\n })\n .on('error', err => reject(err));\n });\n }\n}\n"],"mappings":";;;;;;;AA4BA;AACA;AACA;AACA;AA/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOO,SAASA,qBAAqB,CAACC,MAAM,EAAuB;EAAA,IAArBC,WAAW,uEAAG,KAAK;EAC/D,IAAID,MAAM,KAAKE,SAAS,EAAE;IAAE;IAC1B,MAAM,IAAIC,YAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;EAC5C;EAEA,MAAMC,KAAK,GAAG,IAAAC,cAAiB,EAAC,2CAA2C,CAAC;EAC5ED,KAAK,CAAE,mBAAkBJ,MAAO,EAAC,CAAC;EAClC,MAAMM,SAAS,GAAG,IAAAC,kBAAe,EAAC;IAACC,GAAG,EAAER,MAAM;IAAES,YAAY,EAAE,SAAS;IAAER;EAAW,CAAC,CAAC;EAEtF,OAAO;IAACS,kBAAkB;IAAEC;EAAiB,CAAC;EAE9C,SAASD,kBAAkB,CAACE,QAAQ,EAAc;IAAA,IAAZC,MAAM,uEAAG,CAAC;IAC9CT,KAAK,CAAE,0BAAyBQ,QAAS,EAAC,CAAC;IAC3C,OAAO,IAAIE,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,MAAMC,QAAQ,GAAG,EAAE;MACnBX,SAAS,CAACY,cAAc,CAAE,uBAAsBN,QAAS,EAAC,EAAE;QAACO,WAAW,EAAEN;MAAM,CAAC,CAAC,CAC/EO,EAAE,CAAC,QAAQ,EAAEC,SAAS,IAAI;QACzBJ,QAAQ,CAACK,IAAI,CAACC,8BAAO,CAACC,IAAI,CAACH,SAAS,EAAE;UAACI,cAAc,EAAE;QAAK,CAAC,CAAC,C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ict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _chai = require("chai");
6
-
7
5
  var _subRecordPicker = require("./subRecordPicker");
8
-
9
6
  var _fixura = require("@natlibfi/fixura");
10
-
11
7
  var _fixugenHttpClient = _interopRequireDefault(require("@natlibfi/fixugen-http-client"));
12
-
13
8
  /**
14
9
  *
15
10
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -37,6 +32,7 @@ var _fixugenHttpClient = _interopRequireDefault(require("@natlibfi/fixugen-http-
37
32
  * for the JavaScript code in this file.
38
33
  *
39
34
  */
35
+
40
36
  describe('subRecordPicker', () => {
41
37
  const sruUrl = 'https://sru';
42
38
  const retrieveAll = false;
@@ -59,7 +55,6 @@ describe('subRecordPicker', () => {
59
55
  callback,
60
56
  path: [__dirname, '..', 'test-fixtures', 'subRecordPicker']
61
57
  });
62
-
63
58
  async function callback(_ref) {
64
59
  let {
65
60
  getFixture,
@@ -77,7 +72,6 @@ describe('subRecordPicker', () => {
77
72
  records
78
73
  } = await client[method](recordId);
79
74
  (0, _chai.expect)(format()).to.eql(expectedRecords);
80
-
81
75
  function format() {
82
76
  return records.map(r => r.toObject());
83
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"subRecordPicker.spec.js","names":["describe","sruUrl","retrieveAll","it","client","createSubrecordPicker","expect","to","respondTo","throw","generateTests","callback","path","__dirname","getFixture","method","recordId","expectedRecords","components","reader","READERS","JSON","records","format","eql","map","r","toObject"],"sources":["../src/subRecordPicker.spec.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {expect} from 'chai';\nimport {createSubrecordPicker} from './subRecordPicker';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen-http-client';\n\ndescribe('subRecordPicker', () => {\n const sruUrl = 'https://sru';\n const retrieveAll = false;\n\n describe('createSubrecordPicker', () => {\n it('Client should have methods', () => {\n const client = createSubrecordPicker(sruUrl, retrieveAll);\n expect(client).to.respondTo('readAllSubrecords');\n expect(client).to.respondTo('readSomeSubrecords');\n });\n\n it('Create client should work with just one parametter', () => {\n const client = createSubrecordPicker(sruUrl);\n expect(client).to.respondTo('readAllSubrecords');\n expect(client).to.respondTo('readSomeSubrecords');\n });\n\n it('Create client should have at least one parametter', () => {\n expect(createSubrecordPicker).to.throw();\n });\n });\n\n generateTests({\n callback,\n path: [__dirname, '..', 'test-fixtures', 'subRecordPicker']\n });\n\n async function callback({getFixture, method, sruUrl, retrieveAll, recordId}) {\n const client = createSubrecordPicker(sruUrl, retrieveAll);\n const expectedRecords = getFixture({components: ['expected-records.json'], reader: READERS.JSON});\n const {records} = await client[method](recordId);\n\n expect(format()).to.eql(expectedRecords);\n\n function format() {\n return records.map(r => r.toObject());\n }\n }\n});\n"],"mappings":";;;;AA4BA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOAA,QAAQ,CAAC,iBAAD,EAAoB,MAAM;EAChC,MAAMC,MAAM,GAAG,aAAf;EACA,MAAMC,WAAW,GAAG,K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AMlB,MAAM,CAACW,MAAD,CAAN,CAAeC,QAAf,CAAxB;IAEA,IAAAV,YAAA,EAAOiB,MAAM,EAAb,EAAiBhB,EAAjB,CAAoBiB,GAApB,CAAwBP,eAAxB;;IAEA,SAASM,MAAT,GAAkB;MAChB,OAAOD,OAAO,CAACG,GAAR,CAAYC,CAAC,IAAIA,CAAC,CAACC,QAAF,EAAjB,CAAP;IACD;EACF;AACF,CAtCO,CAAR"}
1
+ {"version":3,"file":"subRecordPicker.spec.js","names":["describe","sruUrl","retrieveAll","it","client","createSubrecordPicker","expect","to","respondTo","throw","generateTests","callback","path","__dirname","getFixture","method","recordId","expectedRecords","components","reader","READERS","JSON","records","format","eql","map","r","toObject"],"sources":["../src/subRecordPicker.spec.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {expect} from 'chai';\nimport {createSubrecordPicker} from './subRecordPicker';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen-http-client';\n\ndescribe('subRecordPicker', () => {\n const sruUrl = 'https://sru';\n const retrieveAll = false;\n\n describe('createSubrecordPicker', () => {\n it('Client should have methods', () => {\n const client = createSubrecordPicker(sruUrl, retrieveAll);\n expect(client).to.respondTo('readAllSubrecords');\n expect(client).to.respondTo('readSomeSubrecords');\n });\n\n it('Create client should work with just one parametter', () => {\n const client = createSubrecordPicker(sruUrl);\n expect(client).to.respondTo('readAllSubrecords');\n expect(client).to.respondTo('readSomeSubrecords');\n });\n\n it('Create client should have at least one parametter', () => {\n expect(createSubrecordPicker).to.throw();\n });\n });\n\n generateTests({\n callback,\n path: [__dirname, '..', 'test-fixtures', 'subRecordPicker']\n });\n\n async function callback({getFixture, method, sruUrl, retrieveAll, recordId}) {\n const client = createSubrecordPicker(sruUrl, retrieveAll);\n const expectedRecords = getFixture({components: ['expected-records.json'], reader: READERS.JSON});\n const {records} = await client[method](recordId);\n\n expect(format()).to.eql(expectedRecords);\n\n function format() {\n return records.map(r => r.toObject());\n }\n }\n});\n"],"mappings":";;;AA4BA;AACA;AACA;AACA;AA/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOAA,QAAQ,CAAC,iBAAiB,EAAE,MAAM;EAChC,MAAMC,MAAM,GAAG,aAAa;EAC5B,MAAMC,WAAW,GAAG,KAAK;EAEzBF,QAAQ,CAAC,uBAAuB,EAAE,MAAM;IACtCG,EAAE,CAAC,4BAA4B,EAAE,MAAM;MACrC,MAAMC,MAAM,GAAG,IAAAC,sCAAqB,EAACJ,MAAM,EAAEC,WAAW,CAAC;MACzD,IAAAI,YAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,SAAS,CAAC,mBAAmB,CAAC;MAChD,IAAAF,YAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,SAAS,CAAC,oBAAoB,CAAC;IACnD,CAAC,CAAC;IAEFL,EAAE,CAAC,oDAAoD,EAAE,MAAM;MAC7D,MAAMC,MAAM,GAAG,IAAAC,sCAAqB,EAACJ,MAAM,CAAC;MAC5C,IAAAK,YAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,SAAS,CAAC,mBAAmB,CAAC;MAChD,IAAAF,YAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,SAAS,CAAC,oBAAoB,CAAC;IACnD,CAAC,CAAC;IAEFL,EAAE,CAAC,mDAAmD,EAAE,MAAM;MAC5D,IAAAG,YAAM,EAACD,sCAAqB,CAAC,CAACE,EAAE,CAACE,KAAK,EAAE;IAC1C,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,IAAAC,0BAAa,EAAC;IACZC,QAAQ;IACRC,IAAI,EAAE,CAACC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,iBAAiB;EAC5D,CAAC,CAAC;EAEF,eAAeF,QAAQ,OAAsD;IAAA,IAArD;MAACG,UAAU;MAAEC,MAAM;MAAEd,MAAM;MAAEC,WAAW;MAAEc;IAAQ,CAAC;IACzE,MAAMZ,MAAM,GAAG,IAAAC,sCAAqB,EAACJ,MAAM,EAAEC,WAAW,CAAC;IACzD,MAAMe,eAAe,GAAGH,UAAU,CAAC;MAACI,UAAU,EAAE,CAAC,uBAAuB,CAAC;MAAEC,MAAM,EAAEC,eAAO,CAACC;IAAI,CAAC,CAAC;IACjG,MAAM;MAACC;IAAO,CAAC,GAAG,MAAMlB,MAAM,CAACW,MAAM,CAAC,CAACC,QAAQ,CAAC;IAEhD,IAAAV,YAAM,EAACiB,MAAM,EAAE,CAAC,CAAChB,EAAE,CAACiB,GAAG,CAACP,eAAe,CAAC;IAExC,SAASM,MAAM,GAAG;MAChB,OAAOD,OAAO,CAACG,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,EAAE,CAAC;IACvC;EACF;AACF,CAAC,CAAC"}
package/dist/utils.js CHANGED
@@ -11,7 +11,6 @@ exports.getRecordTitle = getRecordTitle;
11
11
  exports.isDeletedRecord = isDeletedRecord;
12
12
  exports.parseBoolean = parseBoolean;
13
13
  exports.toAlephId = toAlephId;
14
-
15
14
  /**
16
15
  *
17
16
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -39,22 +38,19 @@ exports.toAlephId = toAlephId;
39
38
  * for the JavaScript code in this file.
40
39
  *
41
40
  */
41
+
42
42
  function generateAuthorizationHeader(username) {
43
43
  let password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
44
44
  const encoded = Buffer.from(`${username}:${password}`).toString('base64');
45
45
  return `Basic ${encoded}`;
46
46
  }
47
-
48
47
  function isDeletedRecord(record) {
49
48
  if (['d', 's', 'x'].includes(record.leader[5])) {
50
49
  return true;
51
50
  }
52
-
53
51
  return checkDel() || checkSta();
54
-
55
52
  function checkDel() {
56
53
  return record.get(/^DEL$/u).some(check);
57
-
58
54
  function check(_ref) {
59
55
  let {
60
56
  subfields
@@ -68,10 +64,8 @@ function isDeletedRecord(record) {
68
64
  });
69
65
  }
70
66
  }
71
-
72
67
  function checkSta() {
73
68
  return record.get(/^STA$/u).some(check);
74
-
75
69
  function check(_ref3) {
76
70
  let {
77
71
  subfields
@@ -87,45 +81,35 @@ function isDeletedRecord(record) {
87
81
  }
88
82
  }
89
83
  }
90
-
91
84
  function parseBoolean(value) {
92
85
  if (value === undefined) {
93
86
  return false;
94
87
  }
95
-
96
88
  if (Number.isNaN(Number(value))) {
97
89
  return value.length > 0 && !/^(?:false)$/ui.test(value);
98
90
  }
99
-
100
91
  return Boolean(Number(value));
101
92
  }
102
-
103
93
  function getRecordTitle(record) {
104
94
  const TRIM_PATTERN = '[?!.,(){}:;/ ]*';
105
95
  const field = record.get(/^245$/u).find(f => f.subfields.some(sf => sf.code === 'a'));
106
-
107
96
  if (field) {
108
97
  return field.subfields.find(sf => sf.code === 'a').value.replace(new RegExp(`^${TRIM_PATTERN}`, 'u'), '').replace(new RegExp(`${TRIM_PATTERN}$`, 'u'), '');
109
98
  }
110
-
111
99
  return '';
112
100
  }
113
-
114
101
  function getRecordStandardIdentifiers(record) {
115
102
  return record.get(/^(?<def>020|022|024)$/u).filter(f => f.subfields.some(sf => ['a', 'z'].includes(sf.code))).map(field => {
116
103
  const subfield = field.subfields.find(sf => ['a', 'z'].includes(sf.code));
117
104
  return subfield.value;
118
105
  });
119
106
  }
120
-
121
107
  function clone(o) {
122
108
  return JSON.parse(JSON.stringify(o));
123
109
  }
124
-
125
110
  function toAlephId(id) {
126
111
  return id.padStart(9, '0');
127
112
  }
128
-
129
113
  function fromAlephId(id) {
130
114
  return id.replace(/^0+/u, '');
131
115
  }
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["generateAuthorizationHeader","username","password","encoded","Buffer","from","toString","isDeletedRecord","record","includes","leader","checkDel","checkSta","get","some","check","subfields","code","value","values","parseBoolean","undefined","Number","isNaN","length","test","Boolean","getRecordTitle","TRIM_PATTERN","field","find","f","sf","replace","RegExp","getRecordStandardIdentifiers","filter","map","subfield","clone","o","JSON","parse","stringify","toAlephId","id","padStart","fromAlephId"],"sources":["../src/utils.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport function generateAuthorizationHeader(username, password = '') {\n const encoded = Buffer.from(`${username}:${password}`).toString('base64');\n return `Basic ${encoded}`;\n}\n\nexport function isDeletedRecord(record) {\n if (['d', 's', 'x'].includes(record.leader[5])) {\n return true;\n }\n\n return checkDel() || checkSta();\n\n function checkDel() {\n return record.get(/^DEL$/u).some(check);\n\n function check({subfields}) {\n return subfields.some(({code, value}) => code === 'a' && value === 'Y');\n }\n }\n\n function checkSta() {\n return record.get(/^STA$/u).some(check);\n\n function check({subfields}) {\n const values = ['DELETED', 'DELETED-SPLIT', 'DELETED-DEPRECATED'];\n return subfields.some(({code, value}) => code === 'a' && values.includes(value));\n }\n }\n}\n\nexport function parseBoolean(value) {\n if (value === undefined) {\n return false;\n }\n\n if (Number.isNaN(Number(value))) {\n return value.length > 0 && !(/^(?:false)$/ui).test(value);\n }\n\n return Boolean(Number(value));\n}\n\nexport function getRecordTitle(record) {\n const TRIM_PATTERN = '[?!.,(){}:;/ ]*';\n const field = record\n .get(/^245$/u)\n .find(f => f.subfields.some(sf => sf.code === 'a'));\n\n if (field) {\n return field.subfields.find(sf => sf.code === 'a').value\n .replace(new RegExp(`^${TRIM_PATTERN}`, 'u'), '')\n .replace(new RegExp(`${TRIM_PATTERN}$`, 'u'), '');\n }\n\n return '';\n}\n\nexport function getRecordStandardIdentifiers(record) {\n return record.get(/^(?<def>020|022|024)$/u)\n .filter(f => f.subfields.some(sf => ['a', 'z'].includes(sf.code)))\n .map(field => {\n const subfield = field.subfields.find(sf => ['a', 'z'].includes(sf.code));\n return subfield.value;\n });\n}\n\nexport function clone(o) {\n return JSON.parse(JSON.stringify(o));\n}\n\nexport function toAlephId(id) {\n return id.padStart(9, '0');\n}\n\nexport function fromAlephId(id) {\n return id.replace(/^0+/u, '');\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,SAASA,2BAAT,CAAqCC,QAArC,EAA8D;EAAA,IAAfC,QAAe,uEAAJ,EAAI;EACnE,MAAMC,OAAO,GAAGC,MAAM,CAACC,IAAP,CAAa,GAAEJ,QAA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,EAAWvB,QAAX,CAAoBuB,EAAE,CAACf,IAAvB,CAA3B,CAAjB;IACA,OAAOqB,QAAQ,CAACpB,KAAhB;EACD,CALI,CAAP;AAMD;;AAEM,SAASqB,KAAT,CAAeC,CAAf,EAAkB;EACvB,OAAOC,IAAI,CAACC,KAAL,CAAWD,IAAI,CAACE,SAAL,CAAeH,CAAf,CAAX,CAAP;AACD;;AAEM,SAASI,SAAT,CAAmBC,EAAnB,EAAuB;EAC5B,OAAOA,EAAE,CAACC,QAAH,CAAY,CAAZ,EAAe,GAAf,CAAP;AACD;;AAEM,SAASC,WAAT,CAAqBF,EAArB,EAAyB;EAC9B,OAAOA,EAAE,CAACZ,OAAH,CAAW,MAAX,EAAmB,EAAnB,CAAP;AACD"}
1
+ {"version":3,"file":"utils.js","names":["generateAuthorizationHeader","username","password","encoded","Buffer","from","toString","isDeletedRecord","record","includes","leader","checkDel","checkSta","get","some","check","subfields","code","value","values","parseBoolean","undefined","Number","isNaN","length","test","Boolean","getRecordTitle","TRIM_PATTERN","field","find","f","sf","replace","RegExp","getRecordStandardIdentifiers","filter","map","subfield","clone","o","JSON","parse","stringify","toAlephId","id","padStart","fromAlephId"],"sources":["../src/utils.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport function generateAuthorizationHeader(username, password = '') {\n const encoded = Buffer.from(`${username}:${password}`).toString('base64');\n return `Basic ${encoded}`;\n}\n\nexport function isDeletedRecord(record) {\n if (['d', 's', 'x'].includes(record.leader[5])) {\n return true;\n }\n\n return checkDel() || checkSta();\n\n function checkDel() {\n return record.get(/^DEL$/u).some(check);\n\n function check({subfields}) {\n return subfields.some(({code, value}) => code === 'a' && value === 'Y');\n }\n }\n\n function checkSta() {\n return record.get(/^STA$/u).some(check);\n\n function check({subfields}) {\n const values = ['DELETED', 'DELETED-SPLIT', 'DELETED-DEPRECATED'];\n return subfields.some(({code, value}) => code === 'a' && values.includes(value));\n }\n }\n}\n\nexport function parseBoolean(value) {\n if (value === undefined) {\n return false;\n }\n\n if (Number.isNaN(Number(value))) {\n return value.length > 0 && !(/^(?:false)$/ui).test(value);\n }\n\n return Boolean(Number(value));\n}\n\nexport function getRecordTitle(record) {\n const TRIM_PATTERN = '[?!.,(){}:;/ ]*';\n const field = record\n .get(/^245$/u)\n .find(f => f.subfields.some(sf => sf.code === 'a'));\n\n if (field) {\n return field.subfields.find(sf => sf.code === 'a').value\n .replace(new RegExp(`^${TRIM_PATTERN}`, 'u'), '')\n .replace(new RegExp(`${TRIM_PATTERN}$`, 'u'), '');\n }\n\n return '';\n}\n\nexport function getRecordStandardIdentifiers(record) {\n return record.get(/^(?<def>020|022|024)$/u)\n .filter(f => f.subfields.some(sf => ['a', 'z'].includes(sf.code)))\n .map(field => {\n const subfield = field.subfields.find(sf => ['a', 'z'].includes(sf.code));\n return subfield.value;\n });\n}\n\nexport function clone(o) {\n return JSON.parse(JSON.stringify(o));\n}\n\nexport function toAlephId(id) {\n return id.padStart(9, '0');\n}\n\nexport function fromAlephId(id) {\n return id.replace(/^0+/u, '');\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AC,CACjEoB,GAAG,CAACR,KAAK,IAAI;IACZ,MAAMS,QAAQ,GAAGT,KAAK,CAACb,SAAS,CAACc,IAAI,CAACE,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACvB,QAAQ,CAACuB,EAAE,CAACf,IAAI,CAAC,CAAC;IACzE,OAAOqB,QAAQ,CAACpB,KAAK;EACvB,CAAC,CAAC;AACN;AAEO,SAASqB,KAAK,CAACC,CAAC,EAAE;EACvB,OAAOC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACH,CAAC,CAAC,CAAC;AACtC;AAEO,SAASI,SAAS,CAACC,EAAE,EAAE;EAC5B,OAAOA,EAAE,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC5B;AAEO,SAASC,WAAW,CAACF,EAAE,EAAE;EAC9B,OAAOA,EAAE,CAACZ,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;AAC/B"}
@@ -1,17 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _fs = _interopRequireDefault(require("fs"));
6
-
7
5
  var _path = _interopRequireDefault(require("path"));
8
-
9
6
  var _chai = require("chai");
10
-
11
7
  var _marcRecord = require("@natlibfi/marc-record");
12
-
13
8
  var _utils = require("./utils");
14
-
15
9
  /**
16
10
  *
17
11
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -39,12 +33,11 @@ var _utils = require("./utils");
39
33
  * for the JavaScript code in this file.
40
34
  *
41
35
  */
36
+
42
37
  _marcRecord.MarcRecord.setValidationOptions({
43
38
  subfieldValues: false
44
39
  });
45
-
46
40
  const FIXTURES_PATH = _path.default.join(__dirname, '../test-fixtures/utils');
47
-
48
41
  describe('utils', () => {
49
42
  describe('generateAuthorizationHeader', () => {
50
43
  it('Should create a proper Authorization header', () => {
@@ -55,49 +48,41 @@ describe('utils', () => {
55
48
  describe('isDeletedRecord', () => {
56
49
  it('Should find the record deleted (Leader)', () => {
57
50
  const data = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, 'isDeletedRecord/record1.json'), 'utf8');
58
-
59
51
  const record = new _marcRecord.MarcRecord(JSON.parse(data));
60
52
  (0, _chai.expect)((0, _utils.isDeletedRecord)(record)).to.equal(true);
61
53
  });
62
54
  it('Should find the record deleted (DEL)', () => {
63
55
  const data = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, 'isDeletedRecord/record2.json'), 'utf8');
64
-
65
56
  const record = new _marcRecord.MarcRecord(JSON.parse(data));
66
57
  (0, _chai.expect)((0, _utils.isDeletedRecord)(record)).to.equal(true);
67
58
  });
68
59
  it('Should find the record deleted (STA)', () => {
69
60
  const data = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, 'isDeletedRecord/record3.json'), 'utf8');
70
-
71
61
  const record = new _marcRecord.MarcRecord(JSON.parse(data));
72
62
  (0, _chai.expect)((0, _utils.isDeletedRecord)(record)).to.equal(true);
73
63
  });
74
64
  it('Should find the record not deleted', () => {
75
65
  const data = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, 'isDeletedRecord/record4.json'), 'utf8');
76
-
77
66
  const record = new _marcRecord.MarcRecord(JSON.parse(data));
78
67
  (0, _chai.expect)((0, _utils.isDeletedRecord)(record)).to.equal(false);
79
68
  });
80
69
  it('Should find the record deleted (Split)', () => {
81
70
  const data = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, 'isDeletedRecord/record5.json'), 'utf8');
82
-
83
71
  const record = new _marcRecord.MarcRecord(JSON.parse(data));
84
72
  (0, _chai.expect)((0, _utils.isDeletedRecord)(record)).to.equal(true);
85
73
  });
86
74
  it('Should find the record deleted (Deprecated)', () => {
87
75
  const data = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, 'isDeletedRecord/record6.json'), 'utf8');
88
-
89
76
  const record = new _marcRecord.MarcRecord(JSON.parse(data));
90
77
  (0, _chai.expect)((0, _utils.isDeletedRecord)(record)).to.equal(true);
91
78
  });
92
79
  it('Should find the record deleted (Split (Aleph))', () => {
93
80
  const data = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, 'isDeletedRecord/record7.json'), 'utf8');
94
-
95
81
  const record = new _marcRecord.MarcRecord(JSON.parse(data));
96
82
  (0, _chai.expect)((0, _utils.isDeletedRecord)(record)).to.equal(true);
97
83
  });
98
84
  it('Should find the record deleted (Deprecated (Aleph))', () => {
99
85
  const data = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, 'isDeletedRecord/record8.json'), 'utf8');
100
-
101
86
  const record = new _marcRecord.MarcRecord(JSON.parse(data));
102
87
  (0, _chai.expect)((0, _utils.isDeletedRecord)(record)).to.equal(true);
103
88
  });
@@ -132,9 +117,7 @@ describe('utils', () => {
132
117
  ['Should find a title', 'Should not find a title'].forEach((descr, index) => {
133
118
  it(descr, () => {
134
119
  const title = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, `getRecordTitle/title${index}.txt`), 'utf8');
135
-
136
120
  const recordData = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, `getRecordTitle/record${index}.json`), 'utf8');
137
-
138
121
  const record = new _marcRecord.MarcRecord(JSON.parse(recordData));
139
122
  (0, _chai.expect)((0, _utils.getRecordTitle)(record)).to.equal(title);
140
123
  });
@@ -144,9 +127,7 @@ describe('utils', () => {
144
127
  ['Should find identifiers', 'Should not find an identifier'].forEach((descr, index) => {
145
128
  it(descr, () => {
146
129
  const identifiers = JSON.parse(_fs.default.readFileSync(_path.default.join(FIXTURES_PATH, `getRecordStandardIdentifiers/identifiers${index}.json`), 'utf8'));
147
-
148
130
  const recordData = _fs.default.readFileSync(_path.default.join(FIXTURES_PATH, `getRecordStandardIdentifiers/record${index}.json`), 'utf8');
149
-
150
131
  const record = new _marcRecord.MarcRecord(JSON.parse(recordData));
151
132
  (0, _chai.expect)((0, _utils.getRecordStandardIdentifiers)(record)).to.eql(identifiers);
152
133
  });
@@ -1 +1 @@
1
- {"version":3,"file":"utils.spec.js","names":["MarcRecord","setValidationOptions","subfieldValues","FIXTURES_PATH","path","join","__dirname","describe","it","value","generateAuthorizationHeader","expect","to","equal","data","fs","readFileSync","record","JSON","parse","isDeletedRecord","parseBoolean","undefined","forEach","descr","index","title","recordData","getRecordTitle","identifiers","getRecordStandardIdentifiers","eql","obj","cloned","clone","not"],"sources":["../src/utils.spec.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport fs from 'fs';\nimport path from 'path';\nimport {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport {\n generateAuthorizationHeader, isDeletedRecord, parseBoolean, clone,\n getRecordTitle, getRecordStandardIdentifiers\n} from './utils';\n\nMarcRecord.setValidationOptions({subfieldValues: false});\n\nconst FIXTURES_PATH = path.join(__dirname, '../test-fixtures/utils');\n\ndescribe('utils', () => {\n describe('generateAuthorizationHeader', () => {\n it('Should create a proper Authorization header', () => {\n const value = generateAuthorizationHeader('foo', 'bar');\n expect(value).to.equal('Basic Zm9vOmJhcg==');\n });\n });\n\n describe('isDeletedRecord', () => {\n it('Should find the record deleted (Leader)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record1.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (DEL)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record2.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (STA)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record3.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record not deleted', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record4.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(false);\n });\n\n it('Should find the record deleted (Split)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record5.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (Deprecated)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record6.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (Split (Aleph))', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record7.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (Deprecated (Aleph))', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record8.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n });\n\n describe('parseBoolean', () => {\n it('Should parse undefined as false', () => {\n expect(parseBoolean(undefined)).to.equal(false);\n });\n\n it('Should parse zero-length string as false', () => {\n expect(parseBoolean('')).to.equal(false);\n });\n\n it('Should parse numericish value as true', () => {\n expect(parseBoolean('1')).to.equal(true);\n });\n\n it('Should parse numericush value as false', () => {\n expect(parseBoolean('0')).to.equal(false);\n });\n\n it('Should parse literal \\'false\\' value as false', () => {\n expect(parseBoolean('false')).to.equal(false);\n });\n\n it('Should parse non-numericish value as true', () => {\n expect(parseBoolean('foo')).to.equal(true);\n });\n\n it('Should parse literal \\'FALSE\\' value as false', () => {\n expect(parseBoolean('FALSE')).to.equal(false);\n });\n\n it('Should parse literal \\'FAlsE\\' value as false', () => {\n expect(parseBoolean('FAlsE')).to.equal(false);\n });\n\n });\n\n describe('getRecordTitle', () => {\n [\n 'Should find a title',\n 'Should not find a title'\n ].forEach((descr, index) => {\n it(descr, () => {\n const title = fs.readFileSync(path.join(FIXTURES_PATH, `getRecordTitle/title${index}.txt`), 'utf8');\n const recordData = fs.readFileSync(path.join(FIXTURES_PATH, `getRecordTitle/record${index}.json`), 'utf8');\n const record = new MarcRecord(JSON.parse(recordData));\n\n expect(getRecordTitle(record)).to.equal(title);\n });\n });\n });\n\n describe('getRecordStandardIdentifiers', () => {\n [\n 'Should find identifiers',\n 'Should not find an identifier'\n ].forEach((descr, index) => {\n it(descr, () => {\n const identifiers = JSON.parse(fs.readFileSync(path.join(FIXTURES_PATH, `getRecordStandardIdentifiers/identifiers${index}.json`), 'utf8'));\n const recordData = fs.readFileSync(path.join(FIXTURES_PATH, `getRecordStandardIdentifiers/record${index}.json`), 'utf8');\n const record = new MarcRecord(JSON.parse(recordData));\n\n expect(getRecordStandardIdentifiers(record)).to.eql(identifiers);\n });\n });\n });\n\n describe('clone', () => {\n it('Should clone an object', (index = '1') => {\n const obj = JSON.parse(fs.readFileSync(path.join(FIXTURES_PATH, `clone/${index}/obj.json`), 'utf8'));\n const cloned = clone(obj);\n\n expect(obj).to.not.equal(cloned);\n expect(cloned).to.eql(obj);\n });\n });\n});\n"],"mappings":";;;;AA4BA;;AACA;;AACA;;AACA;;AACA;;AAhCA;AACA;AACA;A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YAAH,CAAgBZ,aAAA,CAAKC,IAAL,CAAUF,aAAV,EAA0B,sCAAqCsB,KAAM,OAArE,CAAhB,EAA8F,MAA9F,CAAnB;;QACA,MAAMR,MAAM,GAAG,IAAIjB,sBAAJ,CAAekB,IAAI,CAACC,KAAL,CAAWQ,UAAX,CAAf,CAAf;QAEA,IAAAhB,YAAA,EAAO,IAAAmB,mCAAA,EAA6Bb,MAA7B,CAAP,EAA6CL,EAA7C,CAAgDmB,GAAhD,CAAoDF,WAApD;MACD,CANC,CAAF;IAOD,CAXD;EAYD,CAbO,CAAR;EAeAtB,QAAQ,CAAC,OAAD,EAAU,MAAM;IACtBC,EAAE,CAAC,wBAAD,EAA2B,YAAiB;MAAA,IAAhBiB,KAAgB,uEAAR,GAAQ;MAC5C,MAAMO,GAAG,GAAGd,IAAI,CAACC,KAAL,CAAWJ,WAAA,CAAGC,YAAH,CAAgBZ,aAAA,CAAKC,IAAL,CAAUF,aAAV,EAA0B,SAAQsB,KAAM,WAAxC,CAAhB,EAAqE,MAArE,CAAX,CAAZ;MACA,MAAMQ,MAAM,GAAG,IAAAC,YAAA,EAAMF,GAAN,CAAf;MAEA,IAAArB,YAAA,EAAOqB,GAAP,EAAYpB,EAAZ,CAAeuB,GAAf,CAAmBtB,KAAnB,CAAyBoB,MAAzB;MACA,IAAAtB,YAAA,EAAOsB,MAAP,EAAerB,EAAf,CAAkBmB,GAAlB,CAAsBC,GAAtB;IACD,CANC,CAAF;EAOD,CARO,CAAR;AASD,CApIO,CAAR"}
1
+ {"version":3,"file":"utils.spec.js","names":["MarcRecord","setValidationOptions","subfieldValues","FIXTURES_PATH","path","join","__dirname","describe","it","value","generateAuthorizationHeader","expect","to","equal","data","fs","readFileSync","record","JSON","parse","isDeletedRecord","parseBoolean","undefined","forEach","descr","index","title","recordData","getRecordTitle","identifiers","getRecordStandardIdentifiers","eql","obj","cloned","clone","not"],"sources":["../src/utils.spec.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport fs from 'fs';\nimport path from 'path';\nimport {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport {\n generateAuthorizationHeader, isDeletedRecord, parseBoolean, clone,\n getRecordTitle, getRecordStandardIdentifiers\n} from './utils';\n\nMarcRecord.setValidationOptions({subfieldValues: false});\n\nconst FIXTURES_PATH = path.join(__dirname, '../test-fixtures/utils');\n\ndescribe('utils', () => {\n describe('generateAuthorizationHeader', () => {\n it('Should create a proper Authorization header', () => {\n const value = generateAuthorizationHeader('foo', 'bar');\n expect(value).to.equal('Basic Zm9vOmJhcg==');\n });\n });\n\n describe('isDeletedRecord', () => {\n it('Should find the record deleted (Leader)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record1.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (DEL)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record2.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (STA)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record3.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record not deleted', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record4.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(false);\n });\n\n it('Should find the record deleted (Split)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record5.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (Deprecated)', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record6.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (Split (Aleph))', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record7.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n\n it('Should find the record deleted (Deprecated (Aleph))', () => {\n const data = fs.readFileSync(path.join(FIXTURES_PATH, 'isDeletedRecord/record8.json'), 'utf8');\n const record = new MarcRecord(JSON.parse(data));\n expect(isDeletedRecord(record)).to.equal(true);\n });\n });\n\n describe('parseBoolean', () => {\n it('Should parse undefined as false', () => {\n expect(parseBoolean(undefined)).to.equal(false);\n });\n\n it('Should parse zero-length string as false', () => {\n expect(parseBoolean('')).to.equal(false);\n });\n\n it('Should parse numericish value as true', () => {\n expect(parseBoolean('1')).to.equal(true);\n });\n\n it('Should parse numericush value as false', () => {\n expect(parseBoolean('0')).to.equal(false);\n });\n\n it('Should parse literal \\'false\\' value as false', () => {\n expect(parseBoolean('false')).to.equal(false);\n });\n\n it('Should parse non-numericish value as true', () => {\n expect(parseBoolean('foo')).to.equal(true);\n });\n\n it('Should parse literal \\'FALSE\\' value as false', () => {\n expect(parseBoolean('FALSE')).to.equal(false);\n });\n\n it('Should parse literal \\'FAlsE\\' value as false', () => {\n expect(parseBoolean('FAlsE')).to.equal(false);\n });\n\n });\n\n describe('getRecordTitle', () => {\n [\n 'Should find a title',\n 'Should not find a title'\n ].forEach((descr, index) => {\n it(descr, () => {\n const title = fs.readFileSync(path.join(FIXTURES_PATH, `getRecordTitle/title${index}.txt`), 'utf8');\n const recordData = fs.readFileSync(path.join(FIXTURES_PATH, `getRecordTitle/record${index}.json`), 'utf8');\n const record = new MarcRecord(JSON.parse(recordData));\n\n expect(getRecordTitle(record)).to.equal(title);\n });\n });\n });\n\n describe('getRecordStandardIdentifiers', () => {\n [\n 'Should find identifiers',\n 'Should not find an identifier'\n ].forEach((descr, index) => {\n it(descr, () => {\n const identifiers = JSON.parse(fs.readFileSync(path.join(FIXTURES_PATH, `getRecordStandardIdentifiers/identifiers${index}.json`), 'utf8'));\n const recordData = fs.readFileSync(path.join(FIXTURES_PATH, `getRecordStandardIdentifiers/record${index}.json`), 'utf8');\n const record = new MarcRecord(JSON.parse(recordData));\n\n expect(getRecordStandardIdentifiers(record)).to.eql(identifiers);\n });\n });\n });\n\n describe('clone', () => {\n it('Should clone an object', (index = '1') => {\n const obj = JSON.parse(fs.readFileSync(path.join(FIXTURES_PATH, `clone/${index}/obj.json`), 'utf8'));\n const cloned = clone(obj);\n\n expect(obj).to.not.equal(cloned);\n expect(cloned).to.eql(obj);\n });\n });\n});\n"],"mappings":";;;AA4BA;AACA;AACA;AACA;AACA;AAhCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWAA,sBAAU,CAACC,oBAAoB,CAAC;EAACC,cAAc,EAAE;AAAK,CAAC,CAAC;AAExD,MAAMC,aAAa,GAAGC,aAAI,CAACC,IAAI,CAACC,SAAS,EAAE,wBAAwB,CAAC;AAEpEC,QAAQ,C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ACJ,CAAC,CAAC;EAEFtB,QAAQ,CAAC,OAAO,EAAE,MAAM;IACtBC,EAAE,CAAC,wBAAwB,EAAE,YAAiB;MAAA,IAAhBiB,KAAK,uEAAG,GAAG;MACvC,MAAMO,GAAG,GAAGd,IAAI,CAACC,KAAK,CAACJ,WAAE,CAACC,YAAY,CAACZ,aAAI,CAACC,IAAI,CAACF,aAAa,EAAG,SAAQsB,KAAM,WAAU,CAAC,EAAE,MAAM,CAAC,CAAC;MACpG,MAAMQ,MAAM,GAAG,IAAAC,YAAK,EAACF,GAAG,CAAC;MAEzB,IAAArB,YAAM,EAACqB,GAAG,CAAC,CAACpB,EAAE,CAACuB,GAAG,CAACtB,KAAK,CAACoB,MAAM,CAAC;MAChC,IAAAtB,YAAM,EAACsB,MAAM,CAAC,CAACrB,EAAE,CAACmB,GAAG,CAACC,GAAG,CAAC;IAC5B,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "url": "git@github.com:natlibfi/melinda-commons-js.git"
15
15
  },
16
16
  "license": "MIT",
17
- "version": "12.0.4",
17
+ "version": "12.0.5",
18
18
  "main": "./dist/index.js",
19
19
  "engines": {
20
20
  "node": ">=14"