Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade grpc lib to 2.x #126

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
566 changes: 411 additions & 155 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.1",
"bcrypt": "^5.0.0",
"buffer-crc32": "^0.2.13",
"colors": "^1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/account/update-pnid-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Empty> {
const pnid = await getPNIDByPID(request.pid);
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/api/forgot-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Empty> {
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/api/get-user-data.ts
Original file line number Diff line number Diff line change
@@ -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<DeepPartial<GetUserDataResponse>> {
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/api/reset-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/services/grpc/api/set-discord-connection-data.ts
Original file line number Diff line number Diff line change
@@ -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<Empty>{
Expand Down
12 changes: 1 addition & 11 deletions src/services/grpc/api/set-stripe-connection-data.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
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 = {
access_level?: number;
server_access_level?: string;
'connections.stripe.customer_id'?: string;
'connections.stripe.subscription_id'?: string;
'connections.stripe.price_id'?: string;
Expand All @@ -29,14 +27,6 @@ export async function setStripeConnectionData(request: SetStripeConnectionDataRe

// * These checks allow for null/0 values in order to reset data if needed

if (request.accessLevel !== undefined) {
updateData.access_level = request.accessLevel;
}

if (request.serverAccessLevel !== undefined) {
updateData.server_access_level = request.serverAccessLevel;
}

if (request.subscriptionId !== undefined) {
updateData['connections.stripe.subscription_id'] = request.subscriptionId;
}
Expand Down
Loading