@natlibfi/melinda-rest-api-commons 2.3.0-alpha.4 → 2.3.0-alpha.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.
package/dist/mongoLog.js CHANGED
@@ -61,13 +61,16 @@ async function _default(MONGO_URI) {
61
61
  addLogItem,
62
62
  query,
63
63
  queryById,
64
+ getListOfLogs,
65
+ protect,
64
66
  remove
65
67
  };
66
68
 
67
69
  async function addLogItem(logItem) {
68
70
  const time = (0, _moment.default)().toDate();
69
71
  const newLogItem = { ...logItem,
70
- creationTime: time
72
+ creationTime: time,
73
+ protected: false
71
74
  };
72
75
 
73
76
  try {
@@ -113,17 +116,65 @@ async function _default(MONGO_URI) {
113
116
  return result;
114
117
  }
115
118
 
116
- async function remove(params) {
117
- logger.silly(`${JSON.stringify(params)}`);
118
- logger.info(`Removing from Mongo (${collection}) correlationId: ${params.correlationId}`);
119
- const clean = (0, _mongoSanitize.default)(params.correlationId);
120
- logger.silly(`mongo/remove: clean: ${JSON.stringify(clean)}`);
119
+ async function getListOfLogs(logItemType = 'MERGE_LOG') {
120
+ const result = await db.collection(collection) // eslint-disable-line functional/immutable-data
121
+ .distinct('correlationId', {
122
+ logItemType
123
+ });
124
+ logger.debug(`Query result: ${result.length > 0 ? `Found ${result.length} log items!` : 'Not found!'}`);
125
+ return {
126
+ status: result.length > 0 ? _httpStatus.default.OK : _httpStatus.default.NOT_FOUND,
127
+ payload: result.length > 0 ? result : 'No logs found'
128
+ };
129
+ }
130
+
131
+ async function protect(correlationId, blobSequence) {
132
+ logger.info(`Removing from Mongo (${collection}) correlationId: ${correlationId}, blobSequence: ${blobSequence}`);
133
+ const cleanCorrelationId = (0, _mongoSanitize.default)(correlationId);
134
+ const cleanBlobSequence = (0, _mongoSanitize.default)(blobSequence);
135
+ const filter = blobSequence ? {
136
+ correlationId: cleanCorrelationId,
137
+ blobSequence: cleanBlobSequence
138
+ } : {
139
+ correlationId: cleanCorrelationId
140
+ };
121
141
 
122
142
  try {
123
- await db.collection(collection).deleteMany({
124
- correlationId: clean
143
+ const result = await db.collection(collection).updateMany(filter, {
144
+ $set: {
145
+ modificationTime: (0, _moment.default)().toDate(),
146
+ protect: {
147
+ $not: '$protect'
148
+ }
149
+ }
125
150
  });
126
- return true;
151
+ return {
152
+ status: result.modifiedCount > 0 ? _httpStatus.default.OK : _httpStatus.default.NOT_FOUND,
153
+ payload: result.modifiedCount > 0 ? result : 'No logs found'
154
+ };
155
+ } catch (err) {
156
+ throw new _melindaCommons.Error(_httpStatus.default.INTERNAL_SERVER_ERROR, err.message);
157
+ }
158
+ }
159
+
160
+ async function remove(correlationId, force = false) {
161
+ logger.info(`Removing from Mongo (${collection}) correlationId: ${correlationId}`);
162
+ const clean = (0, _mongoSanitize.default)(correlationId);
163
+ const filter = force ? {
164
+ correlationId: clean
165
+ } : {
166
+ correlationId: clean,
167
+ protected: {
168
+ $ne: true
169
+ }
170
+ };
171
+
172
+ try {
173
+ const result = await db.collection(collection).deleteMany(filter);
174
+ return {
175
+ status: result.deletedCount > 0 ? _httpStatus.default.OK : _httpStatus.default.NOT_FOUND,
176
+ payload: result.deletedCount > 0 ? result : 'No logs found'
177
+ };
127
178
  } catch (err) {
128
179
  throw new _melindaCommons.Error(_httpStatus.default.INTERNAL_SERVER_ERROR, err.message);
129
180
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mongoLog.js","names":["MONGO_URI","logger","createLogger","client","MongoClient","connect","useNewUrlParser","useUnifiedTopology","db","collection","addLogItem","query","queryById","remove","logItem","time","moment","toDate","newLogItem","creationTime","result","insertOne","acknowledged","info","logItemType","correlationId","blobSequenceStart","blobSequenceEnd","ApiError","httpStatus","INTERNAL_SERVER_ERROR","error","logError","params","debug","JSON","stringify","limit","skip","rest","find","sort","blobSequence","parseInt","toArray","length","correlationIdString","silly","clean","sanitize","deleteMany","err","message"],"sources":["../src/mongoLog.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 {MongoClient} from 'mongodb';\nimport {createLogger} from '@natlibfi/melinda-backend-commons';\nimport {Error as ApiError} from '@natlibfi/melinda-commons';\nimport {logError} from './utils.js';\nimport moment from 'moment';\nimport httpStatus from 'http-status';\nimport sanitize from 'mongo-sanitize';\n\nexport default async function (MONGO_URI) {\n const logger = createLogger();\n\n // Connect to mongo (MONGO)\n const client = await MongoClient.connect(MONGO_URI, {useNewUrlParser: true, useUnifiedTopology: true});\n const db = client.db('rest-api');\n const collection = 'logs';\n return {addLogItem, query, queryById, remove};\n\n async function addLogItem(logItem) {\n const time = moment().toDate();\n const newLogItem = {\n ...logItem,\n creationTime: time\n };\n try {\n const result = await db.collection(collection).insertOne(newLogItem);\n if (result.acknowledged) {\n logger.info(`*** New ${logItem.logItemType} added for ${logItem.correlationId} items ${logItem.blobSequenceStart}-${logItem.blobSequenceEnd}. ***`);\n return;\n }\n throw new ApiError(httpStatus.INTERNAL_SERVER_ERROR);\n } catch (error) {\n logError(error);\n throw new ApiError(httpStatus.INTERNAL_SERVER_ERROR);\n }\n }\n\n async function query(params) {\n logger.debug(`Query params: ${JSON.stringify(params)}`);\n const {limit = 5, skip = 0, ...rest} = params;\n const result = await db.collection(collection) // eslint-disable-line functional/immutable-data\n .find(rest)\n .sort({blobSequence: 1})\n .skip(parseInt(skip, 10))\n .limit(parseInt(limit, 10))\n .toArray();\n logger.debug(result);\n logger.debug(`Query result: ${result.length > 0 ? `Found ${result.length} log items! (skip: ${skip} limit: ${limit})` : 'Not found!'}`);\n return result;\n }\n\n async function queryById(correlationIdString, skip = 0, limit = 1) {\n logger.debug(`QueryById: ${correlationIdString}`);\n const result = await db.collection(collection) // eslint-disable-line functional/immutable-data\n .find({correlationId: correlationIdString})\n .sort({blobSequence: 1})\n .skip(parseInt(skip, 10))\n .limit(parseInt(limit, 10))\n .toArray();\n logger.debug(`Query result: ${result.length > 0 ? `Found ${result.length} log items!` : 'Not found!'}`);\n return result;\n }\n\n async function remove(params) {\n logger.silly(`${JSON.stringify(params)}`);\n logger.info(`Removing from Mongo (${collection}) correlationId: ${params.correlationId}`);\n const clean = sanitize(params.correlationId);\n logger.silly(`mongo/remove: clean: ${JSON.stringify(clean)}`);\n\n try {\n await db.collection(collection).deleteMany({correlationId: clean});\n return true;\n } catch (err) {\n throw new ApiError(httpStatus.INTERNAL_SERVER_ERROR, err.message);\n }\n }\n}\n"],"mappings":";;;;;;;AA4BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAlCA;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;AAUe,wBAAgBA,SAAhB,EAA2B;EACxC,MAAMC,MAAM,GAAG,IAAAC,mCAAA,GAAf,CADwC,CAGxC;;EACA,MAAMC,MAAM,GAAG,MAAMC,oBAAA,CAAYC,OAAZ,CAAoBL,SAApB,EAA+B;IAACM,eAAe,EAAE,IAAlB;IAAwBC,kBAAkB,EAAE;EAA5C,CAA/B,CAArB;EACA,MAAMC,EAAE,GAAGL,MAAM,CAACK,EAAP,CAAU,UAAV,CAAX;EACA,MAAMC,UAAU,GAAG,M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AM,CAAC8C,KAAP,CAAc,wBAAuBZ,IAAI,CAACC,SAAL,CAAeY,KAAf,CAAsB,EAA3D;;IAEA,IAAI;MACF,MAAMxC,EAAE,CAACC,UAAH,CAAcA,UAAd,EAA0ByC,UAA1B,CAAqC;QAACzB,aAAa,EAAEuB;MAAhB,CAArC,CAAN;MACA,OAAO,IAAP;IACD,CAHD,CAGE,OAAOG,GAAP,EAAY;MACZ,MAAM,IAAIvB,qBAAJ,CAAaC,mBAAA,CAAWC,qBAAxB,EAA+CqB,GAAG,CAACC,OAAnD,CAAN;IACD;EACF;AACF"}
1
+ {"version":3,"file":"mongoLog.js","names":["MONGO_URI","logger","createLogger","client","MongoClient","connect","useNewUrlParser","useUnifiedTopology","db","collection","addLogItem","query","queryById","getListOfLogs","protect","remove","logItem","time","moment","toDate","newLogItem","creationTime","protected","result","insertOne","acknowledged","info","logItemType","correlationId","blobSequenceStart","blobSequenceEnd","ApiError","httpStatus","INTERNAL_SERVER_ERROR","error","logError","params","debug","JSON","stringify","limit","skip","rest","find","sort","blobSequence","parseInt","toArray","length","correlationIdString","distinct","status","OK","NOT_FOUND","payload","cleanCorrelationId","sanitize","cleanBlobSequence","filter","updateMany","$set","modificationTime","$not","modifiedCount","err","message","force","clean","$ne","deleteMany","deletedCount"],"sources":["../src/mongoLog.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 {MongoClient} from 'mongodb';\nimport {createLogger} from '@natlibfi/melinda-backend-commons';\nimport {Error as ApiError} from '@natlibfi/melinda-commons';\nimport {logError} from './utils.js';\nimport moment from 'moment';\nimport httpStatus from 'http-status';\nimport sanitize from 'mongo-sanitize';\n\nexport default async function (MONGO_URI) {\n const logger = createLogger();\n\n // Connect to mongo (MONGO)\n const client = await MongoClient.connect(MONGO_URI, {useNewUrlParser: true, useUnifiedTopology: true});\n const db = client.db('rest-api');\n const collection = 'logs';\n return {addLogItem, query, queryById, getListOfLogs, protect, remove};\n\n async function addLogItem(logItem) {\n const time = moment().toDate();\n const newLogItem = {\n ...logItem,\n creationTime: time,\n protected: false\n };\n try {\n const result = await db.collection(collection).insertOne(newLogItem);\n if (result.acknowledged) {\n logger.info(`*** New ${logItem.logItemType} added for ${logItem.correlationId} items ${logItem.blobSequenceStart}-${logItem.blobSequenceEnd}. ***`);\n return;\n }\n throw new ApiError(httpStatus.INTERNAL_SERVER_ERROR);\n } catch (error) {\n logError(error);\n throw new ApiError(httpStatus.INTERNAL_SERVER_ERROR);\n }\n }\n\n async function query(params) {\n logger.debug(`Query params: ${JSON.stringify(params)}`);\n const {limit = 5, skip = 0, ...rest} = params;\n const result = await db.collection(collection) // eslint-disable-line functional/immutable-data\n .find(rest)\n .sort({blobSequence: 1})\n .skip(parseInt(skip, 10))\n .limit(parseInt(limit, 10))\n .toArray();\n logger.debug(result);\n logger.debug(`Query result: ${result.length > 0 ? `Found ${result.length} log items! (skip: ${skip} limit: ${limit})` : 'Not found!'}`);\n return result;\n }\n\n async function queryById(correlationIdString, skip = 0, limit = 1) {\n logger.debug(`QueryById: ${correlationIdString}`);\n const result = await db.collection(collection) // eslint-disable-line functional/immutable-data\n .find({correlationId: correlationIdString})\n .sort({blobSequence: 1})\n .skip(parseInt(skip, 10))\n .limit(parseInt(limit, 10))\n .toArray();\n logger.debug(`Query result: ${result.length > 0 ? `Found ${result.length} log items!` : 'Not found!'}`);\n return result;\n }\n\n async function getListOfLogs(logItemType = 'MERGE_LOG') {\n const result = await db.collection(collection) // eslint-disable-line functional/immutable-data\n .distinct('correlationId', {logItemType});\n logger.debug(`Query result: ${result.length > 0 ? `Found ${result.length} log items!` : 'Not found!'}`);\n return {status: result.length > 0 ? httpStatus.OK : httpStatus.NOT_FOUND, payload: result.length > 0 ? result : 'No logs found'};\n }\n\n async function protect(correlationId, blobSequence) {\n logger.info(`Removing from Mongo (${collection}) correlationId: ${correlationId}, blobSequence: ${blobSequence}`);\n const cleanCorrelationId = sanitize(correlationId);\n const cleanBlobSequence = sanitize(blobSequence);\n const filter = blobSequence ? {correlationId: cleanCorrelationId, blobSequence: cleanBlobSequence} : {correlationId: cleanCorrelationId};\n\n try {\n const result = await db.collection(collection).updateMany(\n filter,\n {\n $set: {\n modificationTime: moment().toDate(),\n protect: {$not: '$protect'}\n }\n }\n );\n return {status: result.modifiedCount > 0 ? httpStatus.OK : httpStatus.NOT_FOUND, payload: result.modifiedCount > 0 ? result : 'No logs found'};\n } catch (err) {\n throw new ApiError(httpStatus.INTERNAL_SERVER_ERROR, err.message);\n }\n }\n\n async function remove(correlationId, force = false) {\n logger.info(`Removing from Mongo (${collection}) correlationId: ${correlationId}`);\n const clean = sanitize(correlationId);\n const filter = force ? {correlationId: clean} : {correlationId: clean, protected: {$ne: true}};\n\n try {\n const result = await db.collection(collection).deleteMany(filter);\n return {status: result.deletedCount > 0 ? httpStatus.OK : httpStatus.NOT_FOUND, payload: result.deletedCount > 0 ? result : 'No logs found'};\n } catch (err) {\n throw new ApiError(httpStatus.INTERNAL_SERVER_ERROR, err.message);\n }\n }\n}\n"],"mappings":";;;;;;;AA4BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAlCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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CAHD,CAGE,OAAOyC,GAAP,EAAY;MACZ,MAAM,IAAIjC,qBAAJ,CAAaC,mBAAA,CAAWC,qBAAxB,EAA+C+B,GAAG,CAACC,OAAnD,CAAN;IACD;EACF;AACF"}
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "url": "git@github.com:natlibfi/melinda-rest-api-commons.git"
15
15
  },
16
16
  "license": "AGPL-3.0+",
17
- "version": "2.3.0-alpha.4",
17
+ "version": "2.3.0-alpha.5",
18
18
  "main": "./dist/index.js",
19
19
  "engines": {
20
20
  "node": ">=14"