✨ Allow user to share a flow publicly and make it duplicatable
Closes #360
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { generateOpenApiDocument } from 'trpc-openapi'
|
||||
import { writeFileSync } from 'fs'
|
||||
import { trpcRouter } from './routers/v1/trpcRouter'
|
||||
import { publicRouter } from './routers/publicRouter'
|
||||
|
||||
const openApiDocument = generateOpenApiDocument(trpcRouter, {
|
||||
const openApiDocument = generateOpenApiDocument(publicRouter, {
|
||||
title: 'Builder API',
|
||||
version: '1.0.0',
|
||||
baseUrl: 'https://app.typebot.io/api/v1',
|
||||
baseUrl: 'https://app.typebot.io/api',
|
||||
docsUrl: 'https://docs.typebot.io/api',
|
||||
})
|
||||
|
||||
|
||||
7
apps/builder/src/helpers/server/routers/appRouter.ts
Normal file
7
apps/builder/src/helpers/server/routers/appRouter.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { mergeRouters } from '../trpc'
|
||||
import { internalRouter } from './internalRouter'
|
||||
import { publicRouter } from './publicRouter'
|
||||
|
||||
export const appRouter = mergeRouters(internalRouter, publicRouter)
|
||||
|
||||
export type AppRouter = typeof appRouter
|
||||
18
apps/builder/src/helpers/server/routers/internalRouter.ts
Normal file
18
apps/builder/src/helpers/server/routers/internalRouter.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { getAppVersionProcedure } from '@/features/dashboard/api/getAppVersionProcedure'
|
||||
import { processTelemetryEvent } from '@/features/telemetry/api/processTelemetryEvent'
|
||||
import { router } from '../trpc'
|
||||
import { generateUploadUrl } from '@/features/upload/api/generateUploadUrl'
|
||||
import { openAIRouter } from '@/features/blocks/integrations/openai/api/router'
|
||||
import { whatsAppRouter } from '@/features/whatsapp/router'
|
||||
import { zemanticAiRouter } from '@/features/blocks/integrations/zemanticAi/api/router'
|
||||
|
||||
export const internalRouter = router({
|
||||
getAppVersionProcedure,
|
||||
processTelemetryEvent,
|
||||
generateUploadUrl,
|
||||
whatsApp: whatsAppRouter,
|
||||
openAI: openAIRouter,
|
||||
zemanticAI: zemanticAiRouter,
|
||||
})
|
||||
|
||||
export type InternalRouter = typeof internalRouter
|
||||
@@ -2,24 +2,16 @@ import { billingRouter } from '@/features/billing/api/router'
|
||||
import { webhookRouter } from '@/features/blocks/integrations/webhook/api/router'
|
||||
import { getLinkedTypebots } from '@/features/blocks/logic/typebotLink/api/getLinkedTypebots'
|
||||
import { credentialsRouter } from '@/features/credentials/api/router'
|
||||
import { getAppVersionProcedure } from '@/features/dashboard/api/getAppVersionProcedure'
|
||||
import { resultsRouter } from '@/features/results/api/router'
|
||||
import { processTelemetryEvent } from '@/features/telemetry/api/processTelemetryEvent'
|
||||
import { themeRouter } from '@/features/theme/api/router'
|
||||
import { typebotRouter } from '@/features/typebot/api/router'
|
||||
import { workspaceRouter } from '@/features/workspace/api/router'
|
||||
import { router } from '../../trpc'
|
||||
import { router } from '../trpc'
|
||||
import { analyticsRouter } from '@/features/analytics/api/router'
|
||||
import { collaboratorsRouter } from '@/features/collaboration/api/router'
|
||||
import { customDomainsRouter } from '@/features/customDomains/api/router'
|
||||
import { whatsAppRouter } from '@/features/whatsapp/router'
|
||||
import { openAIRouter } from '@/features/blocks/integrations/openai/api/router'
|
||||
import { generateUploadUrl } from '@/features/upload/api/generateUploadUrl'
|
||||
import { zemanticAiRouter } from '@/features/blocks/integrations/zemanticAi/api/router'
|
||||
|
||||
export const trpcRouter = router({
|
||||
getAppVersionProcedure,
|
||||
processTelemetryEvent,
|
||||
export const publicRouter = router({
|
||||
getLinkedTypebots,
|
||||
analytics: analyticsRouter,
|
||||
workspace: workspaceRouter,
|
||||
@@ -31,10 +23,6 @@ export const trpcRouter = router({
|
||||
theme: themeRouter,
|
||||
collaborators: collaboratorsRouter,
|
||||
customDomains: customDomainsRouter,
|
||||
whatsApp: whatsAppRouter,
|
||||
openAI: openAIRouter,
|
||||
generateUploadUrl,
|
||||
zemanticAi: zemanticAiRouter,
|
||||
})
|
||||
|
||||
export type AppRouter = typeof trpcRouter
|
||||
export type PublicRouter = typeof publicRouter
|
||||
@@ -46,6 +46,7 @@ const finalMiddleware = sentryMiddleware.unstable_pipe(isAuthed)
|
||||
export const middleware = t.middleware
|
||||
|
||||
export const router = t.router
|
||||
export const mergeRouters = t.mergeRouters
|
||||
|
||||
export const publicProcedure = t.procedure.use(sentryMiddleware)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user