From e6cbaf356639011502c3fa5519299aa1baeb1194 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Sun, 24 Nov 2024 18:53:07 +0000 Subject: [PATCH] Upgrade grpc lib to 2.x --- package-lock.json | 33 +++++++++++++++---- package.json | 2 +- .../grpc/account/update-pnid-permissions.ts | 2 +- src/services/grpc/api/forgot-password.ts | 2 +- src/services/grpc/api/get-user-data.ts | 2 +- src/services/grpc/api/reset-password.ts | 2 +- .../grpc/api/set-discord-connection-data.ts | 2 +- .../grpc/api/set-stripe-connection-data.ts | 2 +- 8 files changed, 34 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f12631..98322f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.657.0", "@aws-sdk/client-ses": "^3.515.0", - "@pretendonetwork/grpc": "^1.0.5", + "@pretendonetwork/grpc": "^2.0.1", "bcrypt": "^5.0.0", "buffer-crc32": "^0.2.13", "colors": "^1.4.0", @@ -3143,6 +3143,12 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" }, + "node_modules/@bufbuild/protobuf": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.2.2.tgz", + "integrity": "sha512-UNtPCbrwrenpmrXuRwn9jYpPoweNXj8X5sMvYgsqYyaH8jQ6LfUJSk3dJLnBK+6sfYPrF4iAIo5sd5HQ+tg75A==", + "license": "(Apache-2.0 AND BSD-3-Clause)" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -3466,12 +3472,27 @@ } }, "node_modules/@pretendonetwork/grpc": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@pretendonetwork/grpc/-/grpc-1.0.5.tgz", - "integrity": "sha512-l5aB6R7Z2RcX8ds0LIdF7HxW5vMmKdN02G43o+RmUTPCs7ONkwvIL6hIqRAxxNXf4Mz6QYwuTXK96VKWbDgqaQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@pretendonetwork/grpc/-/grpc-2.0.1.tgz", + "integrity": "sha512-Ab4fJxLQoXpnA8JBmrIMZ8uPGqo96WUiI9gy2CYNFpcyvDbQmseygmjHPUNGx+QwskGmdjgXkkHsc/fi1cvYqg==", + "license": "AGPL-3.0-only", "dependencies": { - "long": "^5.2.1", - "protobufjs": "^7.2.3" + "@bufbuild/protobuf": "^2.2.2", + "nice-grpc-common": "^2.0.2", + "typescript": "^5.7.2" + } + }, + "node_modules/@pretendonetwork/grpc/node_modules/typescript": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" } }, "node_modules/@protobufjs/aspromise": { diff --git a/package.json b/package.json index 56b0d77..d37bf35 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "dependencies": { "@aws-sdk/client-s3": "^3.657.0", "@aws-sdk/client-ses": "^3.515.0", - "@pretendonetwork/grpc": "^1.0.5", + "@pretendonetwork/grpc": "^2.0.1", "bcrypt": "^5.0.0", "buffer-crc32": "^0.2.13", "colors": "^1.4.0", diff --git a/src/services/grpc/account/update-pnid-permissions.ts b/src/services/grpc/account/update-pnid-permissions.ts index d547311..0ac7532 100644 --- a/src/services/grpc/account/update-pnid-permissions.ts +++ b/src/services/grpc/account/update-pnid-permissions.ts @@ -2,7 +2,7 @@ import { Status, ServerError } from 'nice-grpc'; import { UpdatePNIDPermissionsRequest } from '@pretendonetwork/grpc/account/update_pnid_permissions'; import { getPNIDByPID } from '@/database'; import { PNID_PERMISSION_FLAGS } from '@/types/common/permission-flags'; -import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty'; +import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty'; export async function updatePNIDPermissions(request: UpdatePNIDPermissionsRequest): Promise { const pnid = await getPNIDByPID(request.pid); diff --git a/src/services/grpc/api/forgot-password.ts b/src/services/grpc/api/forgot-password.ts index 45b9b6e..6fb1812 100644 --- a/src/services/grpc/api/forgot-password.ts +++ b/src/services/grpc/api/forgot-password.ts @@ -3,7 +3,7 @@ import validator from 'validator'; import { ForgotPasswordRequest } from '@pretendonetwork/grpc/api/forgot_password_rpc'; import { getPNIDByEmailAddress, getPNIDByUsername } from '@/database'; import { sendForgotPasswordEmail } from '@/util'; -import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty'; +import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty'; import type { HydratedPNIDDocument } from '@/types/mongoose/pnid'; export async function forgotPassword(request: ForgotPasswordRequest): Promise { diff --git a/src/services/grpc/api/get-user-data.ts b/src/services/grpc/api/get-user-data.ts index 150f6cb..4fa0acc 100644 --- a/src/services/grpc/api/get-user-data.ts +++ b/src/services/grpc/api/get-user-data.ts @@ -1,7 +1,7 @@ import { CallContext } from 'nice-grpc'; import { GetUserDataResponse, DeepPartial } from '@pretendonetwork/grpc/api/get_user_data_rpc'; import { config } from '@/config-manager'; -import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty'; +import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty'; import type { AuthenticationCallContextExt } from '@/services/grpc/api/authentication-middleware'; export async function getUserData(_request: Empty, context: CallContext & AuthenticationCallContextExt): Promise> { diff --git a/src/services/grpc/api/reset-password.ts b/src/services/grpc/api/reset-password.ts index be90236..d9e5cf0 100644 --- a/src/services/grpc/api/reset-password.ts +++ b/src/services/grpc/api/reset-password.ts @@ -3,7 +3,7 @@ import { Status, ServerError } from 'nice-grpc'; import { ResetPasswordRequest } from '@pretendonetwork/grpc/api/reset_password_rpc'; import { decryptToken, unpackToken, nintendoPasswordHash } from '@/util'; import { getPNIDByPID } from '@/database'; -import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty'; +import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty'; import type { Token } from '@/types/common/token'; // * This sucks diff --git a/src/services/grpc/api/set-discord-connection-data.ts b/src/services/grpc/api/set-discord-connection-data.ts index 84688ec..9517d67 100644 --- a/src/services/grpc/api/set-discord-connection-data.ts +++ b/src/services/grpc/api/set-discord-connection-data.ts @@ -1,6 +1,6 @@ import { Status, ServerError, CallContext } from 'nice-grpc'; import { SetDiscordConnectionDataRequest } from '@pretendonetwork/grpc/api/set_discord_connection_data_rpc'; -import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty'; +import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty'; import type { AuthenticationCallContextExt } from '@/services/grpc/api/authentication-middleware'; export async function setDiscordConnectionData(request: SetDiscordConnectionDataRequest, context: CallContext & AuthenticationCallContextExt): Promise{ diff --git a/src/services/grpc/api/set-stripe-connection-data.ts b/src/services/grpc/api/set-stripe-connection-data.ts index 2af96b8..58f959d 100644 --- a/src/services/grpc/api/set-stripe-connection-data.ts +++ b/src/services/grpc/api/set-stripe-connection-data.ts @@ -1,7 +1,7 @@ import { Status, ServerError, CallContext } from 'nice-grpc'; import { SetStripeConnectionDataRequest } from '@pretendonetwork/grpc/api/set_stripe_connection_data_rpc'; import { PNID } from '@/models/pnid'; -import type { Empty } from '@pretendonetwork/grpc/api/google/protobuf/empty'; +import type { Empty } from '@pretendonetwork/grpc/google/protobuf/empty'; import type { AuthenticationCallContextExt } from '@/services/grpc/api/authentication-middleware'; type StripeMongoUpdateScheme = {