Skip to content

Commit

Permalink
npm updates (#1151)
Browse files Browse the repository at this point in the history
* npm update

* newrelic update

* more major version updates

* stripe update; mongo revert

* fix deprecated firebase function
  • Loading branch information
sspenst authored Aug 18, 2024
1 parent 2af98c5 commit 164a672
Show file tree
Hide file tree
Showing 9 changed files with 2,622 additions and 3,726 deletions.
7 changes: 7 additions & 0 deletions lib/appSocketToClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export function GenMongoWSEmitter(mongooseConnection: Mongoose) {
}

const db = mongooseConnection.connection.db;

if (!db) {
logger.error('GenMongoWSEmitter - Could not get db from mongoose connection');

return null;
}

const collection = db.collection('socket.io-adapter-events');

logger.warn('Created MongoEmitter');
Expand Down
6,234 changes: 2,554 additions & 3,680 deletions package-lock.json

Large diffs are not rendered by default.

80 changes: 38 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,33 @@
"@root": "dist"
},
"dependencies": {
"@aws-sdk/client-ses": "^3.577.0",
"@aws-sdk/credential-provider-node": "^3.577.0",
"@headlessui/react": "^1.7.19",
"@headlessui/tailwindcss": "^0.2.0",
"@newrelic/next": "^0.9.0",
"@next/third-parties": "^14.2.3",
"@openreplay/tracker": "^12.0.12",
"@aws-sdk/client-ses": "^3.632.0",
"@aws-sdk/credential-provider-node": "^3.632.0",
"@headlessui/react": "^2.1.2",
"@headlessui/tailwindcss": "^0.2.1",
"@next/third-parties": "^14.2.5",
"@openreplay/tracker": "^14.0.4",
"@popperjs/core": "^2.11.8",
"@socket.io/mongo-adapter": "^0.3.2",
"@socket.io/mongo-emitter": "^0.2.0",
"bcryptjs": "^2.4.3",
"cal-heatmap": "^4.2.4",
"canvas-confetti": "^1.9.3",
"cookie": "^0.6.0",
"dayjs": "^1.11.11",
"debounce": "^2.0.0",
"dayjs": "^1.11.12",
"debounce": "^2.1.0",
"dotenv": "^16.4.5",
"firebase-admin": "^12.0.0",
"firebase-admin": "^12.3.1",
"jsonwebtoken": "^9.0.2",
"micro": "^10.0.1",
"module-alias": "^2.2.3",
"mongodb-memory-server": "^9.2.0",
"mongoose": "^8.4.0",
"newrelic": "^11.17.0",
"next": "^14.2.3",
"mongodb-memory-server": "^9.4.1",
"mongoose": "^8.5.3",
"newrelic": "^12.1.1",
"next": "^14.2.5",
"next-seo": "^6.5.0",
"next-themes": "^0.3.0",
"nodemailer": "^6.9.13",
"nodemailer": "^6.9.14",
"nprogress": "^0.2.0",
"pureimage": "^0.4.13",
"react": "^18.3.1",
Expand All @@ -50,20 +49,20 @@
"react-simple-star-rating": "^5.1.7",
"react-step-wizard": "^5.3.11",
"react-textarea-autosize": "^8.5.3",
"react-tooltip": "^5.26.4",
"react-tooltip": "^5.28.0",
"recharts": "^2.12.7",
"request-ip": "^3.3.0",
"sharp": "^0.33.4",
"sharp": "^0.33.5",
"socket.io": "^4.7.5",
"socket.io-client": "^4.7.5",
"stripe": "^15.7.0",
"stripe": "^16.8.0",
"swr": "^2.2.5",
"throttle-debounce": "^5.0.0",
"throttle-debounce": "^5.0.2",
"tsc": "^2.0.4",
"winston": "^3.13.0"
"winston": "^3.14.2"
},
"scripts": {
"start": "NODE_OPTIONS='-r @newrelic/next' next start",
"start": "NODE_OPTIONS='-r newrelic' next start",
"build": "next build",
"dev": "next dev",
"lint": "next lint",
Expand All @@ -90,16 +89,13 @@
]
},
"devDependencies": {
"@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@swc/core": "^1.5.7",
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@swc/core": "^1.7.11",
"@swc/jest": "^0.2.36",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@testing-library/user-event": "^14.5.2",
"@types/bcryptjs": "^2.4.6",
"@types/canvas-confetti": "^1.6.4",
"@types/cli-progress": "^3.11.5",
"@types/cli-progress": "^3.11.6",
"@types/cookie": "^0.6.0",
"@types/debounce": "^1.2.4",
"@types/html-to-text": "^9.0.4",
Expand All @@ -108,40 +104,40 @@
"@types/lodash-es": "^4.17.12",
"@types/mmmagic": "^0.4.33",
"@types/newrelic": "^9.14.4",
"@types/node": "^20.12.12",
"@types/node": "^22.4.0",
"@types/nodemailer": "^6.4.15",
"@types/nprogress": "^0.2.3",
"@types/react": "^18.3.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/react-google-recaptcha": "^2.1.9",
"@types/react-gtm-module": "^2.0.3",
"@types/recharts": "^1.8.29",
"@types/request-ip": "^0.0.41",
"@types/throttle-debounce": "^5.0.2",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"autoprefixer": "^10.4.19",
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"autoprefixer": "^10.4.20",
"babel-jest": "^29.7.0",
"classnames": "^2.5.1",
"cli-progress": "^3.12.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-config-next": "^14.2.5",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"html-to-text": "^9.0.5",
"jest": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"jest-slow-test-reporter": "^1.0.0",
"leaked-handles": "^5.2.0",
"mockdate": "^3.0.5",
"next-test-api-route-handler": "^4.0.7",
"postcss": "^8.4.38",
"next-test-api-route-handler": "^4.0.8",
"postcss": "^8.4.41",
"react-test-renderer": "^18.3.1",
"tailwindcss": "^3.4.3",
"ts-jest": "^29.1.3",
"tailwindcss": "^3.4.10",
"ts-jest": "^29.2.4",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.4.5"
"typescript": "^5.5.4"
}
}
5 changes: 5 additions & 0 deletions pages/api/internal-jobs/worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ export async function processQueueMessages() {
console.log('disconnected. connecting');
await dbConnect();
console.log('connected. validating');

if (!db) {
throw new Error('processQueueMessages - Could not get db from mongoose connection');
}

const whatever = await db.command({ validate: QueueMessageModel.collection.name });

console.log('] VALIDATE DONE. PRINTING [');
Expand Down
2 changes: 1 addition & 1 deletion pages/api/internal-jobs/worker/sendPushNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function sendPushNotification(gameId: GameId, notification: Notific
});
}

const res = await global.firebaseApp.messaging().sendMulticast({
const res = await global.firebaseApp.messaging().sendEachForMulticast({
tokens: tokens,
data: {
notificationId: notification._id.toString(),
Expand Down
2 changes: 1 addition & 1 deletion pages/api/subscription/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { UserModel } from '../../../models/mongoose';
const STRIPE_SECRET = process.env.STRIPE_SECRET as string;

export const STRIPE_WEBHOOK_SECRET = process.env.STRIPE_WEBHOOK_SECRET as string;
export const stripe = new Stripe(STRIPE_SECRET, { apiVersion: '2024-04-10' });
export const stripe = new Stripe(STRIPE_SECRET, { apiVersion: '2024-06-20' });

export interface SubscriptionData {
cancel_at: number | null;
Expand Down
6 changes: 6 additions & 0 deletions server/socket/socket-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ export default async function startSocketIOServer(server: Server) {
GlobalSocketIO = server;
const db = mongooseConnection.connection.db;

if (!db) {
logger.error('startSocketIOServer - Could not get db from mongoose connection');

return;
}

try {
await db.createCollection('socket.io-adapter-events', {
capped: true,
Expand Down
4 changes: 2 additions & 2 deletions tests/pages/api/stripe/stripe-webhook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ const DefaultReq = {
},
};
const stripe = new Stripe('', {
apiVersion: '2024-04-10',
apiVersion: '2024-06-20',
});
const stripe_secret = process.env.NODE_ENV !== 'test' ? process.env.STRIPE_WEBHOOK_SECRET : 'whsec_test_secret';

function createMockStripeEvent(type: string, data = {}) {
return {
id: `evt_${Date.now()}`,
object: 'event',
api_version: '2024-04-10',
api_version: '2024-06-20',
created: Date.now(),
data: {
object: data,
Expand Down
8 changes: 8 additions & 0 deletions tests/pages/api/subscription/mockSubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const mockSubscription: Stripe.Subscription = {
discount: null,
discounts: [],
ended_at: null,
invoice_settings: {
account_tax_ids: null,
issuer: {
type: 'self',
},
},
items: {
object: 'list',
data: [
Expand All @@ -58,6 +64,7 @@ const mockSubscription: Stripe.Subscription = {
interval_count: 1,
livemode: false,
metadata: {},
meter: null,
nickname: null,
product: 'prod_123',
tiers_mode: null,
Expand All @@ -82,6 +89,7 @@ const mockSubscription: Stripe.Subscription = {
aggregate_usage: null,
interval: 'month',
interval_count: 1,
meter: null,
trial_period_days: null,
usage_type: 'licensed'
},
Expand Down

0 comments on commit 164a672

Please sign in to comment.