Skip to content

Commit dfd6b15

Browse files
committed
🗑️ Flag deprecated stream routes
1 parent 04efee8 commit dfd6b15

File tree

10 files changed

+43
-91
lines changed

10 files changed

+43
-91
lines changed

apps/landing-page/src/routeTree.gen.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Route as LayoutSlugRouteImport } from './routes/_layout/$slug'
2020
import { Route as LayoutBlogIndexRouteImport } from './routes/_layout/blog/index'
2121
import { Route as LayoutBlogSlugRouteImport } from './routes/_layout/blog/$slug'
2222
import { ServerRoute as SitemapDotxmlServerRouteImport } from './routes/sitemap[.]xml'
23-
import { ServerRoute as ApiHealthzServerRouteImport } from './routes/api/healthz'
23+
import { ServerRoute as HealthzServerRouteImport } from './routes/healthz'
2424

2525
const rootServerRouteImport = createServerRootRoute()
2626

@@ -68,9 +68,9 @@ const SitemapDotxmlServerRoute = SitemapDotxmlServerRouteImport.update({
6868
path: '/sitemap.xml',
6969
getParentRoute: () => rootServerRouteImport,
7070
} as any)
71-
const ApiHealthzServerRoute = ApiHealthzServerRouteImport.update({
72-
id: '/api/healthz',
73-
path: '/api/healthz',
71+
const HealthzServerRoute = HealthzServerRouteImport.update({
72+
id: '/healthz',
73+
path: '/healthz',
7474
getParentRoute: () => rootServerRouteImport,
7575
} as any)
7676

@@ -139,29 +139,29 @@ export interface RootRouteChildren {
139139
LayoutRoute: typeof LayoutRouteWithChildren
140140
}
141141
export interface FileServerRoutesByFullPath {
142+
'/healthz': typeof HealthzServerRoute
142143
'/sitemap.xml': typeof SitemapDotxmlServerRoute
143-
'/api/healthz': typeof ApiHealthzServerRoute
144144
}
145145
export interface FileServerRoutesByTo {
146+
'/healthz': typeof HealthzServerRoute
146147
'/sitemap.xml': typeof SitemapDotxmlServerRoute
147-
'/api/healthz': typeof ApiHealthzServerRoute
148148
}
149149
export interface FileServerRoutesById {
150150
__root__: typeof rootServerRouteImport
151+
'/healthz': typeof HealthzServerRoute
151152
'/sitemap.xml': typeof SitemapDotxmlServerRoute
152-
'/api/healthz': typeof ApiHealthzServerRoute
153153
}
154154
export interface FileServerRouteTypes {
155155
fileServerRoutesByFullPath: FileServerRoutesByFullPath
156-
fullPaths: '/sitemap.xml' | '/api/healthz'
156+
fullPaths: '/healthz' | '/sitemap.xml'
157157
fileServerRoutesByTo: FileServerRoutesByTo
158-
to: '/sitemap.xml' | '/api/healthz'
159-
id: '__root__' | '/sitemap.xml' | '/api/healthz'
158+
to: '/healthz' | '/sitemap.xml'
159+
id: '__root__' | '/healthz' | '/sitemap.xml'
160160
fileServerRoutesById: FileServerRoutesById
161161
}
162162
export interface RootServerRouteChildren {
163+
HealthzServerRoute: typeof HealthzServerRoute
163164
SitemapDotxmlServerRoute: typeof SitemapDotxmlServerRoute
164-
ApiHealthzServerRoute: typeof ApiHealthzServerRoute
165165
}
166166

167167
declare module '@tanstack/react-router' {
@@ -233,11 +233,11 @@ declare module '@tanstack/react-start/server' {
233233
preLoaderRoute: typeof SitemapDotxmlServerRouteImport
234234
parentRoute: typeof rootServerRouteImport
235235
}
236-
'/api/healthz': {
237-
id: '/api/healthz'
238-
path: '/api/healthz'
239-
fullPath: '/api/healthz'
240-
preLoaderRoute: typeof ApiHealthzServerRouteImport
236+
'/healthz': {
237+
id: '/healthz'
238+
path: '/healthz'
239+
fullPath: '/healthz'
240+
preLoaderRoute: typeof HealthzServerRouteImport
241241
parentRoute: typeof rootServerRouteImport
242242
}
243243
}
@@ -272,8 +272,8 @@ export const routeTree = rootRouteImport
272272
._addFileChildren(rootRouteChildren)
273273
._addFileTypes<FileRouteTypes>()
274274
const rootServerRouteChildren: RootServerRouteChildren = {
275+
HealthzServerRoute: HealthzServerRoute,
275276
SitemapDotxmlServerRoute: SitemapDotxmlServerRoute,
276-
ApiHealthzServerRoute: ApiHealthzServerRoute,
277277
}
278278
export const serverRouteTree = rootServerRouteImport
279279
._addFileChildren(rootServerRouteChildren)

apps/landing-page/src/routes/api/healthz.ts renamed to apps/landing-page/src/routes/healthz.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createServerFileRoute } from "@tanstack/react-start/server";
22

3-
export const ServerRoute = createServerFileRoute("/api/healthz").methods({
3+
export const ServerRoute = createServerFileRoute("/healthz").methods({
44
GET: async () => {
55
return new Response(
66
JSON.stringify({ status: "ok", timestamp: new Date().toISOString() }),

apps/landing-page/vercel.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
"source": "/typebot-lib/v2",
1111
"destination": "https://unpkg.com/[email protected]/dist/index.umd.min.js",
1212
"permanent": true
13-
},
14-
{
15-
"source": "/healthz",
16-
"destination": "/api/healthz",
17-
"permanent": true
1813
}
1914
]
2015
}

apps/viewer/next.config.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ const nextConfig = {
127127
destination:
128128
"/api/v1/typebots/:typebotId/blocks/:blockId/storage/upload-url",
129129
},
130-
{
131-
source: "/healthz",
132-
destination: "/api/health",
133-
},
134130
])
135131
.concat(
136132
process.env.NEXTAUTH_URL

apps/viewer/src/app/api/integrations/openai/streamer/route.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { connect } from "@planetscale/database";
2+
import * as Sentry from "@sentry/nextjs";
23
import { isForgedBlockType } from "@typebot.io/blocks-core/helpers";
34
import { IntegrationBlockType } from "@typebot.io/blocks-integrations/constants";
45
import type { ChatCompletionOpenAIOptions } from "@typebot.io/blocks-integrations/openai/schema";
@@ -180,6 +181,9 @@ export async function POST(req: Request) {
180181
{ status: 400, headers: responseHeaders },
181182
);
182183

184+
Sentry.setTag("typebotId", state.typebotsQueue[0].typebot.id);
185+
Sentry.captureMessage("Is using /api/integrations/openai/streamer");
186+
183187
return new StreamingTextResponse(stream, {
184188
headers: responseHeaders,
185189
});

apps/viewer/src/app/api/v1/sessions/[sessionId]/streamMessage/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as Sentry from "@sentry/nextjs";
12
import { getMessageStream } from "@typebot.io/bot-engine/apiHandlers/getMessageStream";
23
import { StreamingTextResponse } from "@typebot.io/legacy/ai";
34
import { NextResponse } from "next/server";
@@ -29,12 +30,16 @@ export async function POST(
2930
const { sessionId } = await params;
3031
const body = await req.text();
3132
const messages = body ? JSON.parse(body).messages : undefined;
32-
const { stream, status, message } = await getMessageStream({
33+
const { stream, status, message, typebotId } = await getMessageStream({
3334
sessionId,
3435
messages,
3536
});
3637
if (!stream)
3738
return NextResponse.json({ message }, { status, headers: responseHeaders });
39+
40+
Sentry.setTag("typebotId", typebotId);
41+
Sentry.captureMessage("Is using /api/v1/sessions/[sessionId]/streamMessage");
42+
3843
return new StreamingTextResponse(
3944
stream.pipeThrough(createStreamDataTransformer()),
4045
{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default function GET() {
2+
return new Response(
3+
JSON.stringify({ status: "ok", timestamp: new Date().toISOString() }),
4+
{
5+
headers: { "Content-Type": "application/json" },
6+
},
7+
);
8+
}

apps/viewer/src/pages/api/health.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)