👷 Transpile components for better DX
This commit is contained in:
committed by
Baptiste Arnaud
parent
898367a33b
commit
c1dd4d403e
@ -138,16 +138,26 @@ const duplicateBlockDraft =
|
|||||||
(groupId: string) =>
|
(groupId: string) =>
|
||||||
(block: Block): Block => {
|
(block: Block): Block => {
|
||||||
const blockId = cuid()
|
const blockId = cuid()
|
||||||
|
if (blockHasItems(block))
|
||||||
|
return {
|
||||||
|
...block,
|
||||||
|
groupId,
|
||||||
|
id: blockId,
|
||||||
|
items: block.items.map(duplicateItemDraft(blockId)),
|
||||||
|
outgoingEdgeId: undefined,
|
||||||
|
} as Block
|
||||||
|
if (isWebhookBlock(block))
|
||||||
|
return {
|
||||||
|
...block,
|
||||||
|
groupId,
|
||||||
|
id: blockId,
|
||||||
|
webhookId: cuid(),
|
||||||
|
outgoingEdgeId: undefined,
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...block,
|
...block,
|
||||||
groupId,
|
groupId,
|
||||||
id: blockId,
|
id: blockId,
|
||||||
items: blockHasItems(block)
|
|
||||||
? block.items.map(duplicateItemDraft(blockId))
|
|
||||||
: undefined,
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
//@ts-ignore
|
|
||||||
webhookId: isWebhookBlock(block) ? cuid() : undefined,
|
|
||||||
outgoingEdgeId: undefined,
|
outgoingEdgeId: undefined,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Credentials as CredentialsFromDb } from 'db'
|
import { Credentials as CredentialsFromDb } from 'db'
|
||||||
import { OAuth2Client, Credentials } from 'google-auth-library'
|
import { OAuth2Client, Credentials } from 'google-auth-library'
|
||||||
import { GoogleSheetsCredentialsData } from 'models'
|
import { GoogleSheetsCredentialsData } from 'models'
|
||||||
import { decrypt, encrypt, isDefined } from 'utils'
|
import { isDefined } from 'utils'
|
||||||
|
import { decrypt, encrypt } from 'utils/api'
|
||||||
import prisma from './prisma'
|
import prisma from './prisma'
|
||||||
|
|
||||||
export const oauth2Client = new OAuth2Client(
|
export const oauth2Client = new OAuth2Client(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const { withSentryConfig } = require('@sentry/nextjs')
|
const { withSentryConfig } = require('@sentry/nextjs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const withTM = require('next-transpile-modules')(['utils', 'models'])
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
@ -15,6 +16,8 @@ const sentryWebpackPluginOptions = {
|
|||||||
silent: true,
|
silent: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = process.env.SENTRY_AUTH_TOKEN
|
module.exports = withTM(
|
||||||
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
|
process.env.SENTRY_AUTH_TOKEN
|
||||||
: nextConfig
|
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
|
||||||
|
: nextConfig
|
||||||
|
)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dx": "pnpm dev",
|
|
||||||
"dev": "ENVSH_ENV=.env.local bash ../../env.sh next dev -p 3000",
|
"dev": "ENVSH_ENV=.env.local bash ../../env.sh next dev -p 3000",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
@ -108,6 +107,7 @@
|
|||||||
"eslint-config-next": "12.3.0",
|
"eslint-config-next": "12.3.0",
|
||||||
"eslint-plugin-react": "^7.31.8",
|
"eslint-plugin-react": "^7.31.8",
|
||||||
"models": "workspace:*",
|
"models": "workspace:*",
|
||||||
|
"next-transpile-modules": "^9.0.0",
|
||||||
"typescript": "^4.8.3",
|
"typescript": "^4.8.3",
|
||||||
"utils": "workspace:*"
|
"utils": "workspace:*"
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ import { NextApiRequest, NextApiResponse } from 'next'
|
|||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import {
|
import {
|
||||||
badRequest,
|
badRequest,
|
||||||
encrypt,
|
|
||||||
forbidden,
|
forbidden,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
encrypt,
|
||||||
|
} from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils'
|
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -4,7 +4,7 @@ import prisma from 'libs/prisma'
|
|||||||
import { googleSheetsScopes } from './consent-url'
|
import { googleSheetsScopes } from './consent-url'
|
||||||
import { stringify } from 'querystring'
|
import { stringify } from 'querystring'
|
||||||
import { CredentialsType } from 'models'
|
import { CredentialsType } from 'models'
|
||||||
import { badRequest, encrypt, notAuthenticated } from 'utils'
|
import { badRequest, encrypt, notAuthenticated } from 'utils/api'
|
||||||
import { oauth2Client } from 'libs/google-sheets'
|
import { oauth2Client } from 'libs/google-sheets'
|
||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
forbidden,
|
forbidden,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils'
|
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
import { got } from 'got'
|
import { got } from 'got'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { DashboardFolder, WorkspaceRole } from 'db'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils'
|
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import { DashboardFolder } from 'db'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import { SmtpCredentialsData } from 'models'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { createTransport } from 'nodemailer'
|
import { createTransport } from 'nodemailer'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { notAuthenticated } from 'utils'
|
import { notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { drive } from '@googleapis/drive'
|
import { drive } from '@googleapis/drive'
|
||||||
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
||||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils'
|
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
import { setUser, withSentry } from '@sentry/nextjs'
|
import { setUser, withSentry } from '@sentry/nextjs'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { GoogleSpreadsheet } from 'google-spreadsheet'
|
import { GoogleSpreadsheet } from 'google-spreadsheet'
|
||||||
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
||||||
import {
|
import { isDefined } from 'utils'
|
||||||
badRequest,
|
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
isDefined,
|
|
||||||
methodNotAllowed,
|
|
||||||
notAuthenticated,
|
|
||||||
} from 'utils'
|
|
||||||
import { withSentry, setUser } from '@sentry/nextjs'
|
import { withSentry, setUser } from '@sentry/nextjs'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
|
|
||||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
|
|
||||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
|
@ -4,7 +4,7 @@ import { InputBlockType, PublicTypebot } from 'models'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canPublishFileInput } from 'services/api/dbRules'
|
import { canPublishFileInput } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils'
|
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -4,7 +4,7 @@ import { InputBlockType, PublicTypebot } from 'models'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canPublishFileInput } from 'services/api/dbRules'
|
import { canPublishFileInput } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils'
|
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
generatePresignedUrl,
|
generatePresignedUrl,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
|
|
||||||
const handler = async (
|
const handler = async (
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
forbidden,
|
forbidden,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
forbidden,
|
forbidden,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
|
import { isDefined } from 'utils'
|
||||||
import {
|
import {
|
||||||
badRequest,
|
badRequest,
|
||||||
forbidden,
|
forbidden,
|
||||||
isDefined,
|
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
import Cors from 'micro-cors'
|
import Cors from 'micro-cors'
|
||||||
import { buffer } from 'micro'
|
import { buffer } from 'micro'
|
||||||
|
@ -4,7 +4,12 @@ import prisma from 'libs/prisma'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { parseNewTypebot } from 'services/typebots/typebots'
|
import { parseNewTypebot } from 'services/typebots/typebots'
|
||||||
import { badRequest, methodNotAllowed, notAuthenticated, notFound } from 'utils'
|
import {
|
||||||
|
badRequest,
|
||||||
|
methodNotAllowed,
|
||||||
|
notAuthenticated,
|
||||||
|
notFound,
|
||||||
|
} from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -4,7 +4,7 @@ import prisma from 'libs/prisma'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebot, canWriteTypebot } from 'services/api/dbRules'
|
import { canReadTypebot, canWriteTypebot } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import prisma from 'libs/prisma'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebot } from 'services/api/dbRules'
|
import { canReadTypebot } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated, notFound } from 'utils'
|
import { methodNotAllowed, notAuthenticated, notFound } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import prisma from 'libs/prisma'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebot } from 'services/api/dbRules'
|
import { canReadTypebot } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import prisma from 'libs/prisma'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canEditGuests } from 'services/api/dbRules'
|
import { canEditGuests } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -4,15 +4,15 @@ import { CollaborationType, WorkspaceRole } from 'db'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebot, canWriteTypebot } from 'services/api/dbRules'
|
import { canReadTypebot, canWriteTypebot } from 'services/api/dbRules'
|
||||||
import { sendEmailNotification } from 'utils'
|
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
|
||||||
import {
|
import {
|
||||||
|
sendEmailNotification,
|
||||||
badRequest,
|
badRequest,
|
||||||
env,
|
|
||||||
forbidden,
|
forbidden,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
import { env } from 'utils'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -4,7 +4,7 @@ import prisma from 'libs/prisma'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canEditGuests } from 'services/api/dbRules'
|
import { canEditGuests } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
forbidden,
|
forbidden,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import prisma from 'libs/prisma'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebot } from 'services/api/dbRules'
|
import { canReadTypebot } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { PublicTypebot } from 'models'
|
import { PublicTypebot } from 'models'
|
||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { canReadTypebot } from 'services/api/dbRules'
|
import { canReadTypebot } from 'services/api/dbRules'
|
||||||
|
@ -4,7 +4,7 @@ import { Stats } from 'models'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebot } from 'services/api/dbRules'
|
import { canReadTypebot } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -4,7 +4,7 @@ import { defaultWebhookAttributes } from 'models'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canWriteTypebot } from 'services/api/dbRules'
|
import { canWriteTypebot } from 'services/api/dbRules'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { forbidden, methodNotAllowed, notAuthenticated } from 'utils'
|
import { forbidden, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -2,7 +2,8 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { generateId, methodNotAllowed, notAuthenticated } from 'utils'
|
import { generateId } from 'utils'
|
||||||
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
forbidden,
|
forbidden,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import { Plan, Workspace } from 'db'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import { Workspace, WorkspaceRole } from 'db'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,15 +3,14 @@ import { workspaceMemberInvitationEmail } from 'assets/emails/workspaceMemberInv
|
|||||||
import { Workspace, WorkspaceInvitation, WorkspaceRole } from 'db'
|
import { Workspace, WorkspaceInvitation, WorkspaceRole } from 'db'
|
||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { sendEmailNotification } from 'utils'
|
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
|
||||||
import {
|
import {
|
||||||
env,
|
sendEmailNotification,
|
||||||
forbidden,
|
forbidden,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
notAuthenticated,
|
notAuthenticated,
|
||||||
seatsLimit,
|
} from 'utils/api'
|
||||||
} from 'utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
|
import { env, seatsLimit } from 'utils'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import { WorkspaceInvitation, WorkspaceRole } from 'db'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated, notFound } from 'utils'
|
import { methodNotAllowed, notAuthenticated, notFound } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -3,7 +3,7 @@ import { MemberInWorkspace, WorkspaceRole } from 'db'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from 'services/api/utils'
|
import { getAuthenticatedUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed, notAuthenticated } from 'utils'
|
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await getAuthenticatedUser(req)
|
const user = await getAuthenticatedUser(req)
|
||||||
|
@ -18,7 +18,8 @@ import {
|
|||||||
Workspace,
|
Workspace,
|
||||||
} from 'db'
|
} from 'db'
|
||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
import { encrypt, createFakeResults } from 'utils'
|
import { createFakeResults } from 'utils'
|
||||||
|
import { encrypt } from 'utils/api'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
|
|
||||||
const prisma = new PrismaClient()
|
const prisma = new PrismaClient()
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { CollaborationType, Plan, Prisma, User, WorkspaceRole } from 'db'
|
import { CollaborationType, Plan, Prisma, User, WorkspaceRole } from 'db'
|
||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiResponse } from 'next'
|
import { NextApiResponse } from 'next'
|
||||||
import { env, forbidden, isNotEmpty } from 'utils'
|
import { env, isNotEmpty } from 'utils'
|
||||||
|
import { forbidden } from 'utils/api'
|
||||||
|
|
||||||
const parseWhereFilter = (
|
const parseWhereFilter = (
|
||||||
typebotIds: string[] | string,
|
typebotIds: string[] | string,
|
||||||
|
@ -1,56 +1,60 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
||||||
enabled: process.env.ANALYZE === 'true',
|
enabled: process.env.ANALYZE === 'true',
|
||||||
})
|
})
|
||||||
|
const withTM = require('next-transpile-modules')(['utils', 'models'])
|
||||||
|
|
||||||
const pages = ['pricing', 'privacy-policies', 'terms-of-service', 'about']
|
const pages = ['pricing', 'privacy-policies', 'terms-of-service', 'about']
|
||||||
|
|
||||||
module.exports = withBundleAnalyzer({
|
module.exports = withTM(
|
||||||
async redirects() {
|
withBundleAnalyzer({
|
||||||
return [
|
async redirects() {
|
||||||
{
|
return [
|
||||||
source: '/typebot-lib',
|
|
||||||
destination:
|
|
||||||
'https://unpkg.com/typebot-js@2.0.21/dist/index.umd.min.js',
|
|
||||||
permanent: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: '/typebot-lib/v2',
|
|
||||||
destination: 'https://unpkg.com/typebot-js@2.1.3/dist/index.umd.min.js',
|
|
||||||
permanent: true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
async rewrites() {
|
|
||||||
return {
|
|
||||||
beforeFiles: [
|
|
||||||
{
|
{
|
||||||
source: '/_next/static/:static*',
|
source: '/typebot-lib',
|
||||||
destination:
|
destination:
|
||||||
process.env.NEXT_PUBLIC_VIEWER_URL + '/_next/static/:static*',
|
'https://unpkg.com/typebot-js@2.0.21/dist/index.umd.min.js',
|
||||||
has: [
|
permanent: true,
|
||||||
{
|
|
||||||
type: 'header',
|
|
||||||
key: 'referer',
|
|
||||||
value:
|
|
||||||
process.env.LANDING_PAGE_HOST +
|
|
||||||
'/(?!' +
|
|
||||||
pages.join('|') +
|
|
||||||
'|\\?).+',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
fallback: [
|
|
||||||
{
|
|
||||||
source: '/:typebotId*',
|
|
||||||
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/:typebotId*',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
source: '/api/:path*',
|
source: '/typebot-lib/v2',
|
||||||
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/api/:path*',
|
destination:
|
||||||
|
'https://unpkg.com/typebot-js@2.1.3/dist/index.umd.min.js',
|
||||||
|
permanent: true,
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
}
|
},
|
||||||
},
|
async rewrites() {
|
||||||
})
|
return {
|
||||||
|
beforeFiles: [
|
||||||
|
{
|
||||||
|
source: '/_next/static/:static*',
|
||||||
|
destination:
|
||||||
|
process.env.NEXT_PUBLIC_VIEWER_URL + '/_next/static/:static*',
|
||||||
|
has: [
|
||||||
|
{
|
||||||
|
type: 'header',
|
||||||
|
key: 'referer',
|
||||||
|
value:
|
||||||
|
process.env.LANDING_PAGE_HOST +
|
||||||
|
'/(?!' +
|
||||||
|
pages.join('|') +
|
||||||
|
'|\\?).+',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
fallback: [
|
||||||
|
{
|
||||||
|
source: '/:typebotId*',
|
||||||
|
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/:typebotId*',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: '/api/:path*',
|
||||||
|
destination: process.env.NEXT_PUBLIC_VIEWER_URL + '/api/:path*',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
|
@ -13,14 +13,14 @@
|
|||||||
"@emotion/react": "11.10.4",
|
"@emotion/react": "11.10.4",
|
||||||
"@emotion/styled": "11.10.4",
|
"@emotion/styled": "11.10.4",
|
||||||
"aos": "^2.3.4",
|
"aos": "^2.3.4",
|
||||||
"bot-engine": "*",
|
"bot-engine": "workspace:*",
|
||||||
"focus-visible": "^5.2.0",
|
"focus-visible": "^5.2.0",
|
||||||
"framer-motion": "7.3.2",
|
"framer-motion": "7.3.2",
|
||||||
"models": "*",
|
"models": "workspace:*",
|
||||||
"next": "12.3.0",
|
"next": "12.3.0",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"utils": "*"
|
"utils": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.19.0",
|
"@babel/core": "7.19.0",
|
||||||
@ -36,6 +36,7 @@
|
|||||||
"eslint": "8.23.0",
|
"eslint": "8.23.0",
|
||||||
"eslint-config-next": "12.3.0",
|
"eslint-config-next": "12.3.0",
|
||||||
"eslint-plugin-react": "^7.31.8",
|
"eslint-plugin-react": "^7.31.8",
|
||||||
|
"next-transpile-modules": "^9.0.0",
|
||||||
"postcss": "8.4.16",
|
"postcss": "8.4.16",
|
||||||
"prettier": "2.7.1",
|
"prettier": "2.7.1",
|
||||||
"typescript": "^4.8.3"
|
"typescript": "^4.8.3"
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Credentials as CredentialsFromDb } from 'db'
|
import { Credentials as CredentialsFromDb } from 'db'
|
||||||
import { OAuth2Client, Credentials } from 'google-auth-library'
|
import { OAuth2Client, Credentials } from 'google-auth-library'
|
||||||
import { GoogleSheetsCredentialsData } from 'models'
|
import { GoogleSheetsCredentialsData } from 'models'
|
||||||
import { decrypt, encrypt, isDefined } from 'utils'
|
import { isDefined } from 'utils'
|
||||||
|
import { decrypt, encrypt } from 'utils/api'
|
||||||
import prisma from './prisma'
|
import prisma from './prisma'
|
||||||
|
|
||||||
export const getAuthenticatedGoogleClient = async (
|
export const getAuthenticatedGoogleClient = async (
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const { withSentryConfig } = require('@sentry/nextjs')
|
const { withSentryConfig } = require('@sentry/nextjs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const withTM = require('next-transpile-modules')(['utils', 'models'])
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
@ -15,6 +16,8 @@ const sentryWebpackPluginOptions = {
|
|||||||
silent: true,
|
silent: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = process.env.SENTRY_AUTH_TOKEN
|
module.exports = withTM(
|
||||||
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
|
process.env.SENTRY_AUTH_TOKEN
|
||||||
: nextConfig
|
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
|
||||||
|
: nextConfig
|
||||||
|
)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dx": "pnpm dev",
|
|
||||||
"dev": "ENVSH_ENV=.env.local bash ../../env.sh next dev -p 3001",
|
"dev": "ENVSH_ENV=.env.local bash ../../env.sh next dev -p 3001",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
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 { GoogleSpreadsheet } from 'google-spreadsheet'
|
||||||
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
||||||
import { Cell } from 'models'
|
import { Cell } from 'models'
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
forbidden,
|
forbidden,
|
||||||
initMiddleware,
|
initMiddleware,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
} from 'utils'
|
} from 'utils/api'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
|
|
||||||
import Cors from 'cors'
|
import Cors from 'cors'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
|
|
||||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
|
|
||||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import Cors from 'cors'
|
import Cors from 'cors'
|
||||||
import { initMiddleware, methodNotAllowed, notFound } from 'utils'
|
import { initMiddleware, methodNotAllowed, notFound } from 'utils/api'
|
||||||
|
|
||||||
const cors = initMiddleware(Cors())
|
const cors = initMiddleware(Cors())
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
import { authenticateUser } from 'services/api/utils'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
|
@ -15,14 +15,8 @@ import {
|
|||||||
import { parseVariables } from 'bot-engine'
|
import { parseVariables } from 'bot-engine'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import got, { Method, Headers, HTTPError } from 'got'
|
import got, { Method, Headers, HTTPError } from 'got'
|
||||||
import {
|
import { byId, omit, parseAnswers } from 'utils'
|
||||||
byId,
|
import { initMiddleware, methodNotAllowed, notFound } from 'utils/api'
|
||||||
initMiddleware,
|
|
||||||
methodNotAllowed,
|
|
||||||
notFound,
|
|
||||||
omit,
|
|
||||||
parseAnswers,
|
|
||||||
} from 'utils'
|
|
||||||
import { stringify } from 'qs'
|
import { stringify } from 'qs'
|
||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import Cors from 'cors'
|
import Cors from 'cors'
|
||||||
|
@ -3,7 +3,7 @@ import { Typebot } from 'models'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser, getLinkedTypebots } from 'services/api/utils'
|
import { authenticateUser, getLinkedTypebots } from 'services/api/utils'
|
||||||
import { parseSampleResult } from 'services/api/webhooks'
|
import { parseSampleResult } from 'services/api/webhooks'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await authenticateUser(req)
|
const user = await authenticateUser(req)
|
||||||
|
@ -9,7 +9,8 @@ import {
|
|||||||
WebhookBlock,
|
WebhookBlock,
|
||||||
} from 'models'
|
} from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
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 { withSentry } from '@sentry/nextjs'
|
||||||
import Cors from 'cors'
|
import Cors from 'cors'
|
||||||
import { executeWebhook } from '../../executeWebhook'
|
import { executeWebhook } from '../../executeWebhook'
|
||||||
|
@ -3,7 +3,7 @@ import { Typebot } from 'models'
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser, getLinkedTypebots } from 'services/api/utils'
|
import { authenticateUser, getLinkedTypebots } from 'services/api/utils'
|
||||||
import { parseSampleResult } from 'services/api/webhooks'
|
import { parseSampleResult } from 'services/api/webhooks'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await authenticateUser(req)
|
const user = await authenticateUser(req)
|
||||||
|
@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
|||||||
import { Typebot, WebhookBlock } from 'models'
|
import { Typebot, WebhookBlock } from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
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 handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await authenticateUser(req)
|
const user = await authenticateUser(req)
|
||||||
|
@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
|||||||
import { Typebot, WebhookBlock } from 'models'
|
import { Typebot, WebhookBlock } from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
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 handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await authenticateUser(req)
|
const user = await authenticateUser(req)
|
||||||
|
@ -9,12 +9,9 @@ import {
|
|||||||
badRequest,
|
badRequest,
|
||||||
generatePresignedUrl,
|
generatePresignedUrl,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
byId,
|
|
||||||
getStorageLimit,
|
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
isDefined,
|
} from 'utils/api'
|
||||||
env,
|
import { byId, getStorageLimit, isDefined, env } from 'utils'
|
||||||
} from 'utils'
|
|
||||||
|
|
||||||
const LIMIT_EMAIL_TRIGGER_PERCENT = 0.8
|
const LIMIT_EMAIL_TRIGGER_PERCENT = 0.8
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
|||||||
import { Typebot, WebhookBlock } from 'models'
|
import { Typebot, WebhookBlock } from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
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 handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await authenticateUser(req)
|
const user = await authenticateUser(req)
|
||||||
|
@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
|||||||
import { Typebot, WebhookBlock } from 'models'
|
import { Typebot, WebhookBlock } from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
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 handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
const user = await authenticateUser(req)
|
const user = await authenticateUser(req)
|
||||||
|
@ -7,15 +7,8 @@ import {
|
|||||||
} from 'models'
|
} from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { createTransport, getTestMessageUrl } from 'nodemailer'
|
import { createTransport, getTestMessageUrl } from 'nodemailer'
|
||||||
import {
|
import { isEmpty, isNotDefined, omit, parseAnswers } from 'utils'
|
||||||
decrypt,
|
import { methodNotAllowed, initMiddleware, decrypt } from 'utils/api'
|
||||||
initMiddleware,
|
|
||||||
isEmpty,
|
|
||||||
isNotDefined,
|
|
||||||
methodNotAllowed,
|
|
||||||
omit,
|
|
||||||
parseAnswers,
|
|
||||||
} from 'utils'
|
|
||||||
|
|
||||||
import Cors from 'cors'
|
import Cors from 'cors'
|
||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
|
@ -5,14 +5,8 @@ import prisma from 'libs/prisma'
|
|||||||
import { ResultWithAnswers } from 'models'
|
import { ResultWithAnswers } from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
import { authenticateUser } from 'services/api/utils'
|
||||||
import {
|
import { env, getChatsLimit, isDefined, parseNumberWithCommas } from 'utils'
|
||||||
env,
|
import { sendEmailNotification, methodNotAllowed } from 'utils/api'
|
||||||
getChatsLimit,
|
|
||||||
isDefined,
|
|
||||||
methodNotAllowed,
|
|
||||||
parseNumberWithCommas,
|
|
||||||
sendEmailNotification,
|
|
||||||
} from 'utils'
|
|
||||||
|
|
||||||
const LIMIT_EMAIL_TRIGGER_PERCENT = 0.8
|
const LIMIT_EMAIL_TRIGGER_PERCENT = 0.8
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
|||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { Result } from 'models'
|
import { Result } from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed } from 'utils'
|
import { methodNotAllowed } from 'utils/api'
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'PATCH') {
|
if (req.method === 'PATCH') {
|
||||||
|
@ -3,7 +3,8 @@ import { Answer } from 'db'
|
|||||||
import { got } from 'got'
|
import { got } from 'got'
|
||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
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) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'PUT') {
|
if (req.method === 'PUT') {
|
||||||
|
@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
|||||||
import { Group, WebhookBlock } from 'models'
|
import { Group, WebhookBlock } from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
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) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
|
@ -3,7 +3,8 @@ import prisma from 'libs/prisma'
|
|||||||
import { Group, WebhookBlock } from 'models'
|
import { Group, WebhookBlock } from 'models'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
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) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { authenticateUser } from 'services/api/utils'
|
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) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
|
@ -10,7 +10,8 @@ import {
|
|||||||
} from 'models'
|
} from 'models'
|
||||||
import { GraphNavigation, Plan, PrismaClient, WorkspaceRole } from 'db'
|
import { GraphNavigation, Plan, PrismaClient, WorkspaceRole } from 'db'
|
||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
import { createFakeResults, encrypt } from 'utils'
|
import { createFakeResults } from 'utils'
|
||||||
|
import { encrypt } from 'utils/api'
|
||||||
|
|
||||||
const prisma = new PrismaClient()
|
const prisma = new PrismaClient()
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"docker:up": "docker compose -f docker-compose.dev.yml up -d",
|
"docker:up": "docker compose -f docker-compose.dev.yml up -d",
|
||||||
"docker:nuke": "docker compose -f docker-compose.dev.yml down --volumes --remove-orphans",
|
"docker:nuke": "docker compose -f docker-compose.dev.yml down --volumes --remove-orphans",
|
||||||
"dev:prepare": "turbo run build --scope=bot-engine --no-deps --include-dependencies && turbo run build --scope=typebot-js --no-deps",
|
"dev:prepare": "turbo run build --scope=bot-engine --no-deps --include-dependencies && turbo run build --scope=typebot-js --no-deps",
|
||||||
"dev": "pnpm docker:up && pnpm dev:prepare && NEXT_PUBLIC_E2E_TEST=false turbo run dx --parallel",
|
"dev": "pnpm docker:up && pnpm dev:prepare && NEXT_PUBLIC_E2E_TEST=false turbo run dev --filter=builder --filter=viewer --parallel --no-cache",
|
||||||
"dev:mocking": "pnpm docker:up && pnpm dev:prepare && NEXT_PUBLIC_E2E_TEST=true turbo run dx --parallel",
|
"dev:mocking": "pnpm docker:up && pnpm dev:prepare && NEXT_PUBLIC_E2E_TEST=true turbo run dev --filter=builder --filter=viewer --parallel --no-cache",
|
||||||
"build": "pnpm docker:up && turbo run build",
|
"build": "pnpm docker:up && turbo run build",
|
||||||
"build:builder": "cp apps/builder/.env.docker apps/builder/.env.production && ENVSH_ENV=./apps/builder/.env.production ENVSH_OUTPUT=./apps/builder/public/__env.js bash env.sh pnpm turbo run build --scope=builder --include-dependencies",
|
"build:builder": "cp apps/builder/.env.docker apps/builder/.env.production && ENVSH_ENV=./apps/builder/.env.production ENVSH_OUTPUT=./apps/builder/public/__env.js bash env.sh pnpm turbo run build --scope=builder --include-dependencies",
|
||||||
"build:viewer": "cp apps/viewer/.env.docker apps/viewer/.env.production && ENVSH_ENV=./apps/viewer/.env.production ENVSH_OUTPUT=./apps/viewer/public/__env.js bash env.sh pnpm turbo run build --scope=viewer --include-dependencies",
|
"build:viewer": "cp apps/viewer/.env.docker apps/viewer/.env.production && ENVSH_ENV=./apps/viewer/.env.production ENVSH_OUTPUT=./apps/viewer/public/__env.js bash env.sh pnpm turbo run build --scope=viewer --include-dependencies",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm rollup -c",
|
"build": "pnpm rollup -c",
|
||||||
"dx": "pnpm rollup -c --watch",
|
"dev": "pnpm rollup -c --watch",
|
||||||
"lint": "eslint --fix -c ./.eslintrc.js \"./src/**/*.ts*\""
|
"lint": "eslint --fix -c ./.eslintrc.js \"./src/**/*.ts*\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -26,6 +26,7 @@
|
|||||||
"@rollup/plugin-json": "^4.1.0",
|
"@rollup/plugin-json": "^4.1.0",
|
||||||
"@rollup/plugin-node-resolve": "^14.0.1",
|
"@rollup/plugin-node-resolve": "^14.0.1",
|
||||||
"@rollup/plugin-typescript": "8.5.0",
|
"@rollup/plugin-typescript": "8.5.0",
|
||||||
|
"@types/node": "18.7.16",
|
||||||
"@types/qs": "^6.9.7",
|
"@types/qs": "^6.9.7",
|
||||||
"@types/react": "18.0.19",
|
"@types/react": "18.0.19",
|
||||||
"@types/react-phone-number-input": "^3.0.14",
|
"@types/react-phone-number-input": "^3.0.14",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": ["ES2015", "DOM"],
|
"lib": ["ES2017", "DOM"],
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"main": "./index.ts",
|
"main": "./index.ts",
|
||||||
"types": "./index.ts",
|
"types": "./index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dx": "dotenv -e ../../apps/builder/.env.local prisma db push && pnpm generate:schema && pnpm start:sutdio ",
|
"dev": "dotenv -e ../../apps/builder/.env.local prisma db push && pnpm generate:schema && pnpm start:sutdio ",
|
||||||
"build": "pnpm generate:schema",
|
"build": "pnpm generate:schema",
|
||||||
"start:sutdio": "dotenv -e ../../apps/builder/.env.local -v BROWSER=none prisma studio",
|
"start:sutdio": "dotenv -e ../../apps/builder/.env.local -v BROWSER=none prisma studio",
|
||||||
"generate:schema": "dotenv -e ../../apps/builder/.env.local prisma generate",
|
"generate:schema": "dotenv -e ../../apps/builder/.env.local prisma generate",
|
||||||
|
@ -1,26 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "models",
|
"name": "models",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "dist/cjs/index.js",
|
"main": "./index.ts",
|
||||||
"module": "dist/esm/index.js",
|
"types": "./index.ts",
|
||||||
"types": "dist/index.d.ts",
|
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
|
||||||
"build": "pnpm rollup -c",
|
|
||||||
"dx": "pnpm rollup -c --watch"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"zod": "^3.19.0"
|
"zod": "^3.19.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^4.8.3",
|
"typescript": "^4.8.3",
|
||||||
"@rollup/plugin-commonjs": "22.0.2",
|
|
||||||
"@rollup/plugin-node-resolve": "^14.0.1",
|
|
||||||
"@rollup/plugin-typescript": "8.5.0",
|
|
||||||
"rollup": "2.79.0",
|
|
||||||
"rollup-plugin-dts": "^4.2.2",
|
|
||||||
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
||||||
"next": "12.3.0",
|
"next": "12.3.0",
|
||||||
"db": "workspace:*"
|
"db": "workspace:*"
|
||||||
},
|
},
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
import resolve from '@rollup/plugin-node-resolve'
|
|
||||||
import commonjs from '@rollup/plugin-commonjs'
|
|
||||||
import typescript from '@rollup/plugin-typescript'
|
|
||||||
import dts from 'rollup-plugin-dts'
|
|
||||||
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
|
|
||||||
|
|
||||||
const packageJson = require('./package.json')
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
input: 'src/index.ts',
|
|
||||||
output: [
|
|
||||||
{
|
|
||||||
file: packageJson.main,
|
|
||||||
format: 'cjs',
|
|
||||||
sourcemap: true,
|
|
||||||
inlineDynamicImports: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file: packageJson.module,
|
|
||||||
format: 'esm',
|
|
||||||
sourcemap: true,
|
|
||||||
inlineDynamicImports: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
peerDepsExternal(),
|
|
||||||
resolve(),
|
|
||||||
commonjs(),
|
|
||||||
typescript({ tsconfig: './tsconfig.json' }),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input: 'dist/esm/index.d.ts',
|
|
||||||
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
|
|
||||||
plugins: [dts()],
|
|
||||||
},
|
|
||||||
]
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user