👷 Transpile components for better DX
This commit is contained in:
committed by
Baptiste Arnaud
parent
898367a33b
commit
c1dd4d403e
@@ -1,7 +1,8 @@
|
||||
import { Credentials as CredentialsFromDb } from 'db'
|
||||
import { OAuth2Client, Credentials } from 'google-auth-library'
|
||||
import { GoogleSheetsCredentialsData } from 'models'
|
||||
import { decrypt, encrypt, isDefined } from 'utils'
|
||||
import { isDefined } from 'utils'
|
||||
import { decrypt, encrypt } from 'utils/api'
|
||||
import prisma from './prisma'
|
||||
|
||||
export const getAuthenticatedGoogleClient = async (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const { withSentryConfig } = require('@sentry/nextjs')
|
||||
const path = require('path')
|
||||
const withTM = require('next-transpile-modules')(['utils', 'models'])
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
@@ -15,6 +16,8 @@ const sentryWebpackPluginOptions = {
|
||||
silent: true,
|
||||
}
|
||||
|
||||
module.exports = process.env.SENTRY_AUTH_TOKEN
|
||||
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
|
||||
: nextConfig
|
||||
module.exports = withTM(
|
||||
process.env.SENTRY_AUTH_TOKEN
|
||||
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
|
||||
: nextConfig
|
||||
)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"dx": "pnpm dev",
|
||||
"dev": "ENVSH_ENV=.env.local bash ../../env.sh next dev -p 3001",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { badRequest, initMiddleware, methodNotAllowed, hasValue } from 'utils'
|
||||
import { badRequest, initMiddleware, methodNotAllowed } from 'utils/api'
|
||||
import { hasValue } from 'utils'
|
||||
import { GoogleSpreadsheet } from 'google-spreadsheet'
|
||||
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
||||
import { Cell } from 'models'
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
forbidden,
|
||||
initMiddleware,
|
||||
methodNotAllowed,
|
||||
} from 'utils'
|
||||
} from 'utils/api'
|
||||
import Stripe from 'stripe'
|
||||
|
||||
import Cors from 'cors'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'POST') {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'POST') {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from 'libs/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import Cors from 'cors'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from 'utils'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from 'utils/api'
|
||||
|
||||
const cors = initMiddleware(Cors())
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from 'libs/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import { methodNotAllowed } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -15,14 +15,8 @@ import {
|
||||
import { parseVariables } from 'bot-engine'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import got, { Method, Headers, HTTPError } from 'got'
|
||||
import {
|
||||
byId,
|
||||
initMiddleware,
|
||||
methodNotAllowed,
|
||||
notFound,
|
||||
omit,
|
||||
parseAnswers,
|
||||
} from 'utils'
|
||||
import { byId, omit, parseAnswers } from 'utils'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from 'utils/api'
|
||||
import { stringify } from 'qs'
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import Cors from 'cors'
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Typebot } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser, getLinkedTypebots } from 'services/api/utils'
|
||||
import { parseSampleResult } from 'services/api/webhooks'
|
||||
import { methodNotAllowed } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -9,7 +9,8 @@ import {
|
||||
WebhookBlock,
|
||||
} from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { byId, initMiddleware, methodNotAllowed, notFound } from 'utils'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from 'utils/api'
|
||||
import { byId } from 'utils'
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import Cors from 'cors'
|
||||
import { executeWebhook } from '../../executeWebhook'
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Typebot } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser, getLinkedTypebots } from 'services/api/utils'
|
||||
import { parseSampleResult } from 'services/api/webhooks'
|
||||
import { methodNotAllowed } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
||||
import { Typebot, WebhookBlock } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import { byId, methodNotAllowed } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { byId } from 'utils'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
||||
import { Typebot, WebhookBlock } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import { byId, methodNotAllowed } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { byId } from 'utils'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -9,12 +9,9 @@ import {
|
||||
badRequest,
|
||||
generatePresignedUrl,
|
||||
methodNotAllowed,
|
||||
byId,
|
||||
getStorageLimit,
|
||||
sendEmailNotification,
|
||||
isDefined,
|
||||
env,
|
||||
} from 'utils'
|
||||
} from 'utils/api'
|
||||
import { byId, getStorageLimit, isDefined, env } from 'utils'
|
||||
|
||||
const LIMIT_EMAIL_TRIGGER_PERCENT = 0.8
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
||||
import { Typebot, WebhookBlock } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import { byId, methodNotAllowed } from 'utils'
|
||||
import { byId } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
||||
import { Typebot, WebhookBlock } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import { byId, methodNotAllowed } from 'utils'
|
||||
import { byId } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -7,15 +7,8 @@ import {
|
||||
} from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { createTransport, getTestMessageUrl } from 'nodemailer'
|
||||
import {
|
||||
decrypt,
|
||||
initMiddleware,
|
||||
isEmpty,
|
||||
isNotDefined,
|
||||
methodNotAllowed,
|
||||
omit,
|
||||
parseAnswers,
|
||||
} from 'utils'
|
||||
import { isEmpty, isNotDefined, omit, parseAnswers } from 'utils'
|
||||
import { methodNotAllowed, initMiddleware, decrypt } from 'utils/api'
|
||||
|
||||
import Cors from 'cors'
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
|
||||
@@ -5,14 +5,8 @@ import prisma from 'libs/prisma'
|
||||
import { ResultWithAnswers } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import {
|
||||
env,
|
||||
getChatsLimit,
|
||||
isDefined,
|
||||
methodNotAllowed,
|
||||
parseNumberWithCommas,
|
||||
sendEmailNotification,
|
||||
} from 'utils'
|
||||
import { env, getChatsLimit, isDefined, parseNumberWithCommas } from 'utils'
|
||||
import { sendEmailNotification, methodNotAllowed } from 'utils/api'
|
||||
|
||||
const LIMIT_EMAIL_TRIGGER_PERCENT = 0.8
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from 'libs/prisma'
|
||||
import { Result } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'PATCH') {
|
||||
|
||||
@@ -3,7 +3,8 @@ import { Answer } from 'db'
|
||||
import { got } from 'got'
|
||||
import prisma from 'libs/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { isNotDefined, methodNotAllowed } from 'utils'
|
||||
import { isNotDefined } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'PUT') {
|
||||
|
||||
@@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
||||
import { Group, WebhookBlock } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import { byId, isWebhookBlock, methodNotAllowed } from 'utils'
|
||||
import { byId, isWebhookBlock } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
||||
import { Group, WebhookBlock } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import { byId, isNotDefined, isWebhookBlock, methodNotAllowed } from 'utils'
|
||||
import { byId, isNotDefined, isWebhookBlock } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { authenticateUser } from 'services/api/utils'
|
||||
import { isNotDefined, methodNotAllowed } from 'utils'
|
||||
import { isNotDefined } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -10,7 +10,8 @@ import {
|
||||
} from 'models'
|
||||
import { GraphNavigation, Plan, PrismaClient, WorkspaceRole } from 'db'
|
||||
import { readFileSync } from 'fs'
|
||||
import { createFakeResults, encrypt } from 'utils'
|
||||
import { createFakeResults } from 'utils'
|
||||
import { encrypt } from 'utils/api'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user