From a4b231a79358d36be437450f61145cc835186681 Mon Sep 17 00:00:00 2001 From: Leo <145344770+LGin-BJSS@users.noreply.github.com> Date: Fri, 31 May 2024 11:32:07 +0100 Subject: [PATCH] CB2-11778: Fix critical dependency on mysql2 package (#91) * feat(cb2-11778): add explicit charset to mysql connection * feat(cb2-11778): additional lint change * feat(cb2-11778): update evl query following database change --- package-lock.json | 26 ++++++++++++++++---------- package.json | 2 +- src/app/queries/evlQuery.ts | 10 +--------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index dbf02c3..272ded6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "aws-lambda": "1.0.6", "express": "4.18.2", "moment": "2.29.4", - "mysql2": "3.9.7", + "mysql2": "3.9.8", "serverless-http": "2.6.0", "source-map-support": "0.5.19", "winston": "^3.7.2", @@ -9982,7 +9982,8 @@ }, "node_modules/generate-function": { "version": "2.3.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", "dependencies": { "is-property": "^1.0.2" } @@ -11093,7 +11094,8 @@ }, "node_modules/is-property": { "version": "1.0.2", - "license": "MIT" + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==" }, "node_modules/is-regex": { "version": "1.1.4", @@ -12933,9 +12935,9 @@ "license": "ISC" }, "node_modules/mysql2": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.7.tgz", - "integrity": "sha512-KnJT8vYRcNAZv73uf9zpXqNbvBG7DJrs+1nACsjZP1HMJ1TgXEy8wnNilXAn/5i57JizXKtrUtwDB7HxT9DDpw==", + "version": "3.9.8", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.8.tgz", + "integrity": "sha512-+5JKNjPuks1FNMoy9TYpl77f+5frbTklz7eb3XDwbpsERRLEeXiW2PDEkakYF50UuKU2qwfGnyXpKYvukv8mGA==", "dependencies": { "denque": "^2.1.0", "generate-function": "^2.3.1", @@ -12952,7 +12954,8 @@ }, "node_modules/mysql2/node_modules/iconv-lite": { "version": "0.6.3", - "license": "MIT", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -15308,7 +15311,9 @@ "license": "MIT" }, "node_modules/seq-queue": { - "version": "0.0.5" + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", + "integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q==" }, "node_modules/serialize-javascript": { "version": "6.0.0", @@ -16332,8 +16337,9 @@ } }, "node_modules/sqlstring": { - "version": "2.3.2", - "license": "MIT", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz", + "integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==", "engines": { "node": ">= 0.6" } diff --git a/package.json b/package.json index 2090e9a..bebaf2a 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "aws-lambda": "1.0.6", "express": "4.18.2", "moment": "2.29.4", - "mysql2": "3.9.7", + "mysql2": "3.9.8", "serverless-http": "2.6.0", "source-map-support": "0.5.19", "winston": "^3.7.2", diff --git a/src/app/queries/evlQuery.ts b/src/app/queries/evlQuery.ts index 60da24a..0837a02 100644 --- a/src/app/queries/evlQuery.ts +++ b/src/app/queries/evlQuery.ts @@ -1,12 +1,4 @@ -const EVL_QUERY = ` -SET @prev := ''; -SELECT testExpiryDate, vrm_trm, certificateNumber -FROM ( - SELECT testExpiryDate, vrm_trm, certificateNumber, IF(@prev <> vrm_trm, @rn:=0,@rn) AS row_number_over_partition, @prev:=vrm_trm, @rn:=@rn+1 AS rn - FROM evl_view -) as SubQ -WHERE row_number_over_partition = 0 -`; +const EVL_QUERY = `SELECT testExpiryDate, vrm_trm, certificateNumber FROM evl_view`; const EVL_VRM_QUERY = `${EVL_QUERY} AND vrm_trm = ?;`;