@natlibfi/melinda-commons 12.0.0 → 12.0.3-alpha.2
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/error.js +3 -1
- package/dist/error.js.map +1 -1
- package/dist/subRecordPicker.spec.js +2 -9
- package/dist/subRecordPicker.spec.js.map +1 -1
- package/dist/utils.js +1 -1
- package/package.json +19 -19
- package/src/subRecordPicker.spec.js +0 -4
package/dist/error.js
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
|
|
12
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
@@ -70,7 +72,7 @@ var _default = /*#__PURE__*/function (_Error) {
|
|
|
70
72
|
return _this;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
return _default;
|
|
75
|
+
return (0, _createClass2.default)(_default);
|
|
74
76
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
75
77
|
|
|
76
78
|
exports.default = _default;
|
package/dist/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/error.js"],"names":["status","payload","params","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/error.js"],"names":["status","payload","params","Error"],"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;;;;;;AAGE,oBAAYA,MAAZ,EAAoBC,OAApB,EAAwC;AAAA;;AAAA;;AAAA,sCAARC,MAAQ;AAARA,MAAAA,MAAQ;AAAA;;AACtC,8BAAMA,MAAN;AACA,UAAKF,MAAL,GAAcA,MAAd,CAFsC,CAEhB;;AACtB,UAAKC,OAAL,GAAeA,OAAf,CAHsC,CAGd;;AAHc;AAIvC;;;+CAL0BE,K","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-2021 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"],"file":"error.js"}
|
|
@@ -4,8 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
|
|
5
5
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
6
6
|
|
|
7
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
8
|
-
|
|
9
7
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
8
|
|
|
11
9
|
var _chai = require("chai");
|
|
@@ -16,8 +14,6 @@ var _fixura = require("@natlibfi/fixura");
|
|
|
16
14
|
|
|
17
15
|
var _fixugenHttpClient = _interopRequireDefault(require("@natlibfi/fixugen-http-client"));
|
|
18
16
|
|
|
19
|
-
var _marcRecord = require("@natlibfi/marc-record");
|
|
20
|
-
|
|
21
17
|
/**
|
|
22
18
|
*
|
|
23
19
|
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
@@ -74,7 +70,7 @@ describe('subRecordPicker', function () {
|
|
|
74
70
|
|
|
75
71
|
function _callback() {
|
|
76
72
|
_callback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
77
|
-
var getFixture, method, sruUrl, retrieveAll, recordId, client, expectedRecords, _yield$client$method, records,
|
|
73
|
+
var getFixture, method, sruUrl, retrieveAll, recordId, client, expectedRecords, _yield$client$method, records, format;
|
|
78
74
|
|
|
79
75
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
80
76
|
while (1) {
|
|
@@ -98,12 +94,9 @@ describe('subRecordPicker', function () {
|
|
|
98
94
|
case 6:
|
|
99
95
|
_yield$client$method = _context.sent;
|
|
100
96
|
records = _yield$client$method.records;
|
|
101
|
-
// Expect records to be marc records
|
|
102
|
-
_records = (0, _slicedToArray2.default)(records, 1), record = _records[0];
|
|
103
|
-
(0, _chai.expect)(record).to.be.instanceof(_marcRecord.MarcRecord);
|
|
104
97
|
(0, _chai.expect)(format()).to.eql(expectedRecords);
|
|
105
98
|
|
|
106
|
-
case
|
|
99
|
+
case 9:
|
|
107
100
|
case "end":
|
|
108
101
|
return _context.stop();
|
|
109
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/subRecordPicker.spec.js"],"names":["describe","sruUrl","retrieveAll","it","client","to","respondTo","createSubrecordPicker","throw","callback","path","__dirname","format","records","map","r","toObject","getFixture","method","recordId","expectedRecords","components","reader","READERS","JSON","
|
|
1
|
+
{"version":3,"sources":["../src/subRecordPicker.spec.js"],"names":["describe","sruUrl","retrieveAll","it","client","to","respondTo","createSubrecordPicker","throw","callback","path","__dirname","format","records","map","r","toObject","getFixture","method","recordId","expectedRecords","components","reader","READERS","JSON","eql"],"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,YAAM;AAChC,MAAMC,MAAM,GAAG,aAAf;AACA,MAAMC,WAAW,GAAG,KAApB;AAEAF,EAAAA,QAAQ,CAAC,uBAAD,EAA0B,YAAM;AACtCG,IAAAA,EAAE,CAAC,4BAAD,EAA+B,YAAM;AACrC,UAAMC,MAAM,GAAG,4CAAsBH,MAAtB,EAA8BC,WAA9B,CAAf;AACA,wBAAOE,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,mBAA5B;AACA,wBAAOF,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,oBAA5B;AACD,KAJC,CAAF;AAMAH,IAAAA,EAAE,CAAC,oDAAD,EAAuD,YAAM;AAC7D,UAAMC,MAAM,GAAG,4CAAsBH,MAAtB,CAAf;AACA,wBAAOG,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,mBAA5B;AACA,wBAAOF,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,oBAA5B;AACD,KAJC,CAAF;AAMAH,IAAAA,EAAE,CAAC,mDAAD,EAAsD,YAAM;AAC5D,wBAAOI,sCAAP,EAA8BF,EAA9B,CAAiCG,KAAjC;AACD,KAFC,CAAF;AAGD,GAhBO,CAAR;AAkBA,kCAAc;AACZC,IAAAA,QAAQ,EAARA,QADY;AAEZC,IAAAA,IAAI,EAAE,CAACC,SAAD,EAAY,IAAZ,EAAkB,eAAlB,EAAmC,iBAAnC;AAFM,GAAd;;AAtBgC,WA2BjBF,QA3BiB;AAAA;AAAA;;AAAA;AAAA,wFA2BhC;AAAA,qHAOWG,MAPX;;AAAA;AAAA;AAAA;AAAA;AAOWA,cAAAA,MAPX,sBAOoB;AAChB,uBAAOC,OAAO,CAACC,GAAR,CAAY,UAAAC,CAAC;AAAA,yBAAIA,CAAC,CAACC,QAAF,EAAJ;AAAA,iBAAb,CAAP;AACD,eATH;;AAAyBC,cAAAA,UAAzB,QAAyBA,UAAzB,EAAqCC,MAArC,QAAqCA,MAArC,EAA6CjB,MAA7C,QAA6CA,MAA7C,EAAqDC,WAArD,QAAqDA,WAArD,EAAkEiB,QAAlE,QAAkEA,QAAlE;AACQf,cAAAA,MADR,GACiB,4CAAsBH,MAAtB,EAA8BC,WAA9B,CADjB;AAEQkB,cAAAA,eAFR,GAE0BH,UAAU,CAAC;AAACI,gBAAAA,UAAU,EAAE,CAAC,uBAAD,CAAb;AAAwCC,gBAAAA,MAAM,EAAEC,gBAAQC;AAAxD,eAAD,CAFpC;AAAA;AAAA,qBAG0BpB,MAAM,CAACc,MAAD,CAAN,CAAeC,QAAf,CAH1B;;AAAA;AAAA;AAGSN,cAAAA,OAHT,wBAGSA,OAHT;AAKE,gCAAOD,MAAM,EAAb,EAAiBP,EAAjB,CAAoBoB,GAApB,CAAwBL,eAAxB;;AALF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KA3BgC;AAAA;AAAA;AAsCjC,CAtCO,CAAR","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-2021 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"],"file":"subRecordPicker.spec.js"}
|
package/dist/utils.js
CHANGED
|
@@ -20,7 +20,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
20
20
|
|
|
21
21
|
var _setPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/setPrototypeOf"));
|
|
22
22
|
|
|
23
|
-
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re,
|
|
23
|
+
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), (0, _setPrototypeOf2.default)(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { return groups[name] = result[g[name]], groups; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
*
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "git@github.com:natlibfi/melinda-commons-js.git"
|
|
15
15
|
},
|
|
16
16
|
"license": "LGPL-3.0+",
|
|
17
|
-
"version": "12.0.
|
|
17
|
+
"version": "12.0.3-alpha.2",
|
|
18
18
|
"main": "./dist/index.js",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=14"
|
|
@@ -34,34 +34,34 @@
|
|
|
34
34
|
"watch:test": "cross-env DEBUG=1 NODE_ENV=test nodemon -w src -w test-fixtures --exec 'npm run test:dev'"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@natlibfi/marc-record": "^
|
|
38
|
-
"@natlibfi/marc-record-serializers": "^8.
|
|
39
|
-
"@natlibfi/sru-client": "^
|
|
40
|
-
"debug": "^4.3.
|
|
37
|
+
"@natlibfi/marc-record": "^7.0.0",
|
|
38
|
+
"@natlibfi/marc-record-serializers": "^8.1.0",
|
|
39
|
+
"@natlibfi/sru-client": "^5.0.1",
|
|
40
|
+
"debug": "^4.3.3",
|
|
41
41
|
"deep-eql": "^4.0.0",
|
|
42
42
|
"http-status": "^1.5.0",
|
|
43
43
|
"moment": "^2.29.1",
|
|
44
|
-
"nock": "^13.
|
|
45
|
-
"node-fetch": "^2.6.
|
|
44
|
+
"nock": "^13.2.2",
|
|
45
|
+
"node-fetch": "^2.6.7"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@babel/cli": "^7.
|
|
49
|
-
"@babel/core": "^7.
|
|
50
|
-
"@babel/eslint-parser": "^7.
|
|
51
|
-
"@babel/node": "^7.
|
|
52
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
53
|
-
"@babel/preset-env": "^7.
|
|
54
|
-
"@babel/register": "^7.
|
|
55
|
-
"@natlibfi/eslint-config-melinda-backend": "^
|
|
48
|
+
"@babel/cli": "^7.16.8",
|
|
49
|
+
"@babel/core": "^7.16.12",
|
|
50
|
+
"@babel/eslint-parser": "^7.16.5",
|
|
51
|
+
"@babel/node": "^7.16.8",
|
|
52
|
+
"@babel/plugin-transform-runtime": "^7.16.10",
|
|
53
|
+
"@babel/preset-env": "^7.16.11",
|
|
54
|
+
"@babel/register": "^7.16.9",
|
|
55
|
+
"@natlibfi/eslint-config-melinda-backend": "^2.0.0",
|
|
56
56
|
"@natlibfi/fixugen-http-client": "^1.1.3",
|
|
57
57
|
"@natlibfi/fixura": "^2.2.1",
|
|
58
58
|
"babel-plugin-istanbul": "^6.1.1",
|
|
59
59
|
"babel-plugin-rewire": "^1.2.0",
|
|
60
|
-
"chai": "^4.3.
|
|
60
|
+
"chai": "^4.3.6",
|
|
61
61
|
"cross-env": "^7.0.3",
|
|
62
|
-
"eslint": "^
|
|
63
|
-
"mocha": "^9.
|
|
64
|
-
"nodemon": "^2.0.
|
|
62
|
+
"eslint": "^8.8.0",
|
|
63
|
+
"mocha": "^9.2.0",
|
|
64
|
+
"nodemon": "^2.0.15",
|
|
65
65
|
"nyc": "^15.1.0"
|
|
66
66
|
},
|
|
67
67
|
"eslintConfig": {
|
|
@@ -30,7 +30,6 @@ import {expect} from 'chai';
|
|
|
30
30
|
import {createSubrecordPicker} from './subRecordPicker';
|
|
31
31
|
import {READERS} from '@natlibfi/fixura';
|
|
32
32
|
import generateTests from '@natlibfi/fixugen-http-client';
|
|
33
|
-
import {MarcRecord} from '@natlibfi/marc-record';
|
|
34
33
|
|
|
35
34
|
describe('subRecordPicker', () => {
|
|
36
35
|
const sruUrl = 'https://sru';
|
|
@@ -64,9 +63,6 @@ describe('subRecordPicker', () => {
|
|
|
64
63
|
const expectedRecords = getFixture({components: ['expected-records.json'], reader: READERS.JSON});
|
|
65
64
|
const {records} = await client[method](recordId);
|
|
66
65
|
|
|
67
|
-
// Expect records to be marc records
|
|
68
|
-
const [record] = records;
|
|
69
|
-
expect(record).to.be.instanceof(MarcRecord);
|
|
70
66
|
expect(format()).to.eql(expectedRecords);
|
|
71
67
|
|
|
72
68
|
function format() {
|