Convert files to ES modules

GitOrigin-RevId: 713430521d60f37ee20906bb2d5d0a56849a729d
This commit is contained in:
Andrew Rumble
2025-09-12 08:07:16 +00:00
committed by Copybot
parent ad4f376431
commit f295bbc3be
10 changed files with 111 additions and 118 deletions
@@ -1,6 +1,3 @@
/* eslint-disable
no-dupe-keys,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
@@ -9,14 +6,15 @@
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const { db, ObjectId } = require('./mongodb')
const request = require('request')
const async = require('async')
const settings = require('@overleaf/settings')
const { port } = settings.internal.notifications
const logger = require('@overleaf/logger')
import { db, ObjectId } from './mongodb.js'
import request from 'request'
import async from 'async'
import settings from '@overleaf/settings'
import logger from '@overleaf/logger'
module.exports = {
const { port } = settings.internal.notifications
export default {
check(callback) {
const userId = new ObjectId()
const cleanupNotifications = callback =>
@@ -28,7 +26,7 @@ module.exports = {
timeout: 5000,
})
logger.debug(
{ userId, opts: getOpts(), key: notificationKey, userId },
{ opts: getOpts(), key: notificationKey, userId },
'Health Check: running'
)
const jobs = [
+3 -14
View File
@@ -1,18 +1,7 @@
/* eslint-disable
no-unused-vars,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const logger = require('@overleaf/logger')
const { db, ObjectId } = require('./mongodb')
import logger from '@overleaf/logger'
import { db, ObjectId } from './mongodb.js'
module.exports = {
export default {
getUserNotifications(userId, callback) {
if (callback == null) {
callback = function () {}
@@ -6,11 +6,11 @@
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const Notifications = require('./Notifications')
const logger = require('@overleaf/logger')
const metrics = require('@overleaf/metrics')
import logger from '@overleaf/logger'
import metrics from '@overleaf/metrics'
import Notifications from './Notifications.js'
module.exports = {
export default {
getUserNotifications(req, res, next) {
logger.debug(
{ userId: req.params.user_id },
+12 -16
View File
@@ -1,26 +1,22 @@
// @ts-check
import Metrics from '@overleaf/metrics'
import MongoUtils from '@overleaf/mongo-utils'
import Settings from '@overleaf/settings'
import mongodb from 'mongodb-legacy'
const Metrics = require('@overleaf/metrics')
const MongoUtils = require('@overleaf/mongo-utils')
const Settings = require('@overleaf/settings')
const { MongoClient, ObjectId } = require('mongodb-legacy')
const mongoClient = new MongoClient(Settings.mongo.url, Settings.mongo.options)
export const mongoClient = new mongodb.MongoClient(
Settings.mongo.url,
Settings.mongo.options
)
const mongoDb = mongoClient.db()
const db = {
export const db = {
notifications: mongoDb.collection('notifications'),
}
export const ObjectId = mongodb.ObjectId
Metrics.mongodb.monitor(mongoClient)
async function cleanupTestDatabase() {
export async function cleanupTestDatabase() {
await MongoUtils.cleanupTestDatabase(mongoClient)
}
module.exports = {
db,
mongoClient,
ObjectId,
cleanupTestDatabase,
}