@natlibfi/melinda-rest-api-commons 2.3.2-alpha.6 → 2.3.2-alpha.8
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/amqp.js +118 -87
- package/dist/amqp.js.map +1 -1
- package/dist/amqp.spec.js +252 -0
- package/dist/amqp.spec.js.map +1 -0
- package/dist/constants.js +5 -3
- package/dist/constants.js.map +1 -1
- package/dist/helpers/conversion.js +5 -25
- package/dist/helpers/conversion.js.map +1 -1
- package/dist/helpers/conversion.spec.js +1 -7
- package/dist/helpers/conversion.spec.js.map +1 -1
- package/dist/helpers/fix-constants.js +6 -4
- package/dist/helpers/fix-constants.js.map +1 -1
- package/dist/helpers/fix-handle-tempurns.js +19 -27
- package/dist/helpers/fix-handle-tempurns.js.map +1 -1
- package/dist/helpers/fix-strip-f884s.js +12 -16
- package/dist/helpers/fix-strip-f884s.js.map +1 -1
- package/dist/helpers/fix-utils.js +9 -15
- package/dist/helpers/fix-utils.js.map +1 -1
- package/dist/helpers/fix.js +17 -32
- package/dist/helpers/fix.js.map +1 -1
- package/dist/helpers/fix.spec.js +1 -12
- package/dist/helpers/fix.spec.js.map +1 -1
- package/dist/helpers/validation.js +0 -6
- package/dist/helpers/validation.js.map +1 -1
- package/dist/helpers/validation.spec.js +1 -7
- package/dist/helpers/validation.spec.js.map +1 -1
- package/dist/index.js +8 -14
- package/dist/index.js.map +1 -1
- package/dist/mongo.js +38 -87
- package/dist/mongo.js.map +1 -1
- package/dist/mongoLog.js +5 -29
- package/dist/mongoLog.js.map +1 -1
- package/dist/utils.js +33 -35
- package/dist/utils.js.map +1 -1
- package/package.json +5 -4
package/dist/helpers/fix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix.js","names":["logger","createLogger","debug","createDebugLogger","debugData","extend","fixRecord","record","settings","verbose","JSON","stringify","newRecord","MarcRecord","clone","subfieldValues","generateMissingSIDsOptions","generateMissingSIDs","undefined","newRecord1","replacePrefixesOptions","replacePrefixes","newRecord2","replaceAllPrefixes","newRecord3","handleTempUrns","newRecord4","stripF884s","toObject","length","forEach","options","replacePrefix","oldPrefix","newPrefix","prefixReplaceCodes","pattern","replacement","getDatafields","field","subfields","filter","code","includes","subfield","value","replace","f035Filters","fSIDFilters","f035s","f035ToSidInfo","get","fSIDs","sidsToSidInfo","sidsToBeAdded","genNewSids","f035SidInfo","some","fSIDInfo","SID","sidField","insertField","map","sidInfo","tag","ind1","ind2","SIDs","flatMap","sub","wantedSub","regexp","test","findIndex","slice","indexOf"],"sources":["../../src/helpers/fix.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for microservices of Melinda rest api batch import system\n*\n* Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-rest-api-commons\n*\n* melinda-rest-api-commons program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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-rest-api-commons 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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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';\nimport {createLogger} from '@natlibfi/melinda-backend-commons';\nimport createDebugLogger from 'debug';\n\nimport {handleTempUrns} from './fix-handle-tempurns';\nimport {stripF884s} from './fix-strip-f884s';\n\nexport * from './fix-constants';\n\nconst logger = createLogger();\nconst debug = createDebugLogger('@natlibfi/melinda-rest-api-commons:fixRecord');\nconst debugData = debug.extend('data');\n\nexport function fixRecord(record, settings = {}) {\n\n logger.verbose(`We will apply formatting to the record according to settings: ${JSON.stringify(settings)}`);\n const newRecord = MarcRecord.clone(record, {subfieldValues: false});\n debugData(`settings: ${JSON.stringify(settings)}`);\n\n // We should handle these in some prettier way ...\n\n // Fix 1, generate SIDs\n const generateMissingSIDsOptions = settings.generateMissingSIDs || undefined;\n const newRecord1 = generateMissingSIDs(newRecord, generateMissingSIDsOptions);\n\n // Fix 2, replace identifier prefixes\n const replacePrefixesOptions = settings.replacePrefixes || [];\n const newRecord2 = replaceAllPrefixes(newRecord1, replacePrefixesOptions);\n\n // Fix 3, handle temporary URNs from legal deposit record import\n const newRecord3 = handleTempUrns(newRecord2, settings.handleTempUrns);\n\n // Fix 4, strip extra field 884s\n const newRecord4 = stripF884s(newRecord3, settings.stripF884s);\n\n return newRecord4.toObject();\n\n}\n\n\nfunction replaceAllPrefixes(record, replacePrefixesOptions) {\n if (replacePrefixesOptions.length < 1) {\n debug(`NOT running replacePrefixes, no options`);\n return record;\n }\n\n debug(`Running replacePrefixes fixer`);\n debugData(`replacePrefixesOptions: ${JSON.stringify(replacePrefixesOptions)}`);\n\n replacePrefixesOptions.forEach(options => {\n replacePrefix(record, options);\n });\n return record;\n}\n\n\n// Replace prefix in all specified subfields\nfunction replacePrefix(record, options) {\n const {oldPrefix, newPrefix, prefixReplaceCodes} = options;\n debug(`Replacing ${oldPrefix} with ${newPrefix} in subfields ${prefixReplaceCodes}`);\n const pattern = `(${oldPrefix})`;\n const replacement = `(${newPrefix})`;\n record.getDatafields()\n .forEach(field => {\n field.subfields\n .filter(({code}) => prefixReplaceCodes.includes(code))\n .forEach(subfield => {\n subfield.value = subfield.value.replace(pattern, replacement); // eslint-disable-line functional/immutable-data\n });\n });\n return record;\n}\n\n\nfunction generateMissingSIDs(record, options) {\n\n const f035Filters = options && options.f035Filters ? options.f035Filters : [];\n const fSIDFilters = options && options.fSIDFilters ? options.fSIDFilters : [];\n\n if (f035Filters.length !== fSIDFilters.length || f035Filters.length < 1 || fSIDFilters.length < 1) {\n debug(`NOT running generateMissingsSIDs, no options`);\n return record;\n }\n\n debug(`Running generateMissingSIDs fixer`);\n debugData(`generateMissingSIDs options: ${JSON.stringify(options)}`);\n\n const f035s = f035ToSidInfo(record.get(/^035$/u));\n const fSIDs = sidsToSidInfo(record.get(/^SID$/u));\n\n const sidsToBeAdded = genNewSids(fSIDs.length === 0\n ? f035s\n // test that SIDs are not there yet\n : f035s.filter(f035SidInfo => fSIDs.some(fSIDInfo => f035SidInfo.SID !== fSIDInfo.SID && f035SidInfo.value !== fSIDInfo.value)));\n\n // Add new SIDs\n sidsToBeAdded.forEach(sidField => record.insertField(sidField));\n return record;\n\n function genNewSids(sidsToBeAdded) {\n return sidsToBeAdded.map(sidInfo => ({tag: 'SID', ind1: ' ', ind2: ' ', subfields: [{code: 'c', value: sidInfo.value}, {code: 'b', value: sidInfo.SID}]}));\n }\n\n function sidsToSidInfo(SIDs) {\n return SIDs.flatMap(({subfields}) => {\n const [SID] = subfields.filter(sub => sub.code === 'b' && fSIDFilters.includes(sub.value)).map(sub => sub.value);\n const [value] = subfields.filter(sub => sub.code === 'c' && sub.value !== undefined).map(sub => sub.value);\n\n if (SID && value) {\n return {\n SID,\n value\n };\n }\n\n return undefined;\n }).filter(value => value !== undefined);\n }\n\n function f035ToSidInfo(f035s) {\n return f035s.flatMap(({subfields}) => {\n const [wantedSub] = subfields.filter(sub => sub.code === 'a' && f035Filters.some(regexp => regexp.test(sub.value)));\n\n if (wantedSub) {\n return {\n SID: fSIDFilters[f035Filters.findIndex(regexp => regexp.test(wantedSub.value))],\n value: wantedSub.value.slice(wantedSub.value.indexOf(')') + 1)\n };\n }\n\n return undefined;\n }).filter(value => value !== undefined);\n }\n}\n\n\n"],"mappings":";;;;;;;;;;AA4BA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AAnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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;MAEA,IAAIyB,SAAJ,EAAe;QACb,OAAO;UACLX,GAAG,EAAEX,WAAW,CAACD,WAAW,CAAC0B,SAAZ,CAAsBF,MAAM,IAAIA,MAAM,CAACC,IAAP,CAAYF,SAAS,CAACzB,KAAtB,CAAhC,CAAD,CADX;UAELA,KAAK,EAAEyB,SAAS,CAACzB,KAAV,CAAgB6B,KAAhB,CAAsBJ,SAAS,CAACzB,KAAV,CAAgB8B,OAAhB,CAAwB,GAAxB,IAA+B,CAArD;QAFF,CAAP;MAID;;MAED,OAAOzD,SAAP;IACD,CAXM,EAWJuB,MAXI,CAWGI,KAAK,IAAIA,KAAK,KAAK3B,SAXtB,CAAP;EAYD;AACF"}
|
|
1
|
+
{"version":3,"file":"fix.js","names":["logger","createLogger","debug","createDebugLogger","debugData","extend","fixRecord","record","settings","verbose","JSON","stringify","newRecord","MarcRecord","clone","subfieldValues","generateMissingSIDsOptions","generateMissingSIDs","undefined","newRecord1","replacePrefixesOptions","replacePrefixes","newRecord2","replaceAllPrefixes","newRecord3","handleTempUrns","newRecord4","stripF884s","toObject","length","forEach","options","replacePrefix","oldPrefix","newPrefix","prefixReplaceCodes","pattern","replacement","getDatafields","field","subfields","filter","code","includes","subfield","value","replace","f035Filters","fSIDFilters","f035s","f035ToSidInfo","get","fSIDs","sidsToSidInfo","sidsToBeAdded","genNewSids","f035SidInfo","some","fSIDInfo","SID","sidField","insertField","map","sidInfo","tag","ind1","ind2","SIDs","flatMap","sub","wantedSub","regexp","test","findIndex","slice","indexOf"],"sources":["../../src/helpers/fix.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for microservices of Melinda rest api batch import system\n*\n* Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-rest-api-commons\n*\n* melinda-rest-api-commons program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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-rest-api-commons 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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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';\nimport {createLogger} from '@natlibfi/melinda-backend-commons';\nimport createDebugLogger from 'debug';\n\nimport {handleTempUrns} from './fix-handle-tempurns';\nimport {stripF884s} from './fix-strip-f884s';\n\nexport * from './fix-constants';\n\nconst logger = createLogger();\nconst debug = createDebugLogger('@natlibfi/melinda-rest-api-commons:fixRecord');\nconst debugData = debug.extend('data');\n\nexport function fixRecord(record, settings = {}) {\n\n logger.verbose(`We will apply formatting to the record according to settings: ${JSON.stringify(settings)}`);\n const newRecord = MarcRecord.clone(record, {subfieldValues: false});\n debugData(`settings: ${JSON.stringify(settings)}`);\n\n // We should handle these in some prettier way ...\n\n // Fix 1, generate SIDs\n const generateMissingSIDsOptions = settings.generateMissingSIDs || undefined;\n const newRecord1 = generateMissingSIDs(newRecord, generateMissingSIDsOptions);\n\n // Fix 2, replace identifier prefixes\n const replacePrefixesOptions = settings.replacePrefixes || [];\n const newRecord2 = replaceAllPrefixes(newRecord1, replacePrefixesOptions);\n\n // Fix 3, handle temporary URNs from legal deposit record import\n const newRecord3 = handleTempUrns(newRecord2, settings.handleTempUrns);\n\n // Fix 4, strip extra field 884s\n const newRecord4 = stripF884s(newRecord3, settings.stripF884s);\n\n return newRecord4.toObject();\n\n}\n\n\nfunction replaceAllPrefixes(record, replacePrefixesOptions) {\n if (replacePrefixesOptions.length < 1) {\n debug(`NOT running replacePrefixes, no options`);\n return record;\n }\n\n debug(`Running replacePrefixes fixer`);\n debugData(`replacePrefixesOptions: ${JSON.stringify(replacePrefixesOptions)}`);\n\n replacePrefixesOptions.forEach(options => {\n replacePrefix(record, options);\n });\n return record;\n}\n\n\n// Replace prefix in all specified subfields\nfunction replacePrefix(record, options) {\n const {oldPrefix, newPrefix, prefixReplaceCodes} = options;\n debug(`Replacing ${oldPrefix} with ${newPrefix} in subfields ${prefixReplaceCodes}`);\n const pattern = `(${oldPrefix})`;\n const replacement = `(${newPrefix})`;\n record.getDatafields()\n .forEach(field => {\n field.subfields\n .filter(({code}) => prefixReplaceCodes.includes(code))\n .forEach(subfield => {\n subfield.value = subfield.value.replace(pattern, replacement); // eslint-disable-line functional/immutable-data\n });\n });\n return record;\n}\n\n\nfunction generateMissingSIDs(record, options) {\n\n const f035Filters = options && options.f035Filters ? options.f035Filters : [];\n const fSIDFilters = options && options.fSIDFilters ? options.fSIDFilters : [];\n\n if (f035Filters.length !== fSIDFilters.length || f035Filters.length < 1 || fSIDFilters.length < 1) {\n debug(`NOT running generateMissingsSIDs, no options`);\n return record;\n }\n\n debug(`Running generateMissingSIDs fixer`);\n debugData(`generateMissingSIDs options: ${JSON.stringify(options)}`);\n\n const f035s = f035ToSidInfo(record.get(/^035$/u));\n const fSIDs = sidsToSidInfo(record.get(/^SID$/u));\n\n const sidsToBeAdded = genNewSids(fSIDs.length === 0\n ? f035s\n // test that SIDs are not there yet\n : f035s.filter(f035SidInfo => fSIDs.some(fSIDInfo => f035SidInfo.SID !== fSIDInfo.SID && f035SidInfo.value !== fSIDInfo.value)));\n\n // Add new SIDs\n sidsToBeAdded.forEach(sidField => record.insertField(sidField));\n return record;\n\n function genNewSids(sidsToBeAdded) {\n return sidsToBeAdded.map(sidInfo => ({tag: 'SID', ind1: ' ', ind2: ' ', subfields: [{code: 'c', value: sidInfo.value}, {code: 'b', value: sidInfo.SID}]}));\n }\n\n function sidsToSidInfo(SIDs) {\n return SIDs.flatMap(({subfields}) => {\n const [SID] = subfields.filter(sub => sub.code === 'b' && fSIDFilters.includes(sub.value)).map(sub => sub.value);\n const [value] = subfields.filter(sub => sub.code === 'c' && sub.value !== undefined).map(sub => sub.value);\n\n if (SID && value) {\n return {\n SID,\n value\n };\n }\n\n return undefined;\n }).filter(value => value !== undefined);\n }\n\n function f035ToSidInfo(f035s) {\n return f035s.flatMap(({subfields}) => {\n const [wantedSub] = subfields.filter(sub => sub.code === 'a' && f035Filters.some(regexp => regexp.test(sub.value)));\n\n if (wantedSub) {\n return {\n SID: fSIDFilters[f035Filters.findIndex(regexp => regexp.test(wantedSub.value))],\n value: wantedSub.value.slice(wantedSub.value.indexOf(')') + 1)\n };\n }\n\n return undefined;\n }).filter(value => value !== undefined);\n }\n}\n\n\n"],"mappings":";;;;;;;;;AA4BA;AACA;AACA;AAEA;AACA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAAgC;AAnChC;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;;AAWA,MAAMA,MAAM,GAAG,IAAAC,mCAAY,GAAE;AAC7B,MAAMC,KAAK,GAAG,IAAAC,cAAiB,EAAC,8CAA8C,CAAC;AAC/E,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;AAE/B,SAASC,SAAS,CAACC,MAAM,EAAEC,QAAQ,GAAG,CAAC,CAAC,EAAE;EAE/CR,MAAM,CAACS,OAAO,CAAE,iEAAgEC,IAAI,CAACC,SAAS,CAACH,QAAQ,CAAE,EAAC,CAAC;EAC3G,MAAMI,SAAS,GAAGC,sBAAU,CAACC,KAAK,CAACP,MAAM,EAAE;IAACQ,cAAc,EAAE;EAAK,CAAC,CAAC;EACnEX,SAAS,CAAE,aAAYM,IAAI,CAACC,SAAS,CAACH,QAAQ,CAAE,EAAC,CAAC;;EAElD;;EAEA;EACA,MAAMQ,0BAA0B,GAAGR,QAAQ,CAACS,mBAAmB,IAAIC,SAAS;EAC5E,MAAMC,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,CAAC;MACH;MAEA,OAAO3B,SAAS;IAClB,CAAC,CAAC,CAACuB,MAAM,CAACI,KAAK,IAAIA,KAAK,KAAK3B,SAAS,CAAC;EACzC;EAEA,SAASgC,aAAa,CAACD,KAAK,EAAE;IAC5B,OAAOA,KAAK,CAACmB,OAAO,CAAC,CAAC;MAAC5B;IAAS,CAAC,KAAK;MACpC,MAAM,CAAC8B,SAAS,CAAC,GAAG9B,SAAS,CAACC,MAAM,CAAC4B,GAAG,IAAIA,GAAG,CAAC3B,IAAI,KAAK,GAAG,IAAIK,WAAW,CAACU,IAAI,CAACc,MAAM,IAAIA,MAAM,CAACC,IAAI,CAACH,GAAG,CAACxB,KAAK,CAAC,CAAC,CAAC;MAEnH,IAAIyB,SAAS,EAAE;QACb,OAAO;UACLX,GAAG,EAAEX,WAAW,CAACD,WAAW,CAAC0B,SAAS,CAACF,MAAM,IAAIA,MAAM,CAACC,IAAI,CAACF,SAAS,CAACzB,KAAK,CAAC,CAAC,CAAC;UAC/EA,KAAK,EAAEyB,SAAS,CAACzB,KAAK,CAAC6B,KAAK,CAACJ,SAAS,CAACzB,KAAK,CAAC8B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;QAC/D,CAAC;MACH;MAEA,OAAOzD,SAAS;IAClB,CAAC,CAAC,CAACuB,MAAM,CAACI,KAAK,IAAIA,KAAK,KAAK3B,SAAS,CAAC;EACzC;AACF"}
|
package/dist/helpers/fix.spec.js
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _chai = require("chai");
|
|
4
|
-
|
|
5
4
|
var _marcRecord = require("@natlibfi/marc-record");
|
|
6
|
-
|
|
7
5
|
var _fixura = require("@natlibfi/fixura");
|
|
8
|
-
|
|
9
6
|
var _fixugen = _interopRequireDefault(require("@natlibfi/fixugen"));
|
|
10
|
-
|
|
11
7
|
var _fix = require("./fix");
|
|
12
|
-
|
|
13
8
|
var fixSettings = _interopRequireWildcard(require("./fix-constants"));
|
|
14
|
-
|
|
15
9
|
var _debug = _interopRequireDefault(require("debug"));
|
|
16
|
-
|
|
17
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
-
|
|
19
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
-
|
|
21
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
|
|
23
13
|
//import inspect from 'util';
|
|
14
|
+
|
|
24
15
|
const debug = (0, _debug.default)('@natlibfi/melinda-rest-api-commons:fix:test');
|
|
25
16
|
const debugData = debug.extend('data');
|
|
26
17
|
(0, _fixugen.default)({
|
|
@@ -33,7 +24,6 @@ const debugData = debug.extend('data');
|
|
|
33
24
|
reader: _fixura.READERS.JSON
|
|
34
25
|
}
|
|
35
26
|
});
|
|
36
|
-
|
|
37
27
|
function callback({
|
|
38
28
|
getFixture,
|
|
39
29
|
settings = undefined
|
|
@@ -41,7 +31,6 @@ function callback({
|
|
|
41
31
|
if (settings !== undefined && fixSettings[settings] === undefined) {
|
|
42
32
|
throw new Error(`There are no settings ${settings} defined!`);
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
const runSettings = fixSettings[settings] || settings;
|
|
46
35
|
const record = new _marcRecord.MarcRecord(getFixture('record.json'), {
|
|
47
36
|
subfieldValues: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix.spec.js","names":["debug","createDebugLogger","debugData","extend","generateTests","callback","path","__dirname","recurse","useMetadataFile","fixura","failWhenNotFound","reader","READERS","JSON","getFixture","settings","undefined","fixSettings","Error","runSettings","record","MarcRecord","subfieldValues","expectedRecord","stringify","resultRecord","fixRecord","expect","to","eql"],"sources":["../../src/helpers/fix.spec.js"],"sourcesContent":["import {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen';\nimport {fixRecord} from './fix';\nimport * as fixSettings from './fix-constants';\nimport createDebugLogger from 'debug';\n//import inspect from 'util';\n\nconst debug = createDebugLogger('@natlibfi/melinda-rest-api-commons:fix:test');\nconst debugData = debug.extend('data');\n\ngenerateTests({\n callback,\n path: [__dirname, '..', '..', 'test-fixtures', 'fix'],\n recurse: true,\n useMetadataFile: true,\n fixura: {\n failWhenNotFound: false,\n reader: READERS.JSON\n }\n});\n\nfunction callback({getFixture, settings = undefined}) {\n if (settings !== undefined && fixSettings[settings] === undefined) {\n throw new Error(`There are no settings ${settings} defined!`);\n }\n const runSettings = fixSettings[settings] || settings;\n\n const record = new MarcRecord(getFixture('record.json'), {subfieldValues: false});\n const expectedRecord = getFixture('expectedRecord.json');\n\n debug(`Running fixer with settings ${settings}.`);\n debugData(JSON.stringify(runSettings, null, 2));\n\n const resultRecord = fixRecord(record, runSettings);\n debugData(resultRecord);\n debugData(expectedRecord);\n expect(resultRecord).to.eql(expectedRecord);\n\n}\n"],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"fix.spec.js","names":["debug","createDebugLogger","debugData","extend","generateTests","callback","path","__dirname","recurse","useMetadataFile","fixura","failWhenNotFound","reader","READERS","JSON","getFixture","settings","undefined","fixSettings","Error","runSettings","record","MarcRecord","subfieldValues","expectedRecord","stringify","resultRecord","fixRecord","expect","to","eql"],"sources":["../../src/helpers/fix.spec.js"],"sourcesContent":["import {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen';\nimport {fixRecord} from './fix';\nimport * as fixSettings from './fix-constants';\nimport createDebugLogger from 'debug';\n//import inspect from 'util';\n\nconst debug = createDebugLogger('@natlibfi/melinda-rest-api-commons:fix:test');\nconst debugData = debug.extend('data');\n\ngenerateTests({\n callback,\n path: [__dirname, '..', '..', 'test-fixtures', 'fix'],\n recurse: true,\n useMetadataFile: true,\n fixura: {\n failWhenNotFound: false,\n reader: READERS.JSON\n }\n});\n\nfunction callback({getFixture, settings = undefined}) {\n if (settings !== undefined && fixSettings[settings] === undefined) {\n throw new Error(`There are no settings ${settings} defined!`);\n }\n const runSettings = fixSettings[settings] || settings;\n\n const record = new MarcRecord(getFixture('record.json'), {subfieldValues: false});\n const expectedRecord = getFixture('expectedRecord.json');\n\n debug(`Running fixer with settings ${settings}.`);\n debugData(JSON.stringify(runSettings, null, 2));\n\n const resultRecord = fixRecord(record, runSettings);\n debugData(resultRecord);\n debugData(expectedRecord);\n expect(resultRecord).to.eql(expectedRecord);\n\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAsC;AAAA;AAAA;AACtC;;AAEA,MAAMA,KAAK,GAAG,IAAAC,cAAiB,EAAC,6CAA6C,CAAC;AAC9E,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;AAEtC,IAAAC,gBAAa,EAAC;EACZC,QAAQ;EACRC,IAAI,EAAE,CAACC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,CAAC;EACrDC,OAAO,EAAE,IAAI;EACbC,eAAe,EAAE,IAAI;EACrBC,MAAM,EAAE;IACNC,gBAAgB,EAAE,KAAK;IACvBC,MAAM,EAAEC,eAAO,CAACC;EAClB;AACF,CAAC,CAAC;AAEF,SAAST,QAAQ,CAAC;EAACU,UAAU;EAAEC,QAAQ,GAAGC;AAAS,CAAC,EAAE;EACpD,IAAID,QAAQ,KAAKC,SAAS,IAAIC,WAAW,CAACF,QAAQ,CAAC,KAAKC,SAAS,EAAE;IACjE,MAAM,IAAIE,KAAK,CAAE,yBAAwBH,QAAS,WAAU,CAAC;EAC/D;EACA,MAAMI,WAAW,GAAGF,WAAW,CAACF,QAAQ,CAAC,IAAIA,QAAQ;EAErD,MAAMK,MAAM,GAAG,IAAIC,sBAAU,CAACP,UAAU,CAAC,aAAa,CAAC,EAAE;IAACQ,cAAc,EAAE;EAAK,CAAC,CAAC;EACjF,MAAMC,cAAc,GAAGT,UAAU,CAAC,qBAAqB,CAAC;EAExDf,KAAK,CAAE,+BAA8BgB,QAAS,GAAE,CAAC;EACjDd,SAAS,CAACY,IAAI,CAACW,SAAS,CAACL,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;EAE/C,MAAMM,YAAY,GAAG,IAAAC,cAAS,EAACN,MAAM,EAAED,WAAW,CAAC;EACnDlB,SAAS,CAACwB,YAAY,CAAC;EACvBxB,SAAS,CAACsB,cAAc,CAAC;EACzB,IAAAI,YAAM,EAACF,YAAY,CAAC,CAACG,EAAE,CAACC,GAAG,CAACN,cAAc,CAAC;AAE7C"}
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _marcRecordValidate = _interopRequireDefault(require("@natlibfi/marc-record-validate"));
|
|
9
|
-
|
|
10
8
|
var _marcRecordValidatorsMelinda = require("@natlibfi/marc-record-validators-melinda");
|
|
11
|
-
|
|
12
9
|
var _melindaBackendCommons = require("@natlibfi/melinda-backend-commons");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
*
|
|
18
13
|
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
@@ -65,6 +60,5 @@ var _default = async () => {
|
|
|
65
60
|
};
|
|
66
61
|
};
|
|
67
62
|
};
|
|
68
|
-
|
|
69
63
|
exports.default = _default;
|
|
70
64
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","names":["logger","createLogger","verbose","validate","validateFactory","fieldStructure","tag","valuePattern","unvalidRecord","record","valid","report","fix","validateFixes","subfieldValues","failed","messages"],"sources":["../../src/helpers/validation.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for microservices of Melinda rest api batch import system\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-rest-api-commons\n*\n* melinda-rest-api-commons program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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-rest-api-commons 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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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 validateFactory from '@natlibfi/marc-record-validate';\nimport {\n FieldStructure as fieldStructure\n} from '@natlibfi/marc-record-validators-melinda';\nimport {createLogger} from '@natlibfi/melinda-backend-commons';\n\nexport default async () => {\n const logger = createLogger();\n\n logger.verbose('Running inbuilt record validations');\n const validate = validateFactory([await fieldStructure([{tag: /^003$/u, valuePattern: /^FI-MELINDA$/u}])]);\n\n return async unvalidRecord => {\n const {record, valid, report} = await validate(unvalidRecord, {fix: false, validateFixes: false}, {subfieldValues: false});\n\n return {\n record,\n failed: valid === false,\n messages: report\n };\n };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.js","names":["logger","createLogger","verbose","validate","validateFactory","fieldStructure","tag","valuePattern","unvalidRecord","record","valid","report","fix","validateFixes","subfieldValues","failed","messages"],"sources":["../../src/helpers/validation.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for microservices of Melinda rest api batch import system\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-rest-api-commons\n*\n* melinda-rest-api-commons program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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-rest-api-commons 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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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 validateFactory from '@natlibfi/marc-record-validate';\nimport {\n FieldStructure as fieldStructure\n} from '@natlibfi/marc-record-validators-melinda';\nimport {createLogger} from '@natlibfi/melinda-backend-commons';\n\nexport default async () => {\n const logger = createLogger();\n\n logger.verbose('Running inbuilt record validations');\n const validate = validateFactory([await fieldStructure([{tag: /^003$/u, valuePattern: /^FI-MELINDA$/u}])]);\n\n return async unvalidRecord => {\n const {record, valid, report} = await validate(unvalidRecord, {fix: false, validateFixes: false}, {subfieldValues: false});\n\n return {\n record,\n failed: valid === false,\n messages: report\n };\n };\n};\n"],"mappings":";;;;;;AA4BA;AACA;AAGA;AAA+D;AAhC/D;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;AA1BA,eAkCe,YAAY;EACzB,MAAMA,MAAM,GAAG,IAAAC,mCAAY,GAAE;EAE7BD,MAAM,CAACE,OAAO,CAAC,oCAAoC,CAAC;EACpD,MAAMC,QAAQ,GAAG,IAAAC,2BAAe,EAAC,CAAC,MAAM,IAAAC,2CAAc,EAAC,CAAC;IAACC,GAAG,EAAE,QAAQ;IAAEC,YAAY,EAAE;EAAe,CAAC,CAAC,CAAC,CAAC,CAAC;EAE1G,OAAO,MAAMC,aAAa,IAAI;IAC5B,MAAM;MAACC,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAG,MAAMR,QAAQ,CAACK,aAAa,EAAE;MAACI,GAAG,EAAE,KAAK;MAAEC,aAAa,EAAE;IAAK,CAAC,EAAE;MAACC,cAAc,EAAE;IAAK,CAAC,CAAC;IAE1H,OAAO;MACLL,MAAM;MACNM,MAAM,EAAEL,KAAK,KAAK,KAAK;MACvBM,QAAQ,EAAEL;IACZ,CAAC;EACH,CAAC;AACH,CAAC;AAAA"}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _chai = require("chai");
|
|
4
|
-
|
|
5
4
|
var _fixura = _interopRequireWildcard(require("@natlibfi/fixura"));
|
|
6
|
-
|
|
7
5
|
var _marcRecord = require("@natlibfi/marc-record");
|
|
8
|
-
|
|
9
6
|
var _validation = _interopRequireDefault(require("./validation"));
|
|
10
|
-
|
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
8
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
|
|
15
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
|
|
17
10
|
/**
|
|
18
11
|
*
|
|
19
12
|
* @licstart The following is the entire license notice for the JavaScript code in this file.
|
|
@@ -41,6 +34,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
41
34
|
* for the JavaScript code in this file.
|
|
42
35
|
*
|
|
43
36
|
*/
|
|
37
|
+
|
|
44
38
|
describe('services/validate', () => {
|
|
45
39
|
const FIXTURES_PATH = [__dirname, '..', '..', 'test-fixtures', 'validation'];
|
|
46
40
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.spec.js","names":["describe","FIXTURES_PATH","__dirname","getFixture","fixtureFactory","root","reader","READERS","JSON","it","validator","createValidator","record","MarcRecord","components","result","toObject","expected","expect","to","eql","failed","equal"],"sources":["../../src/helpers/validation.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 microservices of Melinda rest api batch import system\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-rest-api-commons\n*\n* melinda-rest-api-commons program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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-rest-api-commons 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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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 fixtureFactory, {READERS} from '@natlibfi/fixura';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport createValidator from './validation';\n\ndescribe('services/validate', () => {\n const FIXTURES_PATH = [\n __dirname,\n '..',\n '..',\n 'test-fixtures',\n 'validation'\n ];\n const {getFixture} = fixtureFactory({root: FIXTURES_PATH, reader: READERS.JSON});\n\n describe('f003-fi-melinda', () => {\n it('Should have failed: false', async () => {\n const validator = await createValidator();\n const record = new MarcRecord(getFixture({\n components: [\n 'in',\n 'f003-fi-melinda.json'\n ]\n }));\n const result = await validator(record.toObject());\n const expected = getFixture({\n components: [\n 'out',\n 'f003-fi-melinda.json'\n ]\n });\n expect(result).to.eql(expected);\n expect(result.failed).to.equal(false);\n });\n });\n\n describe('f003-not-fi-melinda', () => {\n it('Should have failed: true', async () => {\n const validator = await createValidator();\n const record = new MarcRecord(getFixture({\n components: [\n 'in',\n 'f003-not-fi-melinda.json'\n ]\n }));\n const result = await validator(record.toObject());\n const expected = getFixture({\n components: [\n 'out',\n 'f003-not-fi-melinda.json'\n ]\n });\n expect(result).to.eql(expected);\n expect(result.failed).to.equal(true);\n });\n });\n});\n\n"],"mappings":";;AA4BA
|
|
1
|
+
{"version":3,"file":"validation.spec.js","names":["describe","FIXTURES_PATH","__dirname","getFixture","fixtureFactory","root","reader","READERS","JSON","it","validator","createValidator","record","MarcRecord","components","result","toObject","expected","expect","to","eql","failed","equal"],"sources":["../../src/helpers/validation.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 microservices of Melinda rest api batch import system\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-rest-api-commons\n*\n* melinda-rest-api-commons program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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-rest-api-commons 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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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 fixtureFactory, {READERS} from '@natlibfi/fixura';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport createValidator from './validation';\n\ndescribe('services/validate', () => {\n const FIXTURES_PATH = [\n __dirname,\n '..',\n '..',\n 'test-fixtures',\n 'validation'\n ];\n const {getFixture} = fixtureFactory({root: FIXTURES_PATH, reader: READERS.JSON});\n\n describe('f003-fi-melinda', () => {\n it('Should have failed: false', async () => {\n const validator = await createValidator();\n const record = new MarcRecord(getFixture({\n components: [\n 'in',\n 'f003-fi-melinda.json'\n ]\n }));\n const result = await validator(record.toObject());\n const expected = getFixture({\n components: [\n 'out',\n 'f003-fi-melinda.json'\n ]\n });\n expect(result).to.eql(expected);\n expect(result.failed).to.equal(false);\n });\n });\n\n describe('f003-not-fi-melinda', () => {\n it('Should have failed: true', async () => {\n const validator = await createValidator();\n const record = new MarcRecord(getFixture({\n components: [\n 'in',\n 'f003-not-fi-melinda.json'\n ]\n }));\n const result = await validator(record.toObject());\n const expected = getFixture({\n components: [\n 'out',\n 'f003-not-fi-melinda.json'\n ]\n });\n expect(result).to.eql(expected);\n expect(result.failed).to.equal(true);\n });\n });\n});\n\n"],"mappings":";;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AAM,GAAG,IAAIC,sBAAU,CAACV,UAAU,CAAC;QACvCW,UAAU,EAAE,CACV,IAAI,EACJ,0BAA0B;MAE9B,CAAC,CAAC,CAAC;MACH,MAAMC,MAAM,GAAG,MAAML,SAAS,CAACE,MAAM,CAACI,QAAQ,EAAE,CAAC;MACjD,MAAMC,QAAQ,GAAGd,UAAU,CAAC;QAC1BW,UAAU,EAAE,CACV,KAAK,EACL,0BAA0B;MAE9B,CAAC,CAAC;MACF,IAAAI,YAAM,EAACH,MAAM,CAAC,CAACI,EAAE,CAACC,GAAG,CAACH,QAAQ,CAAC;MAC/B,IAAAC,YAAM,EAACH,MAAM,CAACM,MAAM,CAAC,CAACF,EAAE,CAACG,KAAK,CAAC,IAAI,CAAC;IACtC,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var _exportNames = {
|
|
|
14
14
|
createImportJobState: true,
|
|
15
15
|
createImportJobStateForQuery: true,
|
|
16
16
|
createRecordResponseItem: true,
|
|
17
|
-
addRecordResponseItem: true
|
|
17
|
+
addRecordResponseItem: true,
|
|
18
|
+
addRecordResponseItems: true
|
|
18
19
|
};
|
|
19
20
|
Object.defineProperty(exports, "addRecordResponseItem", {
|
|
20
21
|
enumerable: true,
|
|
@@ -22,6 +23,12 @@ Object.defineProperty(exports, "addRecordResponseItem", {
|
|
|
22
23
|
return _utils.addRecordResponseItem;
|
|
23
24
|
}
|
|
24
25
|
});
|
|
26
|
+
Object.defineProperty(exports, "addRecordResponseItems", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return _utils.addRecordResponseItems;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
25
32
|
Object.defineProperty(exports, "amqpFactory", {
|
|
26
33
|
enumerable: true,
|
|
27
34
|
get: function () {
|
|
@@ -77,25 +84,15 @@ Object.defineProperty(exports, "validations", {
|
|
|
77
84
|
return _validation.default;
|
|
78
85
|
}
|
|
79
86
|
});
|
|
80
|
-
|
|
81
87
|
var _mongo = _interopRequireDefault(require("./mongo"));
|
|
82
|
-
|
|
83
88
|
var _mongoLog = _interopRequireDefault(require("./mongoLog"));
|
|
84
|
-
|
|
85
89
|
var _amqp = _interopRequireDefault(require("./amqp"));
|
|
86
|
-
|
|
87
90
|
var _conversion = _interopRequireDefault(require("./helpers/conversion"));
|
|
88
|
-
|
|
89
91
|
var _validation = _interopRequireDefault(require("./helpers/validation"));
|
|
90
|
-
|
|
91
92
|
var fixes = _interopRequireWildcard(require("./helpers/fix"));
|
|
92
|
-
|
|
93
93
|
exports.fixes = fixes;
|
|
94
|
-
|
|
95
94
|
var _utils = require("./utils");
|
|
96
|
-
|
|
97
95
|
var _constants = require("./constants");
|
|
98
|
-
|
|
99
96
|
Object.keys(_constants).forEach(function (key) {
|
|
100
97
|
if (key === "default" || key === "__esModule") return;
|
|
101
98
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -107,10 +104,7 @@ Object.keys(_constants).forEach(function (key) {
|
|
|
107
104
|
}
|
|
108
105
|
});
|
|
109
106
|
});
|
|
110
|
-
|
|
111
107
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
112
|
-
|
|
113
108
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
114
|
-
|
|
115
109
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
116
110
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"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 microservices of Melinda rest api batch import system\n*\n* Copyright (C) 2020-2021 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-rest-api-commons\n*\n* melinda-rest-api-commons program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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-rest-api-commons 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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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 mongoFactory from './mongo';\nimport mongoLogFactory from './mongoLog';\nimport amqpFactory from './amqp';\nimport conversions from './helpers/conversion';\nimport validations from './helpers/validation';\nimport * as fixes from './helpers/fix';\nimport {logError, createImportJobState, createImportJobStateForQuery, createRecordResponseItem, addRecordResponseItem} from './utils';\n\nexport {mongoFactory, mongoLogFactory, amqpFactory, conversions, validations, fixes, logError, createImportJobState, createImportJobStateForQuery, createRecordResponseItem, addRecordResponseItem};\nexport * from './constants';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"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 microservices of Melinda rest api batch import system\n*\n* Copyright (C) 2020-2021 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-rest-api-commons\n*\n* melinda-rest-api-commons program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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-rest-api-commons 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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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 mongoFactory from './mongo';\nimport mongoLogFactory from './mongoLog';\nimport amqpFactory from './amqp';\nimport conversions from './helpers/conversion';\nimport validations from './helpers/validation';\nimport * as fixes from './helpers/fix';\nimport {logError, createImportJobState, createImportJobStateForQuery, createRecordResponseItem, addRecordResponseItem, addRecordResponseItems} from './utils';\n\nexport {mongoFactory, mongoLogFactory, amqpFactory, conversions, validations, fixes, logError, createImportJobState, createImportJobStateForQuery, createRecordResponseItem, addRecordResponseItem, addRecordResponseItems};\nexport * from './constants';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA;AACA;AACA;AACA;AACA;AACA;AAAuC;AACvC;AAGA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAA4B;AAAA;AAAA"}
|