Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions bifrost/lib/clients/jawnTypes/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,6 @@ export interface paths {
"/v1/test/gateway-request": {
post: operations["SendTestRequest"];
};
"/v1/session/has-session": {
get: operations["HasSession"];
};
"/v1/session/query": {
post: operations["GetSessions"];
};
Expand Down Expand Up @@ -6533,16 +6530,6 @@ export interface operations {
};
};
};
HasSession: {
responses: {
/** @description Ok */
200: {
content: {
"application/json": components["schemas"]["Result_boolean.string_"];
};
};
};
};
GetSessions: {
requestBody: {
content: {
Expand Down
26 changes: 0 additions & 26 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -18842,32 +18842,6 @@
}
}
},
"/v1/session/has-session": {
"get": {
"operationId": "HasSession",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Result_boolean.string_"
}
}
}
}
},
"tags": [
"Session"
],
"security": [
{
"api_key": []
}
],
"parameters": []
}
},
"/v1/session/query": {
"post": {
"operationId": "GetSessions",
Expand Down
39 changes: 0 additions & 39 deletions valhalla/jawn/src/controllers/public/sessionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,45 +71,6 @@ const kvCache = new KVCache(60 * 1000); // 5 minutes
@Tags("Session")
@Security("api_key")
export class SessionController extends Controller {
@Get("/has-session")
public async hasSession(
@Request() request: JawnAuthenticatedRequest
): Promise<Result<boolean, string>> {
const found = await cacheResultCustom<boolean, string>(
`has-session-${request.authParams.organizationId}`,
async () => {
const sessionManager = new SessionManager(request.authParams);
const result = await sessionManager.getSessionsCount({
filter: {},
search: "",
timeFilter: {
startTimeUnixMs: new Date().getTime() - 1000 * 60 * 60 * 30,
endTimeUnixMs: new Date().getTime(),
},
timezoneDifference: 0,
});
if (result.error || !result.data) {
return err("Error finding sessions");
} else {
if (result.data?.count > 0) {
return ok(true);
} else {
return err("No sessions found");
}
}
},
kvCache
);
if (found.error) {
console.error("Error finding sessions", found.error);
this.setStatus(500);
} else {
this.setStatus(200);
}

return found;
}

@Post("query")
public async getSessions(
@Body()
Expand Down
31 changes: 0 additions & 31 deletions valhalla/jawn/src/tsoa-build/public/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8662,37 +8662,6 @@ export function RegisterRoutes(app: Router) {
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
const argsSessionController_hasSession: Record<string, TsoaRoute.ParameterSchema> = {
request: {"in":"request","name":"request","required":true,"dataType":"object"},
};
app.get('/v1/session/has-session',
authenticateMiddleware([{"api_key":[]}]),
...(fetchMiddlewares<RequestHandler>(SessionController)),
...(fetchMiddlewares<RequestHandler>(SessionController.prototype.hasSession)),

async function SessionController_hasSession(request: ExRequest, response: ExResponse, next: any) {

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

let validatedArgs: any[] = [];
try {
validatedArgs = templateService.getValidatedArgs({ args: argsSessionController_hasSession, request, response });

const controller = new SessionController();

await templateService.apiHandler({
methodName: 'hasSession',
controller,
response,
next,
validatedArgs,
successStatus: undefined,
});
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
const argsSessionController_getSessions: Record<string, TsoaRoute.ParameterSchema> = {
requestBody: {"in":"body","name":"requestBody","required":true,"ref":"SessionQueryParams"},
request: {"in":"request","name":"request","required":true,"dataType":"object"},
Expand Down
26 changes: 0 additions & 26 deletions valhalla/jawn/src/tsoa-build/public/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -18842,32 +18842,6 @@
}
}
},
"/v1/session/has-session": {
"get": {
"operationId": "HasSession",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Result_boolean.string_"
}
}
}
}
},
"tags": [
"Session"
],
"security": [
{
"api_key": []
}
],
"parameters": []
}
},
"/v1/session/query": {
"post": {
"operationId": "GetSessions",
Expand Down
4 changes: 2 additions & 2 deletions web/components/templates/sessions/sessionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const SessionsPage = (props: SessionsPageProps) => {
);

const isSessionsLoading =
isLoading || allNames.isLoading || names.isLoading || hasSessions.isLoading;
isLoading || allNames.isLoading || names.isLoading;

// Helper function to get TimeFilter object
const getTimeFilterObject = (start: Date, end: Date): TimeFilter => ({
Expand Down Expand Up @@ -297,7 +297,7 @@ const SessionsPage = (props: SessionsPageProps) => {
}
}, [router.query.page]);

return hasSessions.data?.data?.data || isSessionsLoading ? (
return hasSessions || isSessionsLoading ? (
<main className="flex h-screen w-full animate-fade-in flex-col">
<Tabs
value={currentTab}
Expand Down
13 changes: 0 additions & 13 deletions web/lib/clients/jawnTypes/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,6 @@ export interface paths {
"/v1/test/gateway-request": {
post: operations["SendTestRequest"];
};
"/v1/session/has-session": {
get: operations["HasSession"];
};
"/v1/session/query": {
post: operations["GetSessions"];
};
Expand Down Expand Up @@ -6533,16 +6530,6 @@ export interface operations {
};
};
};
HasSession: {
responses: {
/** @description Ok */
200: {
content: {
"application/json": components["schemas"]["Result_boolean.string_"];
};
};
};
};
GetSessions: {
requestBody: {
content: {
Expand Down
23 changes: 15 additions & 8 deletions web/services/hooks/sessions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,26 @@ const useSessions = ({
refetchIntervalInBackground: false,
refetchInterval: false,
});
const properties = useQuery({
queryKey: ["/v1/property/query", org?.currentOrg?.id],
queryFn: async (query) => {
const jawn = getJawnClient(query.queryKey[1]);
const res = await jawn.POST("/v1/property/query", {
body: {},
});
return res.data;
},
refetchOnWindowFocus: false,
});

return {
sessions: data?.data?.data || [],
refetch,
isLoading,
isLoading: isLoading || properties.isLoading,
isRefetching,
hasSessions: useQuery({
queryKey: ["has-sessions", org?.currentOrg?.id],
queryFn: async () => {
const jawnClient = getJawnClient(org?.currentOrg?.id);
return await jawnClient.GET("/v1/session/has-session");
},
}),
hasSessions: !!properties.data?.data?.find((p) =>
p.property.toLowerCase().includes("helicone-session"),
),
};
};

Expand Down
Loading