Skip to content

Commit

Permalink
chore: upgrade mysql2 to v3 (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina authored Nov 10, 2024
1 parent 5e389d5 commit cb1b783
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/mysql-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@databases/with-container": "^0.0.0",
"modern-spawn": "^1.0.0",
"ms": "^2.1.2",
"mysql2": "^2.2.5",
"mysql2": "^3.11.4",
"parameter-reducers": "^2.0.0",
"type-assertions": "^1.1.0"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/mysql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"@databases/push-to-async-iterable": "^0.0.0",
"@databases/shared": "^0.0.0",
"@databases/sql": "^0.0.0",
"@types/mysql": "^2.15.5",
"mysql2": "^2.2.5"
"mysql2": "^3.11.4"
},
"scripts": {},
"repository": "https://github.com/ForbesLindesay/atdatabases/tree/master/packages/mysql",
Expand Down
4 changes: 2 additions & 2 deletions packages/mysql/src/ConnectionPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ interface MySqlConnectionOptions {
db: string;
table: string;
name: string;
string(): string;
buffer(): Buffer;
string(): string | null;
buffer(): Buffer | null;
geometry(): unknown;
},
next: () => any,
Expand Down
13 changes: 8 additions & 5 deletions packages/mysql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ function validateMySqlUrl(urlString: string) {
}
}

function parseNullable<T, R>(value: T, parser: (value: T) => R): R | null {
function parseNullable<T, R>(
value: T,
parser: (value: NonNullable<T>) => R,
): R | null {
if (value == null) {
return null;
}
Expand All @@ -249,7 +252,7 @@ function parseNullable<T, R>(value: T, parser: (value: T) => R): R | null {

function getTinyIntParser(
mode: 'boolean' | 'number',
): (f: {string(): string}) => any {
): (f: {string(): string | null}) => any {
switch (mode) {
case 'number':
return (f) => parseNullable(f.string(), (s) => parseInt(s, 10));
Expand All @@ -259,7 +262,7 @@ function getTinyIntParser(
}
function getBigIntParser(
mode: 'string' | 'number' | 'bigint',
): (f: {string(): string}) => any {
): (f: {string(): string | null}) => any {
switch (mode) {
case 'number':
return (f) => parseNullable(f.string(), (s) => parseInt(s, 10));
Expand All @@ -272,7 +275,7 @@ function getBigIntParser(
function getDateParser(
mode: 'string' | 'date-object',
timeZone: 'local' | 'utc',
): (f: {string(): string}) => any {
): (f: {string(): string | null}) => any {
switch (mode) {
case 'string':
return (f) => f.string();
Expand Down Expand Up @@ -313,7 +316,7 @@ function getDateParser(
function getDateTimeParser(
mode: 'string' | 'date-object',
timeZone: 'local' | 'utc',
): (f: {string(): string; buffer(): Buffer}) => any {
): (f: {string(): string | null; buffer(): Buffer | null}) => any {
switch (mode) {
case 'string':
return (f) => f.string();
Expand Down
50 changes: 27 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1702,13 +1702,6 @@
resolved "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz"
integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==

"@types/mysql@^2.15.5":
version "2.15.21"
resolved "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.21.tgz"
integrity sha512-NPotx5CVful7yB+qZbWtXL2fA4e7aEHkihHLjklc6ID8aq7bhguHgeIoC1EmSNTAuCgI6ZXrjt2ZSaXnYX0EUg==
dependencies:
"@types/node" "*"

"@types/node@*", "@types/node@^14.14.25", "@types/node@^7.0.31":
version "14.18.36"
resolved "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz"
Expand Down Expand Up @@ -2148,6 +2141,11 @@ aws-sign2@~0.7.0:
resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz"
integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==

aws-ssl-profiles@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz#157dd77e9f19b1d123678e93f120e6f193022641"
integrity sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==

aws4@^1.8.0:
version "1.12.0"
resolved "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz"
Expand Down Expand Up @@ -3359,9 +3357,9 @@ delegates@^1.0.0:
resolved "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz"
integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==

denque@^2.0.1:
denque@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz"
resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1"
integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==

depd@^1.1.2, depd@~1.1.2:
Expand Down Expand Up @@ -5716,10 +5714,10 @@ log-symbols@^5.1.0:
chalk "^5.0.0"
is-unicode-supported "^1.1.0"

long@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/long/-/long-4.0.0.tgz"
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==
long@^5.2.1:
version "5.2.3"
resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1"
integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==

longest-streak@^2.0.0:
version "2.0.4"
Expand Down Expand Up @@ -5752,6 +5750,11 @@ lru-cache@^7.14.1:
resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz"
integrity sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==

lru.min@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/lru.min/-/lru.min-1.1.1.tgz#146e01e3a183fa7ba51049175de04667d5701f0e"
integrity sha512-FbAj6lXil6t8z4z3j0E5mfRlPzxkySotzUHwRXjlpRh10vc6AI6WN62ehZj82VG7M20rqogJ0GLwar2Xa05a8Q==

lsr@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/lsr/-/lsr-2.0.0.tgz"
Expand Down Expand Up @@ -6101,17 +6104,18 @@ [email protected]:
resolved "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz"
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==

mysql2@^2.2.5:
version "2.3.3"
resolved "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz"
integrity sha512-wxJUev6LgMSgACDkb/InIFxDprRa6T95+VEoR+xPvtngtccNH2dGjEB/fVZ8yg1gWv1510c9CvXuJHi5zUm0ZA==
mysql2@^3.11.4:
version "3.11.4"
resolved "https://registry.yarnpkg.com/mysql2/-/mysql2-3.11.4.tgz#08658b6285adbace7d43b2eaa18efddb85f99501"
integrity sha512-Z2o3tY4Z8EvSRDwknaC40MdZ3+m0sKbpnXrShQLdxPrAvcNli7jLrD2Zd2IzsRMw4eK9Yle500FDmlkIqp+krg==
dependencies:
denque "^2.0.1"
aws-ssl-profiles "^1.1.1"
denque "^2.1.0"
generate-function "^2.3.1"
iconv-lite "^0.6.3"
long "^4.0.0"
lru-cache "^6.0.0"
named-placeholders "^1.1.2"
long "^5.2.1"
lru.min "^1.0.0"
named-placeholders "^1.1.3"
seq-queue "^0.0.5"
sqlstring "^2.3.2"

Expand All @@ -6124,9 +6128,9 @@ mz@^2.7.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"

named-placeholders@^1.1.2:
named-placeholders@^1.1.3:
version "1.1.3"
resolved "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.3.tgz"
resolved "https://registry.yarnpkg.com/named-placeholders/-/named-placeholders-1.1.3.tgz#df595799a36654da55dda6152ba7a137ad1d9351"
integrity sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==
dependencies:
lru-cache "^7.14.1"
Expand Down

0 comments on commit cb1b783

Please sign in to comment.