From 22ea2ba46ea0eab5bdec5fe96f0439a72e142dd6 Mon Sep 17 00:00:00 2001 From: build-token <build-token> Date: Mon, 22 Aug 2022 09:20:33 +0000 Subject: [PATCH] publish: remove console.log generated from commit 20ff3c0e232f753e54bcdb70809483e427e76c37 --- index.js | 30 +++++++++++++++++++++++++----- onDeleteAccount.js | 18 ++++++++++++++---- package.json | 4 ++-- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index fad78c6..118d98e 100644 --- a/index.js +++ b/index.js @@ -181041,7 +181041,6 @@ const removeFile = async function (file) { module.exports = saveFiles; module.exports.getFileIfExists = getFileIfExists; -module.exports.sanitizeFileName = sanitizeFileName; function getFileName(entry) { let filename; @@ -181062,9 +181061,7 @@ function getFileName(entry) { } function sanitizeFileName(filename) { - return filename.replace(/^\.+$/, '').replace(/[/?<>\\:*|":]/g, '') // Replace ascii control characters from 00 to 0F - // eslint-disable-next-line no-control-regex - .replace(/[\x00-\x0F]/g, ''); + return filename.replace(/^\.+$/, '').replace(/[/?<>\\:*|":]/g, ''); } function checkFileSize(fileobject) { @@ -223580,6 +223577,18 @@ async function formateDataForDoctype(data) { }) } +/** + * Check if response contains contracts + * @param {string} parsedReply + * @return {boolean} + */ +function checkContractExists(parsedReply) { + const json = JSON.stringify(parsedReply) + return JSON.parse(json)['Envelope']['Body'][ + 'rechercherServicesSouscritsMesuresResponse' + ]['servicesSouscritsMesures'] +} + /** * Format tag in order to be manipulated easly * @param {string} name @@ -223615,6 +223624,7 @@ module.exports = { parseContracts, parseContractStartDate, parseServiceId, + checkContractExists, } @@ -228204,7 +228214,12 @@ module.exports = { terminateContract } // @ts-check const { log, errors } = __webpack_require__(1) const soapRequest = __webpack_require__(1331) -const { parseTags, parseValue, parseContracts } = __webpack_require__(1555) +const { + parseTags, + parseValue, + parseContracts, + checkContractExists, +} = __webpack_require__(1555) const { rechercherServicesSouscritsMesures } = __webpack_require__(1556) const xml2js = __webpack_require__(1513) const { contractState, contractLibelle } = __webpack_require__(1600) @@ -228240,6 +228255,11 @@ async function verifyContract(url, apiAuthKey, appLogin, contractId, pointId) { }) try { + if (!checkContractExists(parsedReply)) { + log('error', 'no contract found') + return null + } + const currentContracts = parseContracts(parsedReply) let currentContract = null if (Array.isArray(currentContracts)) { diff --git a/onDeleteAccount.js b/onDeleteAccount.js index 08fe8dd..f8992eb 100644 --- a/onDeleteAccount.js +++ b/onDeleteAccount.js @@ -180493,7 +180493,6 @@ const removeFile = async function (file) { module.exports = saveFiles; module.exports.getFileIfExists = getFileIfExists; -module.exports.sanitizeFileName = sanitizeFileName; function getFileName(entry) { let filename; @@ -180514,9 +180513,7 @@ function getFileName(entry) { } function sanitizeFileName(filename) { - return filename.replace(/^\.+$/, '').replace(/[/?<>\\:*|":]/g, '') // Replace ascii control characters from 00 to 0F - // eslint-disable-next-line no-control-regex - .replace(/[\x00-\x0F]/g, ''); + return filename.replace(/^\.+$/, '').replace(/[/?<>\\:*|":]/g, ''); } function checkFileSize(fileobject) { @@ -222921,6 +222918,18 @@ async function formateDataForDoctype(data) { }) } +/** + * Check if response contains contracts + * @param {string} parsedReply + * @return {boolean} + */ +function checkContractExists(parsedReply) { + const json = JSON.stringify(parsedReply) + return JSON.parse(json)['Envelope']['Body'][ + 'rechercherServicesSouscritsMesuresResponse' + ]['servicesSouscritsMesures'] +} + /** * Format tag in order to be manipulated easly * @param {string} name @@ -222956,6 +222965,7 @@ module.exports = { parseContracts, parseContractStartDate, parseServiceId, + checkContractExists, } diff --git a/package.json b/package.json index f767edb..54f2e54 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ }, "dependencies": { "axios": "^0.27.2", - "cozy-konnector-libs": "4.55.0", + "cozy-konnector-libs": "4.54.0", "easy-soap-request": "^4.7.0", "jest": "^28.1.3", "moment": "^2.29.3", @@ -54,7 +54,7 @@ "xml2js": "^0.4.23" }, "devDependencies": { - "cozy-jobs-cli": "1.19.1", + "cozy-jobs-cli": "1.18.2", "cozy-konnector-build": "1.3.4", "eslint-config-cozy-app": "1.3.3", "eslint-plugin-prettier": "^4.0.0", -- GitLab