Skip to content

Commit

Permalink
Vite: Update namespace imports
Browse files Browse the repository at this point in the history
  • Loading branch information
sorja committed Jan 8, 2025
1 parent 63ade74 commit 093df7a
Show file tree
Hide file tree
Showing 41 changed files with 65 additions and 80 deletions.
2 changes: 1 addition & 1 deletion src/server/api/auth/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Express } from 'express'
import * as passport from 'passport'
import passport from 'passport'

import { User } from 'meta/user'

Expand Down
2 changes: 1 addition & 1 deletion src/server/api/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Express } from 'express'
import * as passport from 'passport'
import passport from 'passport'

import { ApiEndPoint } from 'meta/api/endpoint'

Expand Down
2 changes: 1 addition & 1 deletion src/server/api/auth/login.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NextFunction, Request, Response } from 'express'
import * as passport from 'passport'
import passport from 'passport'

import { LoginRequest } from 'meta/api/request'
import { AuthToken } from 'meta/auth'
Expand Down
3 changes: 1 addition & 2 deletions src/server/api/auth/strategy/google.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Request } from 'express'
import { PassportStatic } from 'passport'
import * as GoogleStrategy from 'passport-google-oauth'
import { Profile, VerifyFunction } from 'passport-google-oauth'
import GoogleStrategy, { Profile, VerifyFunction } from 'passport-google-oauth'

import { ApiEndPoint } from 'meta/api/endpoint'
import { AuthProvider } from 'meta/user'
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/auth/strategy/local.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Request } from 'express'
import { PassportStatic } from 'passport'
import { VerifiedCallback } from 'passport-jwt'
import * as passportLocal from 'passport-local'
import passportLocal from 'passport-local'
import { Objects } from 'utils/objects'

import { AuthProvider, Users } from 'meta/user'
Expand Down
5 changes: 3 additions & 2 deletions src/server/api/auth/utils/passwordUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as bcrypt from 'bcrypt'
import bcrypt from 'bcrypt'

export const passwordCompare = async (password: string, password2: string): Promise<boolean> => bcrypt.compare(password, password2)
export const passwordCompare = async (password: string, password2: string): Promise<boolean> =>
bcrypt.compare(password, password2)

export const passwordHash = async (password: string): Promise<string> => bcrypt.hash(password, 10)
4 changes: 2 additions & 2 deletions src/server/api/auth/utils/setAuthToken.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Dates } from 'utils/dates'
import { Response } from 'express'
import * as jwt from 'jsonwebtoken'
import jwt from 'jsonwebtoken'
import { Dates } from 'utils/dates'

import { AuthToken } from 'meta/auth'
import { User } from 'meta/user'
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/cycleData/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Express } from 'express'
// @ts-ignore
import * as queue from 'express-queue'
import queue from 'express-queue'

import { ApiEndPoint } from 'meta/api/endpoint'

Expand Down
2 changes: 1 addition & 1 deletion src/server/api/definitions/utils/getHtml.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fs from 'fs'
import fs from 'fs'
import { marked } from 'marked'

type Props = { assessmentName: string; cycleName: string; lang: string; name: string }
Expand Down
5 changes: 3 additions & 2 deletions src/server/api/user/getProfilePicture.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import path from 'path'
import { Request, Response } from 'express'
import * as path from 'path'
import Requests from 'server/utils/requests'

import { UserController } from 'server/controller/user'
import Requests from 'server/utils/requests'

export const getProfilePicture = async (req: Request, res: Response) => {
const { id } = req.params
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/user/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Express } from 'express'
import * as multer from 'multer'
import multer from 'multer'

import { ApiEndPoint } from 'meta/api/endpoint'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as dns from 'dns'
import dns from 'dns'
import { Objects } from 'utils/objects'

import { LinkToVisit, LinkValidationStatusCode, VisitedLink } from 'meta/cycleData'
Expand Down
2 changes: 1 addition & 1 deletion src/server/db/db.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { Logger } from '../utils/logger'
import { ProcessEnv } from '../utils/processEnv'
Expand Down
2 changes: 1 addition & 1 deletion src/server/repository/assessment/col/cloneMany.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { Assessment, Col, Cols, Cycle } from 'meta/assessment'

Expand Down
2 changes: 1 addition & 1 deletion src/server/repository/assessment/row/cloneMany.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { Assessment, Cycle, Row, Rows } from 'meta/assessment'

Expand Down
2 changes: 1 addition & 1 deletion src/server/repository/assessment/section/cloneMany.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { Assessment, Cycle, Section, Sections, SubSection, SubSections } from 'meta/assessment'

Expand Down
2 changes: 1 addition & 1 deletion src/server/repository/assessment/table/cloneMany.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { Assessment, Cycle, Table, Tables } from 'meta/assessment'

Expand Down
2 changes: 1 addition & 1 deletion src/server/repository/assessment/tableSection/cloneMany.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { Assessment, Cycle, TableSection, TableSections } from 'meta/assessment'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { CountryIso } from 'meta/area'
import { Assessment, Cycle } from 'meta/assessment'
Expand Down
2 changes: 1 addition & 1 deletion src/server/repository/assessmentCycle/links/upsertMany.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'
import { Objects } from 'utils/objects'

import { Assessment, Cycle } from 'meta/assessment'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'
import { Objects } from 'utils/objects'

import { Assessment, Cycle, Node } from 'meta/assessment'
Expand Down
2 changes: 1 addition & 1 deletion src/server/repository/public/activityLog/massiveInsert.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { BaseProtocol, DB } from 'server/db'

Expand Down
14 changes: 7 additions & 7 deletions src/server/serverInit.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as path from 'path'
import * as bodyParser from 'body-parser'
import * as compression from 'compression'
import * as wwwhisper from 'connect-wwwhisper'
import * as cookieParser from 'cookie-parser'
import * as express from 'express'
import * as morgan from 'morgan'
import path from 'path'
import bodyParser from 'body-parser'
import compression from 'compression'
import wwwhisper from 'connect-wwwhisper'
import cookieParser from 'cookie-parser'
import express from 'express'
import morgan from 'morgan'

import { Api } from 'server/api'
import { Proxy } from 'server/proxy/proxy'
Expand Down
5 changes: 2 additions & 3 deletions src/server/service/export/queryToCsvStream.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import QueryStream = require('pg-query-stream')
import { pipeline, Transform } from 'stream'
import * as fastCsv from 'fast-csv'
import { ParserRow } from 'fast-csv'
import * as pgPromise from 'pg-promise'
import fastCsv, { ParserRow } from 'fast-csv'
import pgPromise from 'pg-promise'

import { BaseProtocol, DB } from 'server/db'
import { Logger } from 'server/utils/logger'
Expand Down
4 changes: 2 additions & 2 deletions src/server/service/file/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'fs'
import * as path from 'path'
import fs from 'fs'
import path from 'path'
import { Response } from 'express'

type Type = {
Expand Down
2 changes: 1 addition & 1 deletion src/server/service/mail/mail.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as nodemailer from 'nodemailer'
import nodemailer from 'nodemailer'

import { remindReviewers } from 'server/service/mail/remindReviewers'
import { ProcessEnv } from 'server/utils'
Expand Down
2 changes: 1 addition & 1 deletion src/server/service/socket/socketService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as http from 'http'
import http from 'http'
import { createAdapter } from '@socket.io/redis-streams-adapter'
import { createClient } from 'redis'
import { Server } from 'socket.io'
Expand Down
4 changes: 2 additions & 2 deletions src/server/utils/fileCSV.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'fs'
import * as fastCsv from 'fast-csv'
import fs from 'fs'
import fastCsv from 'fast-csv'

const read = async <RowType>(fileName: string, options?: fastCsv.ParserOptionsArgs): Promise<Array<RowType>> => {
const opts: fastCsv.ParserOptionsArgs = {
Expand Down
2 changes: 1 addition & 1 deletion src/server/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as winston from 'winston'
import winston from 'winston'

import { ProcessEnv } from './processEnv'

Expand Down
2 changes: 1 addition & 1 deletion src/server/utils/processEnv.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as process from 'process'
import process from 'process'

const dbUrl = process.env.DATABASE_URL

Expand Down
2 changes: 1 addition & 1 deletion src/server/utils/responses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as archiver from 'archiver'
import archiver from 'archiver'
import { Response } from 'express'

import Requests from 'server/utils/requests'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'
import { Objects } from 'utils/objects'

import { ActivityLog } from 'meta/assessment'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { BaseProtocol } from 'server/db'

Expand Down
2 changes: 1 addition & 1 deletion src/tools/geo/boundsImport.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs/promises'
import * as path from 'path'
import { config } from 'dotenv'
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { CountryIso } from 'meta/area'

Expand Down
2 changes: 1 addition & 1 deletion src/tools/geo/forestEstimationsImport.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs/promises'
import * as path from 'path'
import { config } from 'dotenv'
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'
import { Objects } from 'utils/objects'

import { CountryIso } from 'meta/area'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as pgPromise from 'pg-promise'
import pgPromise from 'pg-promise'

import { DB } from 'server/db'

Expand Down
15 changes: 5 additions & 10 deletions src/utils/arrays.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// @ts-ignore
import * as differenceWith from 'lodash.differencewith'
// @ts-ignore
import * as range from 'lodash.range'
// @ts-ignore
import * as reverse from 'lodash.reverse'
// @ts-ignore
import * as uniqueBy from 'lodash.uniqby'
// @ts-ignore
import * as uniqWith from 'lodash.uniqwith'
import differenceWith from 'lodash.differencewith'
import range from 'lodash.range'
import reverse from 'lodash.reverse'
import uniqueBy from 'lodash.uniqby'
import uniqWith from 'lodash.uniqwith'

import { Objects } from './objects'

Expand Down
6 changes: 2 additions & 4 deletions src/utils/functions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { DebounceSettings } from 'lodash'
// @ts-ignore
import * as _debounce from 'lodash.debounce'
// @ts-ignore
import * as throttle from 'lodash.throttle'
import _debounce from 'lodash.debounce'
import throttle from 'lodash.throttle'

const debounceFunctions: any = {}

Expand Down
18 changes: 6 additions & 12 deletions src/utils/objects/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
// @ts-ignore
import * as cloneDeep from 'lodash.clonedeep'
// @ts-ignore
import * as isEqual from 'lodash.isequal'
// @ts-ignore
import * as isFunction from 'lodash.isfunction'
// @ts-ignore
import * as merge from 'lodash.merge'
// @ts-ignore
import * as pick from 'lodash.pick'
// @ts-ignore
import * as unset from 'lodash.unset'
import cloneDeep from 'lodash.clonedeep'
import isEqual from 'lodash.isequal'
import isFunction from 'lodash.isfunction'
import merge from 'lodash.merge'
import pick from 'lodash.pick'
import unset from 'lodash.unset'

import { camelize } from './camelize'
import { getDiff } from './getDiff'
Expand Down
3 changes: 1 addition & 2 deletions src/utils/objects/isNil.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-expect-error
import * as isNil from 'lodash.isnil'
import isNil from 'lodash.isnil'

export { isNil }
3 changes: 1 addition & 2 deletions src/utils/strings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @ts-ignore
import * as snake from 'to-snake-case'
import snake from 'to-snake-case'

export const normalize = (string: string): string =>
string
Expand Down

0 comments on commit 093df7a

Please sign in to comment.