From da560160ea45aa8b62f52efd714a5d7e9139d37f Mon Sep 17 00:00:00 2001 From: Antoine Jaussoin Date: Thu, 29 Dec 2022 09:09:36 +0100 Subject: [PATCH] Convert backend to ESM (#448) --- .github/workflows/alpha.yml | 2 +- backend/jest.config.js | 4 +- backend/package.json | 32 +- backend/src/admin/router.ts | 14 +- backend/src/auth/config.ts | 2 +- backend/src/auth/logins/anonymous-user.ts | 4 +- backend/src/auth/logins/password-user.ts | 6 +- backend/src/auth/passport.ts | 22 +- backend/src/auth/register/register-user.ts | 10 +- backend/src/cache/__tests__/cache.test.ts | 2 + backend/src/common/index.ts | 10 +- backend/src/common/models.ts | 2 +- backend/src/common/payloads.ts | 2 +- backend/src/common/ws.ts | 2 +- backend/src/config.ts | 5 +- backend/src/db/actions/chat.ts | 6 +- backend/src/db/actions/delete.ts | 10 +- backend/src/db/actions/licences.ts | 12 +- backend/src/db/actions/merge.ts | 10 +- backend/src/db/actions/posts.ts | 6 +- backend/src/db/actions/sessions.ts | 16 +- backend/src/db/actions/subscriptions.ts | 11 +- backend/src/db/actions/transaction.ts | 2 +- backend/src/db/actions/users.ts | 25 +- backend/src/db/actions/votes.ts | 8 +- backend/src/db/entities/ColumnDefinition.ts | 11 +- backend/src/db/entities/Message.ts | 11 +- backend/src/db/entities/Post.ts | 10 +- backend/src/db/entities/PostGroup.ts | 13 +- backend/src/db/entities/Session.ts | 17 +- backend/src/db/entities/SessionOptions.ts | 2 +- backend/src/db/entities/SessionTemplate.ts | 8 +- backend/src/db/entities/SessionView.ts | 2 +- backend/src/db/entities/Subscription.ts | 4 +- backend/src/db/entities/User.ts | 93 ------ backend/src/db/entities/UserIdentity.ts | 97 +++++- backend/src/db/entities/UserView.ts | 2 +- backend/src/db/entities/Vote.ts | 16 +- backend/src/db/entities/index.ts | 23 +- backend/src/db/index.ts | 4 +- backend/src/db/orm-config.ts | 17 +- backend/src/db/repositories/BaseRepository.ts | 4 +- .../src/db/repositories/ColumnRepository.ts | 6 +- .../src/db/repositories/LicenceRepository.ts | 4 +- .../src/db/repositories/MessageRepository.ts | 10 +- .../db/repositories/PostGroupRepository.ts | 8 +- backend/src/db/repositories/PostRepository.ts | 10 +- .../src/db/repositories/SessionRepository.ts | 8 +- .../repositories/SessionTemplateRepository.ts | 8 +- .../db/repositories/SubscriptionRepository.ts | 6 +- .../repositories/TemplateColumnRepository.ts | 6 +- .../db/repositories/UserIdentityRepository.ts | 4 +- backend/src/db/repositories/UserRepository.ts | 6 +- backend/src/db/repositories/VoteRepository.ts | 6 +- backend/src/db/repositories/index.ts | 24 +- backend/src/email/emailSender.ts | 14 +- backend/src/email/sendgrid-sender.ts | 4 +- backend/src/email/smtp-sender.ts | 4 +- backend/src/email/utils.ts | 2 +- backend/src/game.ts | 24 +- backend/src/hardcoded.ts | 2 +- backend/src/index.ts | 47 +-- backend/src/path-utils.ts | 14 + backend/src/security/is-licenced.ts | 8 +- backend/src/sentry.ts | 9 +- backend/src/slack/router.ts | 4 +- backend/src/stripe/products.ts | 6 +- backend/src/stripe/router.ts | 24 +- backend/src/stripe/types.ts | 2 +- backend/src/typings.d.ts | 2 +- backend/src/utils.ts | 17 +- backend/tsconfig.json | 6 +- backend/yarn.lock | 307 +++++++++++------- esm.md | 6 + 74 files changed, 643 insertions(+), 524 deletions(-) delete mode 100644 backend/src/db/entities/User.ts create mode 100644 backend/src/path-utils.ts create mode 100644 esm.md diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index 1f74b8148..66d6dc0b6 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -2,7 +2,7 @@ name: 'Alpha Build' on: push: - branches: [v4190/typeorm] + branches: [v4190/other-deps] jobs: build: diff --git a/backend/jest.config.js b/backend/jest.config.js index 91a2d2c0d..809175f68 100644 --- a/backend/jest.config.js +++ b/backend/jest.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { preset: 'ts-jest', testEnvironment: 'node', -}; \ No newline at end of file +}; diff --git a/backend/package.json b/backend/package.json index 755d74207..e78397cc6 100644 --- a/backend/package.json +++ b/backend/package.json @@ -3,9 +3,10 @@ "version": "4.18.0", "license": "GNU GPLv3", "private": true, + "type": "module", "scripts": { "build": "rimraf dist && tsc --build && yarn copy-templates", - "start": "nodemon --exec 'yarn fix & ts-node' --files ./src/index.ts", + "start": "nodemon --exec 'yarn fix & ts-node' --esm --files ./src/index.ts", "create-migration": "scripty", "create-empty-migration": "scripty", "migrate": "typeorm-ts-node-commonjs -d src/db/index.ts migration:run", @@ -21,19 +22,20 @@ "dependencies": { "@passport-js/passport-twitter": "1.0.7", "@sendgrid/mail": "7.7.0", - "@sentry/node": "7.22.0", + "@sentry/node": "7.28.1", "@types/bcryptjs": "2.4.2", "@types/connect-redis": "0.0.19", - "@types/crypto-js": "4.1.1", + "@types/crypto-js": "^4.1.1", "@types/express": "4.17.14", "@types/express-mung": "0.5.2", "@types/express-rate-limit": "6.0.0", "@types/express-session": "1.17.4", - "@types/jest": "29.2.3", - "@types/lodash": "4.14.190", + "@types/jest": "29.2.4", + "@types/lodash": "4.14.191", + "@types/lodash-es": "^4.17.6", "@types/node": "18.11.9", "@types/node-fetch": "2.6.2", - "@types/nodemailer": "6.4.6", + "@types/nodemailer": "6.4.7", "@types/passport": "1.0.11", "@types/passport-github2": "1.2.5", "@types/passport-google-oauth20": "2.0.11", @@ -42,17 +44,18 @@ "@types/passport-twitter": "1.0.37", "@types/shortid": "0.0.29", "@types/socket.io-redis": "3.0.0", - "@types/uuid": "8.3.4", - "@typescript-eslint/eslint-plugin": "5.45.0", - "@typescript-eslint/parser": "5.45.0", + "@types/uuid": "9.0.0", + "@typescript-eslint/eslint-plugin": "5.47.1", + "@typescript-eslint/parser": "5.47.1", "bcryptjs": "2.4.3", - "chalk": "4.1.2", + "chalk": "5.2.0", + "chalk-template": "^0.5.0", "connect-redis": "6.1.3", "copyfiles": "2.4.1", "crypto-js": "4.1.1", "date-fns": "2.29.3", "dotenv": "16.0.3", - "eslint": "8.28.0", + "eslint": "8.30.0", "eslint-config-prettier": "8.5.0", "eslint-plugin-prettier": "4.2.1", "express": "4.18.2", @@ -64,8 +67,9 @@ "jest": "29.3.1", "lexorank": "1.0.5", "lodash": "4.17.21", + "lodash-es": "^4.17.21", "moment": "2.29.4", - "node-fetch": "2.6.7", + "node-fetch": "3.3.0", "nodemailer": "6.8.0", "nodemon": "2.0.20", "passport": "0.5.0", @@ -76,7 +80,7 @@ "passport-okta-oauth20": "1.1.0", "passport-slack-oauth2": "1.1.1", "pg": "8.8.0", - "prettier": "2.8.0", + "prettier": "2.8.1", "rate-limiter-flexible": "2.4.1", "redis": "3.1.2", "rimraf": "3.0.2", @@ -84,7 +88,7 @@ "shortid": "2.2.16", "socket.io": "4.5.4", "socket.io-redis": "6.1.1", - "stripe": "11.1.0", + "stripe": "11.5.0", "ts-jest": "29.0.3", "ts-node": "10.9.1", "typeorm": "0.3.11", diff --git a/backend/src/admin/router.ts b/backend/src/admin/router.ts index 7340c585e..f5d57bdd5 100644 --- a/backend/src/admin/router.ts +++ b/backend/src/admin/router.ts @@ -3,17 +3,17 @@ import { getAllNonDeletedUsers, getPasswordIdentityByUserId, updateIdentity, -} from '../db/actions/users'; -import config from '../config'; -import { isLicenced } from '../security/is-licenced'; +} from '../db/actions/users.js'; +import config from '../config.js'; +import { isLicenced } from '../security/is-licenced.js'; import { AdminChangePasswordPayload, BackendCapabilities, MergeUsersPayload, -} from '../common'; -import { getIdentityFromRequest, hashPassword } from '../utils'; -import { canSendEmails } from '../email/utils'; -import { mergeUsers } from '../db/actions/merge'; +} from '../common/index.js'; +import { getIdentityFromRequest, hashPassword } from '../utils.js'; +import { canSendEmails } from '../email/utils.js'; +import { mergeUsers } from '../db/actions/merge.js'; const router = express.Router(); diff --git a/backend/src/auth/config.ts b/backend/src/auth/config.ts index 88a2d9207..8ddea6cf1 100644 --- a/backend/src/auth/config.ts +++ b/backend/src/auth/config.ts @@ -3,7 +3,7 @@ import { StrategyOptions as GoogleStrategyOptions } from 'passport-google-oauth2 import { StrategyOptions as GitHubStrategy } from 'passport-github2'; import { MicrosoftStrategyOptions } from 'passport-microsoft'; import { OktaStrategyOptions } from 'passport-okta-oauth20'; -import config from '../config'; +import config from '../config.js'; type MicrosoftStrategyOptionsWithTenant = MicrosoftStrategyOptions & { tenant: string | undefined; diff --git a/backend/src/auth/logins/anonymous-user.ts b/backend/src/auth/logins/anonymous-user.ts index f23aed68b..48e9057f8 100644 --- a/backend/src/auth/logins/anonymous-user.ts +++ b/backend/src/auth/logins/anonymous-user.ts @@ -1,5 +1,5 @@ -import { UserIdentityEntity } from '../../db/entities'; -import { registerAnonymousUser } from '../../db/actions/users'; +import { UserIdentityEntity } from '../../db/entities/index.js'; +import { registerAnonymousUser } from '../../db/actions/users.js'; export default async function loginAnonymous( username: string, diff --git a/backend/src/auth/logins/password-user.ts b/backend/src/auth/logins/password-user.ts index c05ba15dd..4ce289651 100644 --- a/backend/src/auth/logins/password-user.ts +++ b/backend/src/auth/logins/password-user.ts @@ -1,6 +1,6 @@ -import { UserIdentityEntity } from '../../db/entities'; -import { getIdentityByUsername } from '../../db/actions/users'; -import { comparePassword } from '../../utils'; +import { UserIdentityEntity } from '../../db/entities/index.js'; +import { getIdentityByUsername } from '../../db/actions/users.js'; +import { comparePassword } from '../../utils.js'; export default async function loginUser( username: string, diff --git a/backend/src/auth/passport.ts b/backend/src/auth/passport.ts index 253d575b6..5f7f08d85 100644 --- a/backend/src/auth/passport.ts +++ b/backend/src/auth/passport.ts @@ -5,7 +5,9 @@ import { Strategy as GoogleStrategy } from 'passport-google-oauth20'; import { Strategy as GithubStrategy } from 'passport-github2'; import { Strategy as SlackStrategy } from 'passport-slack-oauth2'; import { Strategy as MicrosoftStrategy } from 'passport-microsoft'; -import { Strategy as OktaStrategy } from 'passport-okta-oauth20'; +import passportOkta from 'passport-okta-oauth20'; + +const { Strategy: OktaStrategy } = passportOkta; import { TWITTER_CONFIG, @@ -14,11 +16,11 @@ import { MICROSOFT_CONFIG, SLACK_CONFIG, OKTA_CONFIG, -} from './config'; -import { AccountType } from '../common'; -import chalk from 'chalk'; -import loginUser from './logins/password-user'; -import loginAnonymous from './logins/anonymous-user'; +} from './config.js'; +import { AccountType } from '../common/index.js'; +import chalk from 'chalk-template'; +import loginUser from './logins/password-user.js'; +import loginAnonymous from './logins/anonymous-user.js'; import { BaseProfile, TwitterProfile, @@ -27,10 +29,10 @@ import { MicrosoftProfile, SlackProfile, OktaProfile, -} from './types'; -import { registerUser, UserRegistration } from '../db/actions/users'; -import { serialiseIds, UserIds, deserialiseIds } from '../utils'; -import config from '../config'; +} from './types.js'; +import { registerUser, UserRegistration } from '../db/actions/users.js'; +import { serialiseIds, UserIds, deserialiseIds } from '../utils.js'; +import config from '../config.js'; export default () => { passport.serializeUser((user, cb) => { diff --git a/backend/src/auth/register/register-user.ts b/backend/src/auth/register/register-user.ts index 615665bce..a91990e49 100644 --- a/backend/src/auth/register/register-user.ts +++ b/backend/src/auth/register/register-user.ts @@ -1,9 +1,9 @@ -import { RegisterPayload } from '../../common'; +import { RegisterPayload } from '../../common/index.js'; import { v4 } from 'uuid'; -import { hashPassword } from '../../utils'; -import { UserIdentityEntity } from '../../db/entities'; -import { getIdentityByUsername, registerUser } from '../../db/actions/users'; -import { canSendEmails } from '../../email/utils'; +import { hashPassword } from '../../utils.js'; +import { UserIdentityEntity } from '../../db/entities/index.js'; +import { getIdentityByUsername, registerUser } from '../../db/actions/users.js'; +import { canSendEmails } from '../../email/utils.js'; export default async function registerPasswordUser( details: RegisterPayload, diff --git a/backend/src/cache/__tests__/cache.test.ts b/backend/src/cache/__tests__/cache.test.ts index 7588a601f..553f46a6e 100644 --- a/backend/src/cache/__tests__/cache.test.ts +++ b/backend/src/cache/__tests__/cache.test.ts @@ -44,3 +44,5 @@ describe('Cache - Invalidate', () => { expect(result).toBe(null); }); }); + +export {}; diff --git a/backend/src/common/index.ts b/backend/src/common/index.ts index e4016b61a..28cf2ac1a 100644 --- a/backend/src/common/index.ts +++ b/backend/src/common/index.ts @@ -1,5 +1,5 @@ -export { default as Actions } from './actions'; -export * from './types'; -export * from './models'; -export * from './payloads'; -export * from './ws'; +export { default as Actions } from './actions.js'; +export * from './types.js'; +export * from './models.js'; +export * from './payloads.js'; +export * from './ws.js'; diff --git a/backend/src/common/models.ts b/backend/src/common/models.ts index 6ebb5d35a..b7f0a199c 100644 --- a/backend/src/common/models.ts +++ b/backend/src/common/models.ts @@ -1,4 +1,4 @@ -import { SessionOptions, Session } from './types'; +import { SessionOptions, Session } from './types.js'; export const defaultOptions: SessionOptions = { allowActions: true, diff --git a/backend/src/common/payloads.ts b/backend/src/common/payloads.ts index f1754bb13..cd315c1e8 100644 --- a/backend/src/common/payloads.ts +++ b/backend/src/common/payloads.ts @@ -1,4 +1,4 @@ -import { Plan, Currency, StripeLocales, AccessErrorType } from './types'; +import { Plan, Currency, StripeLocales, AccessErrorType } from './types.js'; export interface RegisterPayload { name: string; diff --git a/backend/src/common/ws.ts b/backend/src/common/ws.ts index 55b2812bf..2d6edf9eb 100644 --- a/backend/src/common/ws.ts +++ b/backend/src/common/ws.ts @@ -6,7 +6,7 @@ import { User, VoteExtract, VoteType, -} from './types'; +} from './types.js'; export interface WebsocketMessage { payload: T; diff --git a/backend/src/config.ts b/backend/src/config.ts index 94b33ff83..62bcafadb 100644 --- a/backend/src/config.ts +++ b/backend/src/config.ts @@ -1,10 +1,11 @@ import fs from 'fs'; import path from 'path'; -import { BackendConfig } from './types'; +import { BackendConfig } from './types.js'; import dotenv from 'dotenv'; +import { getDirname } from './path-utils.js'; function findDotEnvPath(): string | null { - let current = path.resolve(__dirname); + let current = getDirname(import.meta.url); for (let i = 0; i < 5; i++) { const custom = path.resolve(current, '.env'); const example = path.resolve(current, '.env.example'); diff --git a/backend/src/db/actions/chat.ts b/backend/src/db/actions/chat.ts index 77ebdfc16..c47838ecb 100644 --- a/backend/src/db/actions/chat.ts +++ b/backend/src/db/actions/chat.ts @@ -1,6 +1,6 @@ -import { Message } from '../../common'; -import MessageRepository from '../repositories/MessageRepository'; -import { transaction } from './transaction'; +import { Message } from '../../common/index.js'; +import MessageRepository from '../repositories/MessageRepository.js'; +import { transaction } from './transaction.js'; export async function saveChatMessage( userId: string, diff --git a/backend/src/db/actions/delete.ts b/backend/src/db/actions/delete.ts index 4abcc7ec7..55c0bbe89 100644 --- a/backend/src/db/actions/delete.ts +++ b/backend/src/db/actions/delete.ts @@ -1,15 +1,15 @@ -import { DeleteAccountPayload } from '../../common'; +import { DeleteAccountPayload } from '../../common/index.js'; import { EntityManager } from 'typeorm'; import { v4 } from 'uuid'; -import { UserIdentityEntity, UserView } from '../entities'; +import { UserIdentityEntity, UserView } from '../entities/index.js'; import { PostGroupRepository, PostRepository, SessionRepository, VoteRepository, -} from '../repositories'; -import { transaction } from './transaction'; -import { registerAnonymousUser } from './users'; +} from '../repositories/index.js'; +import { transaction } from './transaction.js'; +import { registerAnonymousUser } from './users.js'; export async function deleteAccount( user: UserView, diff --git a/backend/src/db/actions/licences.ts b/backend/src/db/actions/licences.ts index b05cf5706..2fd42b20e 100644 --- a/backend/src/db/actions/licences.ts +++ b/backend/src/db/actions/licences.ts @@ -1,10 +1,10 @@ -import { transaction } from './transaction'; -import LicenceEntity from '../entities/Licence'; +import { transaction } from './transaction.js'; +import LicenceEntity from '../entities/Licence.js'; import { v4 } from 'uuid'; -import { sendSelfHostWelcome } from '../../email/emailSender'; -import { LicenceRepository } from '../repositories'; -import { LicenceMetadata } from './../../types'; -import { saveAndReload } from '../repositories/BaseRepository'; +import { sendSelfHostWelcome } from '../../email/emailSender.js'; +import { LicenceRepository } from '../repositories/index.js'; +import { LicenceMetadata } from './../../types.js'; +import { saveAndReload } from '../repositories/BaseRepository.js'; export async function registerLicence( email: string | null, diff --git a/backend/src/db/actions/merge.ts b/backend/src/db/actions/merge.ts index acfba6ea2..8c3d79664 100644 --- a/backend/src/db/actions/merge.ts +++ b/backend/src/db/actions/merge.ts @@ -1,13 +1,13 @@ -import { UserView } from '../entities'; -import { getUserView } from './users'; -import { transaction } from './transaction'; +import { UserView } from '../entities/index.js'; +import { getUserView } from './users.js'; +import { transaction } from './transaction.js'; import { PostGroupRepository, PostRepository, SessionRepository, VoteRepository, -} from '../repositories'; -import { deleteAccount } from './delete'; +} from '../repositories/index.js'; +import { deleteAccount } from './delete.js'; export async function mergeUsers( mainUserId: string, diff --git a/backend/src/db/actions/posts.ts b/backend/src/db/actions/posts.ts index ea3013c09..790d887ad 100644 --- a/backend/src/db/actions/posts.ts +++ b/backend/src/db/actions/posts.ts @@ -1,11 +1,11 @@ -import { Post, PostGroup, Vote } from '../../common'; +import { Post, PostGroup, Vote } from '../../common/index.js'; import { PostRepository, PostGroupRepository, VoteRepository, SessionRepository, -} from '../repositories'; -import { transaction } from './transaction'; +} from '../repositories/index.js'; +import { transaction } from './transaction.js'; export async function getNumberOfPosts(userId: string): Promise { return await transaction(async (manager) => { diff --git a/backend/src/db/actions/sessions.ts b/backend/src/db/actions/sessions.ts index 88db81bad..e5439e515 100644 --- a/backend/src/db/actions/sessions.ts +++ b/backend/src/db/actions/sessions.ts @@ -6,7 +6,7 @@ import { SessionEntity, SessionTemplateEntity, SessionView, -} from '../entities'; +} from '../entities/index.js'; import { Session, defaultSession, @@ -15,7 +15,7 @@ import { SessionMetadata, AccessErrorType, FullUser, -} from '../../common'; +} from '../../common/index.js'; import shortId from 'shortid'; import { v4 } from 'uuid'; import { @@ -25,13 +25,13 @@ import { PostRepository, PostGroupRepository, ColumnRepository, -} from '../repositories'; -import { transaction } from './transaction'; +} from '../repositories/index.js'; +import { transaction } from './transaction.js'; import { EntityManager, In } from 'typeorm'; -import { getUserViewInner, isUserPro } from './users'; -import { uniq } from 'lodash'; -import MessageRepository from '../repositories/MessageRepository'; -import MessageEntity from '../entities/Message'; +import { getUserViewInner, isUserPro } from './users.js'; +import { uniq } from 'lodash-es'; +import MessageRepository from '../repositories/MessageRepository.js'; +import MessageEntity from '../entities/Message.js'; export async function createSessionFromSlack( slackUserId: string, diff --git a/backend/src/db/actions/subscriptions.ts b/backend/src/db/actions/subscriptions.ts index d049ff6c6..aec6c691b 100644 --- a/backend/src/db/actions/subscriptions.ts +++ b/backend/src/db/actions/subscriptions.ts @@ -1,7 +1,10 @@ -import { SubscriptionRepository, UserRepository } from '../repositories'; -import { Plan, Currency } from '../../common'; -import { SubscriptionEntity, UserEntity, UserView } from '../entities'; -import { transaction } from './transaction'; +import { + SubscriptionRepository, + UserRepository, +} from '../repositories/index.js'; +import { Plan, Currency } from '../../common/index.js'; +import { SubscriptionEntity, UserEntity, UserView } from '../entities/index.js'; +import { transaction } from './transaction.js'; import { In } from 'typeorm'; export async function activateSubscription( diff --git a/backend/src/db/actions/transaction.ts b/backend/src/db/actions/transaction.ts index b17dc6d90..7a2ca91e7 100644 --- a/backend/src/db/actions/transaction.ts +++ b/backend/src/db/actions/transaction.ts @@ -1,4 +1,4 @@ -import { dataSource } from '../index'; +import { dataSource } from '../index.js'; import { EntityManager } from 'typeorm'; type Inner = (manager: EntityManager) => Promise; diff --git a/backend/src/db/actions/users.ts b/backend/src/db/actions/users.ts index 1b1e055c5..466257413 100644 --- a/backend/src/db/actions/users.ts +++ b/backend/src/db/actions/users.ts @@ -1,15 +1,20 @@ -import { UserEntity, UserView } from '../entities'; +import { UserEntity, UserView } from '../entities/index.js'; import { EntityManager, Not } from 'typeorm'; -import { UserIdentityRepository, UserRepository } from '../repositories'; -import { ALL_FIELDS } from '../entities/User'; -import { ALL_FIELDS as ALL_FIELDS_IDENTITY } from '../entities/UserIdentity'; -import { transaction } from './transaction'; -import { AccountType, FullUser } from '../../common'; -import { isSelfHostedAndLicenced } from '../../security/is-licenced'; +import { + UserIdentityRepository, + UserRepository, +} from '../repositories/index.js'; +import { + ALL_FIELDS, + ALL_IDENTITY_FIELDS as ALL_FIELDS_IDENTITY, + UserIdentityEntity, +} from '../entities/UserIdentity.js'; +import { transaction } from './transaction.js'; +import { AccountType, FullUser } from '../../common/index.js'; +import { isSelfHostedAndLicenced } from '../../security/is-licenced.js'; import { v4 } from 'uuid'; -import UserIdentityEntity from '../entities/UserIdentity'; -import { comparePassword, hashPassword } from '../../utils'; -import { saveAndReload } from '../repositories/BaseRepository'; +import { comparePassword, hashPassword } from '../../utils.js'; +import { saveAndReload } from '../repositories/BaseRepository.js'; export async function getUser(userId: string): Promise { return await transaction(async (manager) => { diff --git a/backend/src/db/actions/votes.ts b/backend/src/db/actions/votes.ts index 15a04d7ed..e7646d628 100644 --- a/backend/src/db/actions/votes.ts +++ b/backend/src/db/actions/votes.ts @@ -1,13 +1,13 @@ -import { Vote, VoteExtract, VoteType } from '../../common'; -import { find } from 'lodash'; +import { Vote, VoteExtract, VoteType } from '../../common/index.js'; +import { find } from 'lodash-es'; import { v4 } from 'uuid'; import { PostRepository, SessionRepository, UserRepository, VoteRepository, -} from '../repositories'; -import { transaction } from './transaction'; +} from '../repositories/index.js'; +import { transaction } from './transaction.js'; export async function registerVote( userId: string, diff --git a/backend/src/db/entities/ColumnDefinition.ts b/backend/src/db/entities/ColumnDefinition.ts index 878c9c6a8..39d30124a 100644 --- a/backend/src/db/entities/ColumnDefinition.ts +++ b/backend/src/db/entities/ColumnDefinition.ts @@ -6,10 +6,11 @@ import { CreateDateColumn, UpdateDateColumn, Index, + Relation, } from 'typeorm'; -import { ColumnDefinition, ColumnDefinitionType } from '../../common'; -import SessionEntity from './Session'; -import SessionTemplateEntity from './SessionTemplate'; +import { ColumnDefinition, ColumnDefinitionType } from '../../common/index.js'; +import SessionEntity from './Session.js'; +import SessionTemplateEntity from './SessionTemplate.js'; class ColumnDefinitionEntityBase { @PrimaryColumn({ primary: true, generated: false, unique: true }) @@ -61,10 +62,10 @@ class ColumnDefinitionEntityBase { export class ColumnDefinitionEntity extends ColumnDefinitionEntityBase { @ManyToOne(() => SessionEntity, { nullable: false }) @Index() - public session: SessionEntity; + public session: Relation; constructor( id: string, - session: SessionEntity, + session: Relation, type: string, index: number, label: string, diff --git a/backend/src/db/entities/Message.ts b/backend/src/db/entities/Message.ts index 2ea28c480..7a231458a 100644 --- a/backend/src/db/entities/Message.ts +++ b/backend/src/db/entities/Message.ts @@ -6,10 +6,11 @@ import { CreateDateColumn, UpdateDateColumn, Index, + Relation, } from 'typeorm'; -import SessionEntity from './Session'; -import UserEntity from './User'; -import { Message } from '../../common'; +import SessionEntity from './Session.js'; +import { Message } from '../../common/index.js'; +import { UserEntity } from './UserIdentity.js'; @Entity({ name: 'messages' }) export default class MessageEntity { @@ -17,7 +18,7 @@ export default class MessageEntity { public id: string; @ManyToOne(() => SessionEntity, { nullable: false }) @Index() - public session: SessionEntity; + public session: Relation; @Column() public content: string; @ManyToOne(() => UserEntity, { eager: true, cascade: true, nullable: false }) @@ -39,7 +40,7 @@ export default class MessageEntity { constructor( id: string, - session: SessionEntity, + session: Relation, content: string, user: UserEntity ) { diff --git a/backend/src/db/entities/Post.ts b/backend/src/db/entities/Post.ts index 8c872ae65..90ad28736 100644 --- a/backend/src/db/entities/Post.ts +++ b/backend/src/db/entities/Post.ts @@ -9,11 +9,11 @@ import { Index, } from 'typeorm'; import { LexoRank } from 'lexorank'; -import SessionEntity from './Session'; -import UserEntity from './User'; -import VoteEntity from './Vote'; -import PostGroupEntity from './PostGroup'; -import { Post } from '../../common'; +import SessionEntity from './Session.js'; +import VoteEntity from './Vote.js'; +import PostGroupEntity from './PostGroup.js'; +import { UserEntity } from './UserIdentity.js'; +import { Post } from 'common/types.js'; @Entity({ name: 'posts' }) export default class PostEntity { diff --git a/backend/src/db/entities/PostGroup.ts b/backend/src/db/entities/PostGroup.ts index 7922c3661..d887ca554 100644 --- a/backend/src/db/entities/PostGroup.ts +++ b/backend/src/db/entities/PostGroup.ts @@ -7,12 +7,13 @@ import { UpdateDateColumn, OneToMany, Index, + Relation, } from 'typeorm'; import { LexoRank } from 'lexorank'; -import SessionEntity from './Session'; -import UserEntity from './User'; -import PostEntity from './Post'; -import { PostGroup } from '../../common'; +import SessionEntity from './Session.js'; +import PostEntity from './Post.js'; +import { PostGroup } from '../../common/index.js'; +import { UserEntity } from './UserIdentity.js'; @Entity({ name: 'groups' }) export default class PostGroupEntity { @@ -20,7 +21,7 @@ export default class PostGroupEntity { public id: string; @ManyToOne(() => SessionEntity, { nullable: false }) @Index() - public session: SessionEntity; + public session: Relation; @Column({ default: 0 }) public column: number; @Index() @@ -55,7 +56,7 @@ export default class PostGroupEntity { constructor( id: string, - session: SessionEntity, + session: Relation, column: number, label: string, user: UserEntity diff --git a/backend/src/db/entities/Session.ts b/backend/src/db/entities/Session.ts index 20f7b2454..fdcc0451c 100644 --- a/backend/src/db/entities/Session.ts +++ b/backend/src/db/entities/Session.ts @@ -10,13 +10,16 @@ import { ManyToMany, JoinTable, } from 'typeorm'; -import PostEntity from './Post'; -import { ColumnDefinitionEntity } from './ColumnDefinition'; -import { SessionOptions as JsonSessionOptions, Session } from '../../common'; -import UserEntity from './User'; -import SessionOptionsEntity from './SessionOptions'; -import PostGroupEntity from './PostGroup'; -import MessageEntity from './Message'; +import PostEntity from './Post.js'; +import { ColumnDefinitionEntity } from './ColumnDefinition.js'; +import { + SessionOptions as JsonSessionOptions, + Session, +} from '../../common/index.js'; +import SessionOptionsEntity from './SessionOptions.js'; +import PostGroupEntity from './PostGroup.js'; +import MessageEntity from './Message.js'; +import { UserEntity } from './UserIdentity.js'; @Entity({ name: 'sessions' }) export default class SessionEntity { diff --git a/backend/src/db/entities/SessionOptions.ts b/backend/src/db/entities/SessionOptions.ts index 268a2043e..1fba13962 100644 --- a/backend/src/db/entities/SessionOptions.ts +++ b/backend/src/db/entities/SessionOptions.ts @@ -3,7 +3,7 @@ import { SessionOptions as JsonSessionOptions, defaultOptions, SessionOptions, -} from '../../common'; +} from '../../common/index.js'; export default class SessionOptionsEntity { @Column({ nullable: true, type: 'numeric' }) diff --git a/backend/src/db/entities/SessionTemplate.ts b/backend/src/db/entities/SessionTemplate.ts index 80a037978..5144bace4 100644 --- a/backend/src/db/entities/SessionTemplate.ts +++ b/backend/src/db/entities/SessionTemplate.ts @@ -8,13 +8,13 @@ import { UpdateDateColumn, ManyToOne, } from 'typeorm'; -import { TemplateColumnDefinitionEntity } from './ColumnDefinition'; +import { TemplateColumnDefinitionEntity } from './ColumnDefinition.js'; import { SessionOptions as JsonSessionOptions, SessionTemplate, -} from '../../common'; -import UserEntity from './User'; -import SessionOptionsEntity from './SessionOptions'; +} from '../../common/index.js'; +import SessionOptionsEntity from './SessionOptions.js'; +import { UserEntity } from './UserIdentity.js'; @Entity({ name: 'templates' }) export default class SessionTemplateEntity { diff --git a/backend/src/db/entities/SessionView.ts b/backend/src/db/entities/SessionView.ts index 625f8104d..0be649637 100644 --- a/backend/src/db/entities/SessionView.ts +++ b/backend/src/db/entities/SessionView.ts @@ -1,5 +1,5 @@ import { ViewEntity, ViewColumn } from 'typeorm'; -import { User, SessionMetadata } from '../../common'; +import { User, SessionMetadata } from '../../common/index.js'; @ViewEntity({ expression: ` diff --git a/backend/src/db/entities/Subscription.ts b/backend/src/db/entities/Subscription.ts index 070330f52..8bf5b0b45 100644 --- a/backend/src/db/entities/Subscription.ts +++ b/backend/src/db/entities/Subscription.ts @@ -7,8 +7,8 @@ import { ManyToOne, Index, } from 'typeorm'; -import UserEntity from './User'; -import { Plan } from '../../common'; +import { Plan } from '../../common/index.js'; +import { UserEntity } from './UserIdentity.js'; @Entity({ name: 'subscriptions' }) export default class SubscriptionEntity { diff --git a/backend/src/db/entities/User.ts b/backend/src/db/entities/User.ts deleted file mode 100644 index 2d69ed8ea..000000000 --- a/backend/src/db/entities/User.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { - Entity, - Column, - PrimaryColumn, - Index, - CreateDateColumn, - UpdateDateColumn, - ManyToOne, - ManyToMany, - OneToMany, -} from 'typeorm'; -import { User, Currency } from '../../common'; -import { SessionEntity, SessionTemplateEntity } from '.'; -import UserIdentityEntity from './UserIdentity'; - -export const ALL_FIELDS: Array = [ - 'id', - 'name', - 'email', - 'language', - 'defaultTemplate', - 'stripeId', - 'created', - 'updated', - 'trial', - 'quota', -]; - -@Entity({ name: 'users' }) -export default class UserEntity { - @PrimaryColumn({ primary: true, generated: false, unique: true }) - public id: string; - @Column() - @Index() - public name: string; - @Column({ nullable: true, type: 'character varying' }) - @Index({ unique: true }) - public email: string | null; - @Column({ nullable: true, type: 'character varying' }) - public currency: Currency | null; - @Column({ nullable: true, type: 'character varying' }) - public photo: string | null; - @Column({ nullable: true, type: 'character varying' }) - public stripeId: string | null; - @Column({ type: 'timestamp with time zone', nullable: true }) - public trial: Date | null; - @Column({ nullable: false, default: 50 }) - public quota: number; - @Column({ nullable: true, type: 'character varying' }) - public language: string | null; - @ManyToOne(() => SessionTemplateEntity, { nullable: true, eager: false }) - @Index() - public defaultTemplate: SessionTemplateEntity | null | undefined; - @ManyToMany(() => SessionEntity, (session) => session.visitors, { - eager: false, - }) - public sessions: SessionEntity[] | undefined; - @OneToMany(() => UserIdentityEntity, (identity) => identity.user, { - cascade: true, - nullable: false, - eager: false, - }) - public identities: UserIdentityEntity[] | undefined; - @Column({ nullable: true, type: 'character varying' }) - public slackUserId: string | null; - @Column({ nullable: true, type: 'character varying' }) - public slackTeamId: string | null; - @CreateDateColumn({ type: 'timestamp with time zone', select: false }) - public created: Date | undefined; - @UpdateDateColumn({ type: 'timestamp with time zone', select: false }) - public updated: Date | undefined; - constructor(id: string, name: string) { - this.id = id; - this.name = name; - this.email = null; - this.language = null; - this.stripeId = null; - this.currency = null; - this.trial = null; - this.quota = 50; - this.slackTeamId = null; - this.slackUserId = null; - this.photo = null; - } - - toJson(): User { - return { - id: this.id, - name: this.name, - photo: this.photo, - }; - } -} diff --git a/backend/src/db/entities/UserIdentity.ts b/backend/src/db/entities/UserIdentity.ts index 759d870e1..7d64be500 100644 --- a/backend/src/db/entities/UserIdentity.ts +++ b/backend/src/db/entities/UserIdentity.ts @@ -6,12 +6,99 @@ import { CreateDateColumn, UpdateDateColumn, ManyToOne, + ManyToMany, } from 'typeorm'; -import { AccountType, UserIdentity } from '../../common'; -import UserEntity from './User'; -import { UserIds } from '../../utils'; +import { + AccountType, + Currency, + User, + UserIdentity, +} from '../../common/index.js'; + +import { UserIds } from '../../utils.js'; +import SessionEntity from './Session.js'; +import SessionTemplateEntity from './SessionTemplate.js'; + +export const ALL_FIELDS: Array = [ + 'id', + 'name', + 'email', + 'language', + 'defaultTemplate', + 'stripeId', + 'created', + 'updated', + 'trial', + 'quota', +]; + +@Entity({ name: 'users' }) +export class UserEntity { + @PrimaryColumn({ primary: true, generated: false, unique: true }) + public id: string; + @Column() + @Index() + public name: string; + @Column({ nullable: true, type: 'character varying' }) + @Index({ unique: true }) + public email: string | null; + @Column({ nullable: true, type: 'character varying' }) + public currency: Currency | null; + @Column({ nullable: true, type: 'character varying' }) + public photo: string | null; + @Column({ nullable: true, type: 'character varying' }) + public stripeId: string | null; + @Column({ type: 'timestamp with time zone', nullable: true }) + public trial: Date | null; + @Column({ nullable: false, default: 50 }) + public quota: number; + @Column({ nullable: true, type: 'character varying' }) + public language: string | null; + @ManyToOne(() => SessionTemplateEntity, { nullable: true, eager: false }) + @Index() + public defaultTemplate: SessionTemplateEntity | null | undefined; + @ManyToMany(() => SessionEntity, (session) => session.visitors, { + eager: false, + }) + public sessions: SessionEntity[] | undefined; + // @OneToMany(() => UserIdentityEntity, (identity) => identity.user, { + // cascade: true, + // nullable: false, + // eager: false, + // }) + // public identities: UserIdentityEntity[] | undefined; + @Column({ nullable: true, type: 'character varying' }) + public slackUserId: string | null; + @Column({ nullable: true, type: 'character varying' }) + public slackTeamId: string | null; + @CreateDateColumn({ type: 'timestamp with time zone', select: false }) + public created: Date | undefined; + @UpdateDateColumn({ type: 'timestamp with time zone', select: false }) + public updated: Date | undefined; + constructor(id: string, name: string) { + this.id = id; + this.name = name; + this.email = null; + this.language = null; + this.stripeId = null; + this.currency = null; + this.trial = null; + this.quota = 50; + this.slackTeamId = null; + this.slackUserId = null; + this.photo = null; + } + + toJson(): User { + return { + id: this.id, + name: this.name, + photo: this.photo, + }; + } +} -export const ALL_FIELDS: Array = [ +export const ALL_IDENTITY_FIELDS: Array = [ 'id', 'accountType', 'username', @@ -23,7 +110,7 @@ export const ALL_FIELDS: Array = [ @Entity({ name: 'users_identities' }) @Index(['username', 'accountType'], { unique: true }) -export default class UserIdentityEntity { +export class UserIdentityEntity { @PrimaryColumn({ primary: true, generated: false, unique: true }) public id: string; @ManyToOne(() => UserEntity, { diff --git a/backend/src/db/entities/UserView.ts b/backend/src/db/entities/UserView.ts index d10cec1d6..d0666c657 100644 --- a/backend/src/db/entities/UserView.ts +++ b/backend/src/db/entities/UserView.ts @@ -1,5 +1,5 @@ import { ViewEntity, ViewColumn } from 'typeorm'; -import { AccountType, FullUser, Currency, Plan } from '../../common'; +import { AccountType, FullUser, Currency, Plan } from '../../common/index.js'; @ViewEntity({ expression: ` diff --git a/backend/src/db/entities/Vote.ts b/backend/src/db/entities/Vote.ts index 912aaeed7..7bfb9804c 100644 --- a/backend/src/db/entities/Vote.ts +++ b/backend/src/db/entities/Vote.ts @@ -6,10 +6,11 @@ import { CreateDateColumn, UpdateDateColumn, Index, + Relation, } from 'typeorm'; -import { VoteType, Vote, VoteExtract } from '../../common'; -import UserEntity from './User'; -import PostEntity from './Post'; +import { VoteType, Vote, VoteExtract } from '../../common/index.js'; +import PostEntity from './Post.js'; +import { UserEntity } from './UserIdentity.js'; @Entity({ name: 'votes' }) export default class VoteEntity { @@ -25,7 +26,7 @@ export default class VoteEntity { onUpdate: 'CASCADE', }) @Index() - public post: PostEntity; + public post: Relation; @Column({ type: 'character varying' }) public type: VoteType; @CreateDateColumn({ type: 'timestamp with time zone' }) @@ -50,7 +51,12 @@ export default class VoteEntity { }; } - constructor(id: string, post: PostEntity, user: UserEntity, type: VoteType) { + constructor( + id: string, + post: Relation, + user: UserEntity, + type: VoteType + ) { this.id = id; this.post = post; this.type = type; diff --git a/backend/src/db/entities/index.ts b/backend/src/db/entities/index.ts index 2d9b37052..4e7cb6fae 100644 --- a/backend/src/db/entities/index.ts +++ b/backend/src/db/entities/index.ts @@ -1,15 +1,14 @@ -export { default as PostEntity } from './Post'; -export { default as PostGroupEntity } from './PostGroup'; -export { default as SessionEntity } from './Session'; -export { default as SessionView } from './SessionView'; -export { default as UserEntity } from './User'; +export { default as PostEntity } from './Post.js'; +export { default as PostGroupEntity } from './PostGroup.js'; +export { default as SessionEntity } from './Session.js'; +export { default as SessionView } from './SessionView.js'; export { ColumnDefinitionEntity, TemplateColumnDefinitionEntity, -} from './ColumnDefinition'; -export { default as VoteEntity } from './Vote'; -export { default as SessionTemplateEntity } from './SessionTemplate'; -export { default as SubscriptionEntity } from './Subscription'; -export { default as UserView } from './UserView'; -export { default as UserIdentityEntity } from './UserIdentity'; -export { default as MessageEntity } from './Message'; +} from './ColumnDefinition.js'; +export { default as VoteEntity } from './Vote.js'; +export { default as SessionTemplateEntity } from './SessionTemplate.js'; +export { default as SubscriptionEntity } from './Subscription.js'; +export { default as UserView } from './UserView.js'; +export { UserIdentityEntity, UserEntity } from './UserIdentity.js'; +export { default as MessageEntity } from './Message.js'; diff --git a/backend/src/db/index.ts b/backend/src/db/index.ts index 73b099337..3e572af17 100644 --- a/backend/src/db/index.ts +++ b/backend/src/db/index.ts @@ -1,7 +1,7 @@ import 'reflect-metadata'; -import chalk from 'chalk'; +import chalk from 'chalk-template'; import { DataSource } from 'typeorm'; -import ormConfig from './orm-config'; +import ormConfig from './orm-config.js'; export const dataSource = new DataSource(ormConfig); diff --git a/backend/src/db/orm-config.ts b/backend/src/db/orm-config.ts index 251ceda91..6e33a7515 100644 --- a/backend/src/db/orm-config.ts +++ b/backend/src/db/orm-config.ts @@ -1,4 +1,4 @@ -import config from '../config'; +import config from '../config.js'; import { DataSourceOptions } from 'typeorm'; import { PostEntity, @@ -13,20 +13,23 @@ import { MessageEntity, UserView, SessionView, -} from './entities'; -import LicenceEntity from './entities/Licence'; -import SessionOptionsEntity from './entities/SessionOptions'; -import UserIdentityEntity from './entities/UserIdentity'; + UserIdentityEntity, +} from './entities/index.js'; +import LicenceEntity from './entities/Licence.js'; +import SessionOptionsEntity from './entities/SessionOptions.js'; import { SnakeNamingStrategy } from 'typeorm-naming-strategies'; import path from 'path'; +import { getDirname, getFilename } from './../path-utils.js'; + +const fileName = getFilename(import.meta.url); function getMigrationsDirectory(): string { - return path.resolve(__dirname, 'migrations'); + return path.resolve(getDirname(import.meta.url), 'migrations'); } function getMigrationsFiles(): string { return `${getMigrationsDirectory()}/*.${ - __filename.endsWith('js') ? 'js' : 'ts' + fileName.endsWith('js') ? 'js' : 'ts' }`; } diff --git a/backend/src/db/repositories/BaseRepository.ts b/backend/src/db/repositories/BaseRepository.ts index f971117d4..46042394a 100644 --- a/backend/src/db/repositories/BaseRepository.ts +++ b/backend/src/db/repositories/BaseRepository.ts @@ -1,6 +1,6 @@ import { DeepPartial, EntityTarget, Repository, SaveOptions } from 'typeorm'; -import { Entity } from '../../common'; -import { dataSource } from '../index'; +import { Entity } from '../../common/index.js'; +import { dataSource } from '../index.js'; export async function saveAndReload( repo: Repository, diff --git a/backend/src/db/repositories/ColumnRepository.ts b/backend/src/db/repositories/ColumnRepository.ts index efcc31073..1241ff0bb 100644 --- a/backend/src/db/repositories/ColumnRepository.ts +++ b/backend/src/db/repositories/ColumnRepository.ts @@ -1,7 +1,7 @@ -import { ColumnDefinitionEntity } from '../entities'; -import { ColumnDefinition as JsonColumnDefinition } from '../../common'; +import { ColumnDefinitionEntity } from '../entities/index.js'; +import { ColumnDefinition as JsonColumnDefinition } from '../../common/index.js'; import { v4 } from 'uuid'; -import { getBaseRepository } from './BaseRepository'; +import { getBaseRepository } from './BaseRepository.js'; export default getBaseRepository(ColumnDefinitionEntity).extend({ async saveFromJson( diff --git a/backend/src/db/repositories/LicenceRepository.ts b/backend/src/db/repositories/LicenceRepository.ts index 90b92af8f..b79a988f4 100644 --- a/backend/src/db/repositories/LicenceRepository.ts +++ b/backend/src/db/repositories/LicenceRepository.ts @@ -1,4 +1,4 @@ -import LicenceEntity from '../entities/Licence'; -import { getBaseRepository } from './BaseRepository'; +import LicenceEntity from '../entities/Licence.js'; +import { getBaseRepository } from './BaseRepository.js'; export default getBaseRepository(LicenceEntity).extend({}); diff --git a/backend/src/db/repositories/MessageRepository.ts b/backend/src/db/repositories/MessageRepository.ts index 2f38c20a3..d4b3b7801 100644 --- a/backend/src/db/repositories/MessageRepository.ts +++ b/backend/src/db/repositories/MessageRepository.ts @@ -1,8 +1,8 @@ -import { SessionEntity } from '../entities'; -import { Message as JsonMessage } from '../../common'; -import { cloneDeep } from 'lodash'; -import { getBaseRepository, saveAndReload } from './BaseRepository'; -import MessageEntity from '../entities/Message'; +import { SessionEntity } from '../entities/index.js'; +import { Message as JsonMessage } from '../../common/index.js'; +import { cloneDeep } from 'lodash-es'; +import { getBaseRepository, saveAndReload } from './BaseRepository.js'; +import MessageEntity from '../entities/Message.js'; export default getBaseRepository(MessageEntity).extend({ async saveFromJson( diff --git a/backend/src/db/repositories/PostGroupRepository.ts b/backend/src/db/repositories/PostGroupRepository.ts index 27be340ea..19e095583 100644 --- a/backend/src/db/repositories/PostGroupRepository.ts +++ b/backend/src/db/repositories/PostGroupRepository.ts @@ -1,7 +1,7 @@ -import { PostGroupEntity } from '../entities'; -import { PostGroup as JsonPostGroup } from '../../common'; -import { cloneDeep } from 'lodash'; -import { getBaseRepository, saveAndReload } from './BaseRepository'; +import { PostGroupEntity } from '../entities/index.js'; +import { PostGroup as JsonPostGroup } from '../../common/index.js'; +import { cloneDeep } from 'lodash-es'; +import { getBaseRepository, saveAndReload } from './BaseRepository.js'; export default getBaseRepository(PostGroupEntity).extend({ async saveFromJson( diff --git a/backend/src/db/repositories/PostRepository.ts b/backend/src/db/repositories/PostRepository.ts index 455166bf2..92e88759e 100644 --- a/backend/src/db/repositories/PostRepository.ts +++ b/backend/src/db/repositories/PostRepository.ts @@ -1,8 +1,8 @@ -import { SessionEntity, PostEntity } from '../entities'; -import SessionRepository from './SessionRepository'; -import { Post as JsonPost, defaultSession } from '../../common'; -import { cloneDeep } from 'lodash'; -import { getBaseRepository, saveAndReload } from './BaseRepository'; +import { SessionEntity, PostEntity } from '../entities/index.js'; +import SessionRepository from './SessionRepository.js'; +import { Post as JsonPost, defaultSession } from '../../common/index.js'; +import { cloneDeep } from 'lodash-es'; +import { getBaseRepository, saveAndReload } from './BaseRepository.js'; export default getBaseRepository(PostEntity).extend({ async updateFromJson( diff --git a/backend/src/db/repositories/SessionRepository.ts b/backend/src/db/repositories/SessionRepository.ts index 9f31ddb6d..f0684700f 100644 --- a/backend/src/db/repositories/SessionRepository.ts +++ b/backend/src/db/repositories/SessionRepository.ts @@ -1,7 +1,7 @@ -import { SessionEntity } from '../entities'; -import ColumnRepository from './ColumnRepository'; -import { Session as JsonSession, SessionOptions } from '../../common'; -import { getBaseRepository, saveAndReload } from './BaseRepository'; +import { SessionEntity } from '../entities/index.js'; +import ColumnRepository from './ColumnRepository.js'; +import { Session as JsonSession, SessionOptions } from '../../common/index.js'; +import { getBaseRepository, saveAndReload } from './BaseRepository.js'; export default getBaseRepository(SessionEntity).extend({ async updateOptions( diff --git a/backend/src/db/repositories/SessionTemplateRepository.ts b/backend/src/db/repositories/SessionTemplateRepository.ts index 983f8351f..66f23f180 100644 --- a/backend/src/db/repositories/SessionTemplateRepository.ts +++ b/backend/src/db/repositories/SessionTemplateRepository.ts @@ -1,12 +1,12 @@ -import { SessionTemplateEntity } from '../entities'; +import { SessionTemplateEntity } from '../entities/index.js'; import { SessionTemplate as JsonSessionTemplate, ColumnDefinition as JsonColumnDefinition, SessionOptions as JsonSessionOptions, -} from '../../common'; +} from '../../common/index.js'; import { v4 } from 'uuid'; -import { TemplateColumnRepository } from '.'; -import { getBaseRepository } from './BaseRepository'; +import { TemplateColumnRepository } from './index.js'; +import { getBaseRepository } from './BaseRepository.js'; export default getBaseRepository(SessionTemplateEntity).extend({ async saveFromJson( diff --git a/backend/src/db/repositories/SubscriptionRepository.ts b/backend/src/db/repositories/SubscriptionRepository.ts index e267dbdfd..b94814735 100644 --- a/backend/src/db/repositories/SubscriptionRepository.ts +++ b/backend/src/db/repositories/SubscriptionRepository.ts @@ -1,6 +1,6 @@ -import { UserEntity, SubscriptionEntity } from '../entities'; -import { Plan } from '../../common'; -import { getBaseRepository, saveAndReload } from './BaseRepository'; +import { UserEntity, SubscriptionEntity } from '../entities/index.js'; +import { Plan } from '../../common/index.js'; +import { getBaseRepository, saveAndReload } from './BaseRepository.js'; export default getBaseRepository(SubscriptionEntity).extend({ async activate( diff --git a/backend/src/db/repositories/TemplateColumnRepository.ts b/backend/src/db/repositories/TemplateColumnRepository.ts index fc6375c5a..9dd77d9cd 100644 --- a/backend/src/db/repositories/TemplateColumnRepository.ts +++ b/backend/src/db/repositories/TemplateColumnRepository.ts @@ -1,7 +1,7 @@ -import { TemplateColumnDefinitionEntity } from '../entities'; -import { ColumnDefinition as JsonColumnDefinition } from '../../common'; +import { TemplateColumnDefinitionEntity } from '../entities/index.js'; +import { ColumnDefinition as JsonColumnDefinition } from '../../common/index.js'; import { v4 } from 'uuid'; -import { getBaseRepository } from './BaseRepository'; +import { getBaseRepository } from './BaseRepository.js'; export default getBaseRepository(TemplateColumnDefinitionEntity).extend({ async saveFromJson( diff --git a/backend/src/db/repositories/UserIdentityRepository.ts b/backend/src/db/repositories/UserIdentityRepository.ts index 934dc3050..4ffb445d6 100644 --- a/backend/src/db/repositories/UserIdentityRepository.ts +++ b/backend/src/db/repositories/UserIdentityRepository.ts @@ -1,4 +1,4 @@ -import { UserIdentityEntity } from '../entities'; -import { getBaseRepository } from './BaseRepository'; +import { UserIdentityEntity } from '../entities/index.js'; +import { getBaseRepository } from './BaseRepository.js'; export default getBaseRepository(UserIdentityEntity).extend({}); diff --git a/backend/src/db/repositories/UserRepository.ts b/backend/src/db/repositories/UserRepository.ts index a943216f0..0028e9af7 100644 --- a/backend/src/db/repositories/UserRepository.ts +++ b/backend/src/db/repositories/UserRepository.ts @@ -1,7 +1,7 @@ -import { UserEntity } from '../entities'; -import { FullUser, User as JsonUser } from '../../common'; +import { UserEntity } from '../entities/index.js'; +import { FullUser, User as JsonUser } from '../../common/index.js'; import { addDays } from 'date-fns'; -import { getBaseRepository, saveAndReload } from './BaseRepository'; +import { getBaseRepository, saveAndReload } from './BaseRepository.js'; export default getBaseRepository(UserEntity).extend({ async saveFromJson(user: JsonUser): Promise { diff --git a/backend/src/db/repositories/VoteRepository.ts b/backend/src/db/repositories/VoteRepository.ts index a6370898f..d11a3202b 100644 --- a/backend/src/db/repositories/VoteRepository.ts +++ b/backend/src/db/repositories/VoteRepository.ts @@ -1,6 +1,6 @@ -import { VoteEntity } from '../entities'; -import { Vote as JsonVote } from '../../common'; -import { getBaseRepository } from './BaseRepository'; +import { VoteEntity } from '../entities/index.js'; +import { Vote as JsonVote } from '../../common/index.js'; +import { getBaseRepository } from './BaseRepository.js'; export default getBaseRepository(VoteEntity).extend({ async saveFromJson( diff --git a/backend/src/db/repositories/index.ts b/backend/src/db/repositories/index.ts index 0b69e3429..5c2d1944e 100644 --- a/backend/src/db/repositories/index.ts +++ b/backend/src/db/repositories/index.ts @@ -1,12 +1,12 @@ -export { default as SessionRepository } from './SessionRepository'; -export { default as PostRepository } from './PostRepository'; -export { default as PostGroupRepository } from './PostGroupRepository'; -export { default as ColumnRepository } from './ColumnRepository'; -export { default as VoteRepository } from './VoteRepository'; -export { default as UserRepository } from './UserRepository'; -export { default as SessionTemplateRepository } from './SessionTemplateRepository'; -export { default as TemplateColumnRepository } from './TemplateColumnRepository'; -export { default as SubscriptionRepository } from './SubscriptionRepository'; -export { default as UserIdentityRepository } from './UserIdentityRepository'; -export { default as LicenceRepository } from './LicenceRepository'; -export { default as MessageRepository } from './MessageRepository'; +export { default as SessionRepository } from './SessionRepository.js'; +export { default as PostRepository } from './PostRepository.js'; +export { default as PostGroupRepository } from './PostGroupRepository.js'; +export { default as ColumnRepository } from './ColumnRepository.js'; +export { default as VoteRepository } from './VoteRepository.js'; +export { default as UserRepository } from './UserRepository.js'; +export { default as SessionTemplateRepository } from './SessionTemplateRepository.js'; +export { default as TemplateColumnRepository } from './TemplateColumnRepository.js'; +export { default as SubscriptionRepository } from './SubscriptionRepository.js'; +export { default as UserIdentityRepository } from './UserIdentityRepository.js'; +export { default as LicenceRepository } from './LicenceRepository.js'; +export { default as MessageRepository } from './MessageRepository.js'; diff --git a/backend/src/email/emailSender.ts b/backend/src/email/emailSender.ts index ed6d5675b..42f43ca93 100644 --- a/backend/src/email/emailSender.ts +++ b/backend/src/email/emailSender.ts @@ -1,14 +1,14 @@ -import chalk from 'chalk'; -import config from '../config'; -import randomWords from './random-words'; -import { sendGridSender } from './sendgrid-sender'; -import { smtpSender } from './smtp-sender'; +import chalk from 'chalk-template'; +import config from '../config.js'; +import randomWords from './random-words.js'; +import { sendGridSender } from './sendgrid-sender.js'; +import { smtpSender } from './smtp-sender.js'; import { getPasswordResetTemplate, getRegisterTemplate, getSelfHostedWelcomeEmailTemplate, -} from './template-loader'; -import { EmailSender } from './types'; +} from './template-loader.js'; +import { EmailSender } from './types.js'; function getSender(): EmailSender | null { if (config.SENDGRID_API_KEY) { diff --git a/backend/src/email/sendgrid-sender.ts b/backend/src/email/sendgrid-sender.ts index e905f8e2c..c3d320c48 100644 --- a/backend/src/email/sendgrid-sender.ts +++ b/backend/src/email/sendgrid-sender.ts @@ -1,6 +1,6 @@ import sendGrid, { MailDataRequired } from '@sendgrid/mail'; -import config from '../config'; -import { EmailSender } from './types'; +import config from '../config.js'; +import { EmailSender } from './types.js'; if (config.SENDGRID_API_KEY) { sendGrid.setApiKey(config.SENDGRID_API_KEY); diff --git a/backend/src/email/smtp-sender.ts b/backend/src/email/smtp-sender.ts index 8af123bb5..e54e06b92 100644 --- a/backend/src/email/smtp-sender.ts +++ b/backend/src/email/smtp-sender.ts @@ -1,6 +1,6 @@ import nodemailer from 'nodemailer'; -import config from '../config'; -import { EmailSender } from './types'; +import config from '../config.js'; +import { EmailSender } from './types.js'; const transporter = nodemailer.createTransport({ host: config.MAIL_SMTP_HOST, diff --git a/backend/src/email/utils.ts b/backend/src/email/utils.ts index 0ce3fa470..36650cd1b 100644 --- a/backend/src/email/utils.ts +++ b/backend/src/email/utils.ts @@ -1,4 +1,4 @@ -import config from '../config'; +import config from '../config.js'; export function canSendEmails() { return !!config.MAIL_SMTP_HOST || !!config.SENDGRID_API_KEY; diff --git a/backend/src/game.ts b/backend/src/game.ts index d56024c1d..ced86b727 100644 --- a/backend/src/game.ts +++ b/backend/src/game.ts @@ -21,9 +21,9 @@ import { WsGroupUpdatePayload, WsUserReadyPayload, Message, -} from './common'; +} from './common/index.js'; import { RateLimiterMemory } from 'rate-limiter-flexible'; -import chalk from 'chalk'; +import chalk from 'chalk-template'; import moment from 'moment'; import { Server, Socket } from 'socket.io'; import { @@ -31,9 +31,9 @@ import { reportQueryError, throttledManualReport, manualMessage, -} from './sentry'; -import { SessionEntity, UserView } from './db/entities'; -import { hasField } from './security/payload-checker'; +} from './sentry.js'; +import { SessionEntity, UserView } from './db/entities/index.js'; +import { hasField } from './security/payload-checker.js'; import { getSession, updateOptions, @@ -47,8 +47,8 @@ import { doesSessionExists, wasSessionCreatedBy, toggleReady, -} from './db/actions/sessions'; -import { getUser, getUserView } from './db/actions/users'; +} from './db/actions/sessions.js'; +import { getUser, getUserView } from './db/actions/users.js'; import { savePost, savePostGroup, @@ -56,12 +56,12 @@ import { deletePostGroup, updatePost, updatePostGroup, -} from './db/actions/posts'; -import config from './config'; -import { registerVote } from './db/actions/votes'; -import { deserialiseIds, UserIds } from './utils'; +} from './db/actions/posts.js'; +import config from './config.js'; +import { registerVote } from './db/actions/votes.js'; +import { deserialiseIds, UserIds } from './utils.js'; import { QueryFailedError } from 'typeorm'; -import { saveChatMessage } from './db/actions/chat'; +import { saveChatMessage } from './db/actions/chat.js'; const { ACK, diff --git a/backend/src/hardcoded.ts b/backend/src/hardcoded.ts index cab17b76e..a1cdcc427 100644 --- a/backend/src/hardcoded.ts +++ b/backend/src/hardcoded.ts @@ -1,4 +1,4 @@ -import { encrypt, hashPassword } from './utils'; +import { encrypt, hashPassword } from './utils.js'; export async function buildHardcodedLicence( licenceKey: string, diff --git a/backend/src/index.ts b/backend/src/index.ts index ff0777790..4c5d95e81 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -4,23 +4,23 @@ import { createAdapter } from 'socket.io-redis'; import { createClient } from 'redis'; import connectRedis from 'connect-redis'; import http from 'http'; -import chalk from 'chalk'; -import db from './db'; -import config from './config'; -import passport from 'passport'; -import passportInit from './auth/passport'; -import authRouter from './auth/router'; -import adminRouter from './admin/router'; -import stripeRouter from './stripe/router'; -import slackRouter from './slack/router'; +import chalk from 'chalk-template'; import session from 'express-session'; -import game from './game'; +import passport from 'passport'; +import db from './db/index.js'; +import config from './config.js'; +import passportInit from './auth/passport.js'; +import authRouter from './auth/router.js'; +import adminRouter from './admin/router.js'; +import stripeRouter from './stripe/router.js'; +import slackRouter from './slack/router.js'; +import game from './game.js'; import { hashPassword, getIdentityFromRequest, getUserViewFromRequest, getUserQuota, -} from './utils'; +} from './utils.js'; import { initSentry, setupSentryErrorHandler, @@ -28,7 +28,7 @@ import { setScope, reportQueryError, throttledManualReport, -} from './sentry'; +} from './sentry.js'; import { RegisterPayload, ValidateEmailPayload, @@ -38,31 +38,34 @@ import { SelfHostedCheckPayload, DeleteAccountPayload, ChangeUserNamePayload, -} from './common'; -import registerPasswordUser from './auth/register/register-user'; -import { sendVerificationEmail, sendResetPassword } from './email/emailSender'; +} from './common/index.js'; +import registerPasswordUser from './auth/register/register-user.js'; +import { + sendVerificationEmail, + sendResetPassword, +} from './email/emailSender.js'; import { v4 } from 'uuid'; import { createSession, previousSessions, deleteSessions, getDefaultTemplate, -} from './db/actions/sessions'; +} from './db/actions/sessions.js'; import { updateUser, getUserView, getPasswordIdentity, updateIdentity, getIdentityByUsername, -} from './db/actions/users'; -import { isLicenced } from './security/is-licenced'; +} from './db/actions/users.js'; +import { isLicenced } from './security/is-licenced.js'; import rateLimit from 'express-rate-limit'; -import { fetchLicence, validateLicence } from './db/actions/licences'; -import { hasField } from './security/payload-checker'; +import { fetchLicence, validateLicence } from './db/actions/licences.js'; +import { hasField } from './security/payload-checker.js'; import mung from 'express-mung'; import { QueryFailedError } from 'typeorm'; -import { deleteAccount } from './db/actions/delete'; -import { noop } from 'lodash'; +import { deleteAccount } from './db/actions/delete.js'; +import { noop } from 'lodash-es'; const realIpHeader = 'X-Forwarded-For'; const sessionSecret = `${config.SESSION_SECRET!}-4.11.5`; // Increment to force re-auth diff --git a/backend/src/path-utils.ts b/backend/src/path-utils.ts new file mode 100644 index 000000000..3db82466a --- /dev/null +++ b/backend/src/path-utils.ts @@ -0,0 +1,14 @@ +import path from 'path'; +import { fileURLToPath } from 'url'; + +export function getFilename(metaUrl: string) { + const __filename = fileURLToPath(metaUrl); + + return __filename; +} + +export function getDirname(metaUrl: string) { + const __dirname = path.dirname(getFilename(metaUrl)); + + return __dirname; +} diff --git a/backend/src/security/is-licenced.ts b/backend/src/security/is-licenced.ts index 3b7ffd7d7..1450f19d1 100644 --- a/backend/src/security/is-licenced.ts +++ b/backend/src/security/is-licenced.ts @@ -1,8 +1,8 @@ -import { SelfHostedCheckPayload } from '../common'; -import config from '../config'; +import { SelfHostedCheckPayload } from '../common/index.js'; +import config from '../config.js'; import fetch from 'node-fetch'; -import wait, { comparePassword, decrypt } from '../utils'; -import { LicenceMetadata } from './../types'; +import wait, { comparePassword, decrypt } from '../utils.js'; +import { LicenceMetadata } from './../types.js'; let licenced: LicenceMetadata | null = null; diff --git a/backend/src/sentry.ts b/backend/src/sentry.ts index 0749df9da..2a5d6703c 100644 --- a/backend/src/sentry.ts +++ b/backend/src/sentry.ts @@ -1,11 +1,12 @@ -import config from './config'; +import config from './config.js'; import * as Sentry from '@sentry/node'; -import chalk from 'chalk'; +import chalk from 'chalk-template'; import { Express, Request } from 'express'; -import { version } from '../package.json'; +import packageJson from '../package.json' assert { type: 'json' }; import { QueryFailedError } from 'typeorm'; -import { throttle } from 'lodash'; +import { throttle } from 'lodash-es'; +const { version } = packageJson; const useSentry = !!config.SENTRY_URL && config.SENTRY_URL !== 'NO_SENTRY'; type ConfigureScopeFn = (scope: Sentry.Scope | null) => void; diff --git a/backend/src/slack/router.ts b/backend/src/slack/router.ts index c74f38449..e0eab10d0 100644 --- a/backend/src/slack/router.ts +++ b/backend/src/slack/router.ts @@ -1,7 +1,7 @@ import express, { Router } from 'express'; import fetch from 'node-fetch'; -import { createSessionFromSlack } from '../db/actions/sessions'; -import config from '../config'; +import { createSessionFromSlack } from '../db/actions/sessions.js'; +import config from '../config.js'; type SlackSlashCommand = { token: string; diff --git a/backend/src/stripe/products.ts b/backend/src/stripe/products.ts index 6c277078e..cedcf5767 100644 --- a/backend/src/stripe/products.ts +++ b/backend/src/stripe/products.ts @@ -1,6 +1,6 @@ -import { InternalProduct } from './types'; -import { Plan } from '../common'; -import config from '../config'; +import { InternalProduct } from './types.js'; +import { Plan } from '../common/index.js'; +import config from '../config.js'; export const teamPlan: InternalProduct = { name: 'Pro Team', diff --git a/backend/src/stripe/router.ts b/backend/src/stripe/router.ts index 621b18e7a..fbcc0377f 100644 --- a/backend/src/stripe/router.ts +++ b/backend/src/stripe/router.ts @@ -1,18 +1,22 @@ import express, { Router } from 'express'; -import { CreateSubscriptionPayload, Product, StripeLocales } from '../common'; -import config from '../config'; +import { + CreateSubscriptionPayload, + Product, + StripeLocales, +} from '../common/index.js'; +import config from '../config.js'; import Stripe from 'stripe'; -import { UserIdentityEntity } from '../db/entities'; +import { UserIdentityEntity } from '../db/entities/index.js'; import { StripeEvent, CheckoutCompletedPayload, SubscriptionDeletedPayload, -} from './types'; -import { plans, getProduct } from './products'; -import { updateUser } from '../db/actions/users'; -import { registerLicence } from '../db/actions/licences'; -import { getIdentityFromRequest } from '../utils'; -import isValidDomain from '../security/is-valid-domain'; +} from './types.js'; +import { plans, getProduct } from './products.js'; +import { updateUser } from '../db/actions/users.js'; +import { registerLicence } from '../db/actions/licences.js'; +import { getIdentityFromRequest } from '../utils.js'; +import isValidDomain from '../security/is-valid-domain.js'; import { cancelSubscription, activateSubscription, @@ -20,7 +24,7 @@ import { saveSubscription, startTrial, getActiveSubscriptionWhereUserIsAdmin, -} from '../db/actions/subscriptions'; +} from '../db/actions/subscriptions.js'; const stripe = new Stripe(config.STRIPE_SECRET, { apiVersion: '2022-11-15', diff --git a/backend/src/stripe/types.ts b/backend/src/stripe/types.ts index 3b9ac33d4..91cdb85ac 100644 --- a/backend/src/stripe/types.ts +++ b/backend/src/stripe/types.ts @@ -1,4 +1,4 @@ -import { Product, CreateSubscriptionPayload } from '../common'; +import { Product, CreateSubscriptionPayload } from '../common/index.js'; export interface InternalProduct extends Product { productId: string; diff --git a/backend/src/typings.d.ts b/backend/src/typings.d.ts index adfaa352d..0c62beaec 100644 --- a/backend/src/typings.d.ts +++ b/backend/src/typings.d.ts @@ -1,4 +1,4 @@ -import { UserIds } from './utils'; +import { UserIds } from './utils.js'; declare module 'express-serve-static-core' { interface Request { diff --git a/backend/src/utils.ts b/backend/src/utils.ts index 6fc33834d..9df9a27b2 100644 --- a/backend/src/utils.ts +++ b/backend/src/utils.ts @@ -1,11 +1,14 @@ import { Request } from 'express'; -import { compare, genSalt, hash } from 'bcryptjs'; -import aes from 'crypto-js/aes'; -import { stringify } from 'crypto-js/enc-utf8'; -import { UserView, UserIdentityEntity } from './db/entities'; -import { getUserView, getUser, getIdentity } from './db/actions/users'; -import { Quota } from './common'; -import { getNumberOfPosts } from './db/actions/posts'; +import bcryptjs from 'bcryptjs'; +import crypto from 'crypto-js'; +import { UserView, UserIdentityEntity } from './db/entities/index.js'; +import { getUserView, getUser, getIdentity } from './db/actions/users.js'; +import { Quota } from './common/index.js'; +import { getNumberOfPosts } from './db/actions/posts.js'; + +const aes = crypto.AES; +const stringify = crypto.enc.Utf8.stringify; +const { compare, genSalt, hash } = bcryptjs; export async function getUserViewFromRequest( request: Request diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 021f37116..0251ad76b 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -2,9 +2,9 @@ "compilerOptions": { "outDir": "./dist", "target": "es6", - "module": "commonjs", + "module": "ESNext", "incremental": true, - "moduleResolution": "node", + "moduleResolution": "NodeNext", "allowJs": false, "skipLibCheck": true, "esModuleInterop": true, @@ -20,7 +20,7 @@ "sourceMap": true, "inlineSources": true, "sourceRoot": "/", - "lib": ["es2015", "es2017", "dom"], + "lib": ["es2015", "es2017", "dom", "ESNext"], "baseUrl": "src" }, "include": ["src", "./package.json"], diff --git a/backend/yarn.lock b/backend/yarn.lock index 9baccb3ed..3dd1224d5 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -304,25 +304,25 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@eslint/eslintrc@^1.3.3": - version "1.3.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" - integrity sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg== +"@eslint/eslintrc@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.4.0.tgz#8ec64e0df3e7a1971ee1ff5158da87389f167a63" + integrity sha512-7yfvXy6MWLgWSFsLhz5yH3iQ52St8cdUY6FoGieKkRDVxuxmrNuUetIuu6cmjNWwniUHiWXjxCr5tTXDrbYS5A== dependencies: ajv "^6.12.4" debug "^4.3.2" espree "^9.4.0" - globals "^13.15.0" + globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" js-yaml "^4.1.0" minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@humanwhocodes/config-array@^0.11.6": - version "0.11.7" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.7.tgz#38aec044c6c828f6ed51d5d7ae3d9b9faf6dbb0f" - integrity sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw== +"@humanwhocodes/config-array@^0.11.8": + version "0.11.8" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" + integrity sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" @@ -684,39 +684,39 @@ "@sendgrid/client" "^7.7.0" "@sendgrid/helpers" "^7.7.0" -"@sentry/core@7.22.0": - version "7.22.0" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.22.0.tgz#8e50f288e5e8fcaa2774daffd2487e042a392893" - integrity sha512-qYJiJrL1mfQQln84mNunBRUkXq7xDGQQoNh4Sz9VYP5698va51zmS5BLYRCZ5CkPwRYNuhUqlUXN7bpYGYOOIA== +"@sentry/core@7.28.1": + version "7.28.1" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.28.1.tgz#c712ce17469b18b01606108817be24a99ed2116e" + integrity sha512-7wvnuvn/mrAfcugWoCG/3pqDIrUgH5t+HisMJMGw0h9Tc33KqrmqMDCQVvjlrr2pWrw/vuUCFdm8CbUHJ832oQ== dependencies: - "@sentry/types" "7.22.0" - "@sentry/utils" "7.22.0" + "@sentry/types" "7.28.1" + "@sentry/utils" "7.28.1" tslib "^1.9.3" -"@sentry/node@7.22.0": - version "7.22.0" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.22.0.tgz#d575481e56d3326ad457378db5ab7cc804b712fd" - integrity sha512-jKhxqKsbEEaY/g3FTzpj1fwukN0IkNv4V+0Fl+t/EmSNUL/7q5FMmDBa+fFQuQzwps8UEpzqPOzMSRapVsoP0w== +"@sentry/node@7.28.1": + version "7.28.1" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.28.1.tgz#fc53675a048c29c86e5a8cd3ba570c454f492c18" + integrity sha512-n7AbpJqZJjWPpKNGc55mP7AdQ+XSomS9MZJuZ+Xt2AU52aVwGPI4z9aHUJFSDGaMHHiu/toyPnoUES+XZf6/hw== dependencies: - "@sentry/core" "7.22.0" - "@sentry/types" "7.22.0" - "@sentry/utils" "7.22.0" + "@sentry/core" "7.28.1" + "@sentry/types" "7.28.1" + "@sentry/utils" "7.28.1" cookie "^0.4.1" https-proxy-agent "^5.0.0" lru_map "^0.3.3" tslib "^1.9.3" -"@sentry/types@7.22.0": - version "7.22.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.22.0.tgz#58e4ce77b523048e0f31e2ea4b597946d76f6079" - integrity sha512-LhCL+wb1Jch+OesB2CIt6xpfO1Ab6CRvoNYRRzVumWPLns1T3ZJkarYfhbLaOEIb38EIbPgREdxn2AJT560U4Q== +"@sentry/types@7.28.1": + version "7.28.1" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.28.1.tgz#9018b4c152b475de9bedd267237393d3c9b1253d" + integrity sha512-DvSplMVrVEmOzR2M161V5+B8Up3vR71xMqJOpWTzE9TqtFJRGPtqT/5OBsNJJw1+/j2ssMcnKwbEo9Q2EGeS6g== -"@sentry/utils@7.22.0": - version "7.22.0" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.22.0.tgz#fb46dc2761e2d44cf70bc3e1fba61d55852904b5" - integrity sha512-1GiNw1opIngxg0nktCTc9wibh4/LV12kclrnB9dAOHrqazZXHXZRAkjqrhQphKcMpT+3By91W6EofjaDt5a/hg== +"@sentry/utils@7.28.1": + version "7.28.1" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.28.1.tgz#0a7b6aa4b09e91e4d1aded2a8c8dbaf818cee96e" + integrity sha512-75/jzLUO9HH09iC9TslNimGbxOP3jgn89P+q7uR+rp2fJfRExHVeKJZQdK0Ij4/SmE7TJ3Uh2r154N0INZEx1g== dependencies: - "@sentry/types" "7.22.0" + "@sentry/types" "7.28.1" tslib "^1.9.3" "@sinclair/typebox@^0.24.1": @@ -841,7 +841,7 @@ resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.12.tgz#6b2c510a7ad7039e98e7b8d3d6598f4359e5c080" integrity sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw== -"@types/crypto-js@4.1.1": +"@types/crypto-js@^4.1.1": version "4.1.1" resolved "https://registry.yarnpkg.com/@types/crypto-js/-/crypto-js-4.1.1.tgz#602859584cecc91894eb23a4892f38cfa927890d" integrity sha512-BG7fQKZ689HIoc5h+6D2Dgq1fABRa0RbBWKBd9SP/MVRVXROflpm5fhwyATX5duFmbStzyzyycPB8qUYKDH3NA== @@ -937,10 +937,10 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@29.2.3": - version "29.2.3" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.2.3.tgz#f5fd88e43e5a9e4221ca361e23790d48fcf0a211" - integrity sha512-6XwoEbmatfyoCjWRX7z0fKMmgYKe9+/HrviJ5k0X/tjJWHGAezZOfYaxqQKuzG/TvQyr+ktjm4jgbk0s4/oF2w== +"@types/jest@29.2.4": + version "29.2.4" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.2.4.tgz#9c155c4b81c9570dbd183eb8604aa0ae80ba5a5b" + integrity sha512-PipFB04k2qTRPePduVLTRiPzQfvMeLwUN3Z21hsAKaB/W9IIzgB2pizCL466ftJlcyZqnHoC9ZHpxLGl3fS86A== dependencies: expect "^29.0.0" pretty-format "^29.0.0" @@ -950,10 +950,17 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== -"@types/lodash@4.14.190": - version "4.14.190" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.190.tgz#d8e99647af141c63902d0ca53cf2b34d2df33545" - integrity sha512-5iJ3FBJBvQHQ8sFhEhJfjUP+G+LalhavTkYyrAYqz5MEJG+erSv0k9KJLb6q7++17Lafk1scaTIFXcMJlwK8Mw== +"@types/lodash-es@^4.17.6": + version "4.17.6" + resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.6.tgz#c2ed4c8320ffa6f11b43eb89e9eaeec65966a0a0" + integrity sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg== + dependencies: + "@types/lodash" "*" + +"@types/lodash@*", "@types/lodash@4.14.191": + version "4.14.191" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.191.tgz#09511e7f7cba275acd8b419ddac8da9a6a79e2fa" + integrity sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ== "@types/mime@*": version "3.0.1" @@ -978,10 +985,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== -"@types/nodemailer@6.4.6": - version "6.4.6" - resolved "https://registry.yarnpkg.com/@types/nodemailer/-/nodemailer-6.4.6.tgz#ce21b4b474a08f672f182e15982b7945dde1f288" - integrity sha512-pD6fL5GQtUKvD2WnPmg5bC2e8kWCAPDwMPmHe/ohQbW+Dy0EcHgZ2oCSuPlWNqk74LS5BVMig1SymQbFMPPK3w== +"@types/nodemailer@6.4.7": + version "6.4.7" + resolved "https://registry.yarnpkg.com/@types/nodemailer/-/nodemailer-6.4.7.tgz#658f4bca47c1a895b1d7e054b3b54030a5e1f5e0" + integrity sha512-f5qCBGAn/f0qtRcd4SEn88c8Fp3Swct1731X4ryPKqS61/A3LmmzN8zaEz7hneJvpjFbUUgY7lru/B/7ODTazg== dependencies: "@types/node" "*" @@ -1117,10 +1124,10 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== -"@types/uuid@8.3.4": - version "8.3.4" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc" - integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== +"@types/uuid@9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.0.tgz#53ef263e5239728b56096b0a869595135b7952d2" + integrity sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q== "@types/yargs-parser@*": version "21.0.0" @@ -1134,14 +1141,14 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.45.0.tgz#ffa505cf961d4844d38cfa19dcec4973a6039e41" - integrity sha512-CXXHNlf0oL+Yg021cxgOdMHNTXD17rHkq7iW6RFHoybdFgQBjU3yIXhhcPpGwr1CjZlo6ET8C6tzX5juQoXeGA== +"@typescript-eslint/eslint-plugin@5.47.1": + version "5.47.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.47.1.tgz#50cc5085578a7fa22cd46a0806c2e5eae858af02" + integrity sha512-r4RZ2Jl9kcQN7K/dcOT+J7NAimbiis4sSM9spvWimsBvDegMhKLA5vri2jG19PmIPbDjPeWzfUPQ2hjEzA4Nmg== dependencies: - "@typescript-eslint/scope-manager" "5.45.0" - "@typescript-eslint/type-utils" "5.45.0" - "@typescript-eslint/utils" "5.45.0" + "@typescript-eslint/scope-manager" "5.47.1" + "@typescript-eslint/type-utils" "5.47.1" + "@typescript-eslint/utils" "5.47.1" debug "^4.3.4" ignore "^5.2.0" natural-compare-lite "^1.4.0" @@ -1149,72 +1156,72 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.45.0.tgz#b18a5f6b3cf1c2b3e399e9d2df4be40d6b0ddd0e" - integrity sha512-brvs/WSM4fKUmF5Ot/gEve6qYiCMjm6w4HkHPfS6ZNmxTS0m0iNN4yOChImaCkqc1hRwFGqUyanMXuGal6oyyQ== +"@typescript-eslint/parser@5.47.1": + version "5.47.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.47.1.tgz#c4bf16f8c3c7608ce4bf8ff804b677fc899f173f" + integrity sha512-9Vb+KIv29r6GPu4EboWOnQM7T+UjpjXvjCPhNORlgm40a9Ia9bvaPJswvtae1gip2QEeVeGh6YquqAzEgoRAlw== dependencies: - "@typescript-eslint/scope-manager" "5.45.0" - "@typescript-eslint/types" "5.45.0" - "@typescript-eslint/typescript-estree" "5.45.0" + "@typescript-eslint/scope-manager" "5.47.1" + "@typescript-eslint/types" "5.47.1" + "@typescript-eslint/typescript-estree" "5.47.1" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.45.0.tgz#7a4ac1bfa9544bff3f620ab85947945938319a96" - integrity sha512-noDMjr87Arp/PuVrtvN3dXiJstQR1+XlQ4R1EvzG+NMgXi8CuMCXpb8JqNtFHKceVSQ985BZhfRdowJzbv4yKw== +"@typescript-eslint/scope-manager@5.47.1": + version "5.47.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz#0d302b3c2f20ab24e4787bf3f5a0d8c449b823bd" + integrity sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw== dependencies: - "@typescript-eslint/types" "5.45.0" - "@typescript-eslint/visitor-keys" "5.45.0" + "@typescript-eslint/types" "5.47.1" + "@typescript-eslint/visitor-keys" "5.47.1" -"@typescript-eslint/type-utils@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.45.0.tgz#aefbc954c40878fcebeabfb77d20d84a3da3a8b2" - integrity sha512-DY7BXVFSIGRGFZ574hTEyLPRiQIvI/9oGcN8t1A7f6zIs6ftbrU0nhyV26ZW//6f85avkwrLag424n+fkuoJ1Q== +"@typescript-eslint/type-utils@5.47.1": + version "5.47.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.47.1.tgz#aee13314f840ab336c1adb49a300856fd16d04ce" + integrity sha512-/UKOeo8ee80A7/GJA427oIrBi/Gd4osk/3auBUg4Rn9EahFpevVV1mUK8hjyQD5lHPqX397x6CwOk5WGh1E/1w== dependencies: - "@typescript-eslint/typescript-estree" "5.45.0" - "@typescript-eslint/utils" "5.45.0" + "@typescript-eslint/typescript-estree" "5.47.1" + "@typescript-eslint/utils" "5.47.1" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.45.0.tgz#794760b9037ee4154c09549ef5a96599621109c5" - integrity sha512-QQij+u/vgskA66azc9dCmx+rev79PzX8uDHpsqSjEFtfF2gBUTRCpvYMh2gw2ghkJabNkPlSUCimsyBEQZd1DA== +"@typescript-eslint/types@5.47.1": + version "5.47.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.47.1.tgz#459f07428aec5a8c4113706293c2ae876741ac8e" + integrity sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A== -"@typescript-eslint/typescript-estree@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.0.tgz#f70a0d646d7f38c0dfd6936a5e171a77f1e5291d" - integrity sha512-maRhLGSzqUpFcZgXxg1qc/+H0bT36lHK4APhp0AEUVrpSwXiRAomm/JGjSG+kNUio5kAa3uekCYu/47cnGn5EQ== +"@typescript-eslint/typescript-estree@5.47.1": + version "5.47.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz#b9d8441308aca53df7f69b2c67a887b82c9ed418" + integrity sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA== dependencies: - "@typescript-eslint/types" "5.45.0" - "@typescript-eslint/visitor-keys" "5.45.0" + "@typescript-eslint/types" "5.47.1" + "@typescript-eslint/visitor-keys" "5.47.1" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.45.0.tgz#9cca2996eee1b8615485a6918a5c763629c7acf5" - integrity sha512-OUg2JvsVI1oIee/SwiejTot2OxwU8a7UfTFMOdlhD2y+Hl6memUSL4s98bpUTo8EpVEr0lmwlU7JSu/p2QpSvA== +"@typescript-eslint/utils@5.47.1": + version "5.47.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.47.1.tgz#595f25ac06e9ee28c339fd43c709402820b13d7b" + integrity sha512-l90SdwqfmkuIVaREZ2ykEfCezepCLxzWMo5gVfcJsJCaT4jHT+QjgSkYhs5BMQmWqE9k3AtIfk4g211z/sTMVw== dependencies: "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.45.0" - "@typescript-eslint/types" "5.45.0" - "@typescript-eslint/typescript-estree" "5.45.0" + "@typescript-eslint/scope-manager" "5.47.1" + "@typescript-eslint/types" "5.47.1" + "@typescript-eslint/typescript-estree" "5.47.1" eslint-scope "^5.1.1" eslint-utils "^3.0.0" semver "^7.3.7" -"@typescript-eslint/visitor-keys@5.45.0": - version "5.45.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.45.0.tgz#e0d160e9e7fdb7f8da697a5b78e7a14a22a70528" - integrity sha512-jc6Eccbn2RtQPr1s7th6jJWQHBHI6GBVQkCHoJFQ5UreaKm59Vxw+ynQUPPY2u2Amquc+7tmEoC2G52ApsGNNg== +"@typescript-eslint/visitor-keys@5.47.1": + version "5.47.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz#d35c2da544dbb685db9c5b5b85adac0a1d74d1f2" + integrity sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig== dependencies: - "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/types" "5.47.1" eslint-visitor-keys "^3.3.0" abbrev@1: @@ -1555,13 +1562,17 @@ caniuse-lite@^1.0.30001370: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001393.tgz#1aa161e24fe6af2e2ccda000fc2b94be0b0db356" integrity sha512-N/od11RX+Gsk+1qY/jbPa0R6zJupEa0lxeBG598EbrtblxVCTJsQwbRBm6+V+rxpc5lHKdsXb9RY83cZIPLseA== -chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== +chalk-template@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/chalk-template/-/chalk-template-0.5.0.tgz#fc4051675895e931eacf7f9a5f38763824c2d543" + integrity sha512-r6AUjtuzcj1878vCCAbAqizipEN5zxbQEx1Ug7LcAG+iSOBzOuQnKPXtZJGDPHOyXOblG5/J0md+KY10xqtpVQ== dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" + chalk "^4.1.2" + +chalk@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" + integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== chalk@^2.0.0: version "2.4.2" @@ -1572,6 +1583,14 @@ chalk@^2.0.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -1763,6 +1782,11 @@ crypto-js@4.1.1: resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf" integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw== +data-uri-to-buffer@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b" + integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA== + date-fns@2.29.3, date-fns@^2.28.0: version "2.29.3" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8" @@ -1986,13 +2010,13 @@ eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@8.28.0: - version "8.28.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.28.0.tgz#81a680732634677cc890134bcdd9fdfea8e63d6e" - integrity sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ== +eslint@8.30.0: + version "8.30.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.30.0.tgz#83a506125d089eef7c5b5910eeea824273a33f50" + integrity sha512-MGADB39QqYuzEGov+F/qb18r4i7DohCDOfatHaxI2iGlPuC65bwG2gxgO+7DkyL38dRFaRH7RaRAgU6JKL9rMQ== dependencies: - "@eslint/eslintrc" "^1.3.3" - "@humanwhocodes/config-array" "^0.11.6" + "@eslint/eslintrc" "^1.4.0" + "@humanwhocodes/config-array" "^0.11.8" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" ajv "^6.10.0" @@ -2011,7 +2035,7 @@ eslint@8.28.0: file-entry-cache "^6.0.1" find-up "^5.0.0" glob-parent "^6.0.2" - globals "^13.15.0" + globals "^13.19.0" grapheme-splitter "^1.0.4" ignore "^5.2.0" import-fresh "^3.0.0" @@ -2232,6 +2256,14 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fetch-blob@^3.1.2, fetch-blob@^3.1.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" + integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== + dependencies: + node-domexception "^1.0.0" + web-streams-polyfill "^3.0.3" + file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" @@ -2302,6 +2334,13 @@ form-data@^3.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" +formdata-polyfill@^4.0.10: + version "4.0.10" + resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" + integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== + dependencies: + fetch-blob "^3.1.2" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -2394,10 +2433,10 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globals@^13.15.0: - version "13.17.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.17.0.tgz#902eb1e680a41da93945adbdcb5a9f361ba69bd4" - integrity sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw== +globals@^13.19.0: + version "13.19.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.19.0.tgz#7a42de8e6ad4f7242fbcca27ea5b23aca367b5c8" + integrity sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ== dependencies: type-fest "^0.20.2" @@ -3182,6 +3221,11 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +lodash-es@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + lodash.memoize@4.x: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -3354,7 +3398,21 @@ neo-async@^2.6.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -node-fetch@2.6.7, node-fetch@^2.6.1: +node-domexception@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + +node-fetch@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.0.tgz#37e71db4ecc257057af828d523a7243d651d91e4" + integrity sha512-BKwRP/O0UvoMKp7GNdwPlObhYGB5DQqwhEDQlNKuoqwVYSxkSZCSbHjnFFmUEtwSKRPU4kNK8PbDYYitwaE3QA== + dependencies: + data-uri-to-buffer "^4.0.0" + fetch-blob "^3.1.4" + formdata-polyfill "^4.0.10" + +node-fetch@^2.6.1: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== @@ -3779,10 +3837,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.0.tgz#c7df58393c9ba77d6fba3921ae01faf994fb9dc9" - integrity sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA== +prettier@2.8.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc" + integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg== pretty-format@^29.0.0, pretty-format@^29.0.2: version "29.0.2" @@ -4285,10 +4343,10 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -stripe@11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/stripe/-/stripe-11.1.0.tgz#28931a1136ccc2dffa44ef27027275a7b346a266" - integrity sha512-erOslPQZSYKOotQjmKRy4eBon/tdhzLIYzBdPSNVWDdatSQozkkPlh8mVeXNwubYYZYx61/yS23eWiGDF93z2w== +stripe@11.5.0: + version "11.5.0" + resolved "https://registry.yarnpkg.com/stripe/-/stripe-11.5.0.tgz#c50728f3bc6c78f4cac097852a95be1a86d6b0b7" + integrity sha512-yjTqnzeUk2wg1yIeYWOAH6CL5qu9fINzOhqkibXfbyeWSBEBauQrfCoB8shMmREoK2qdkScz1HjahF9qUg+X3g== dependencies: "@types/node" ">=8.1.0" qs "^6.11.0" @@ -4607,6 +4665,11 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" +web-streams-polyfill@^3.0.3: + version "3.2.1" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" + integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" diff --git a/esm.md b/esm.md new file mode 100644 index 000000000..bcdc5b19d --- /dev/null +++ b/esm.md @@ -0,0 +1,6 @@ +import(.*)?from '\.([a-z/-_]*?)'; +import$1from '.$2.js'; +backend/**/*.ts + +from '([\./]+)([a-zA-Z/\-_]*?)'; +from '$1$2.js'; \ No newline at end of file