Skip to content
Open
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
16 changes: 11 additions & 5 deletions apps/apollo-vertex/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const ensureValidToken = async (
try {
await handleOAuthCallback(clientId, baseUrl, redirectPath);
} catch {
queryClient.resetQueries({ queryKey: TOKEN_QUERY_KEY });
void queryClient.resetQueries({ queryKey: TOKEN_QUERY_KEY });
}
}

Expand All @@ -221,9 +221,15 @@ export const ensureValidToken = async (
return null;
}

const { data: tokenData, success } = TokenDataSchema.safeParse(
JSON.parse(tokenDataStr),
);
let parsed: unknown;
try {
parsed = JSON.parse(tokenDataStr);
} catch {
clearTokenData();
return null;
}

const { data: tokenData, success } = TokenDataSchema.safeParse(parsed);

if (!success) {
clearTokenData();
Expand Down Expand Up @@ -276,5 +282,5 @@ export const logout = (
sessionStorage.removeItem(STORAGE_KEYS.CODE_VERIFIER);
sessionStorage.removeItem(STORAGE_KEYS.STATE);
sessionStorage.removeItem(STORAGE_KEYS.AUTH_RETURN_TO);
queryClient.resetQueries({ queryKey: TOKEN_QUERY_KEY });
void queryClient.resetQueries({ queryKey: TOKEN_QUERY_KEY });
};
5 changes: 3 additions & 2 deletions apps/apollo-vertex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"postbuild": "pagefind --site .next/server/app --output-path public/_pagefind",
"format": "biome format --write",
"format:check": "biome format",
"lint": "oxlint",
"lint:fix": "oxlint --fix",
"lint": "oxlint --type-aware",
"lint:fix": "oxlint --fix --type-aware",
"lint:deps": "depcruise registry --config .dependency-cruiser.js",
"typecheck": "tsc --noEmit"
},
Expand Down Expand Up @@ -104,6 +104,7 @@
"dependency-cruiser": "^17.3.6",
"eslint-plugin-react": "^7.37.5",
"oxlint": "^1.38.0",
"oxlint-tsgolint": "^0.18.1",
"pagefind": "^1.4.0",
"shadcn": "latest",
"tw-animate-css": "^1.4.0"
Expand Down
1 change: 1 addition & 0 deletions apps/apollo-vertex/registry/card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function Card({
/>

<button
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- intentionally spreading div-typed props onto a button for API simplicity; div and button props are not fully equivalent (e.g. ref, disabled), but Card currently shares a single props type for both render modes
{...(props as React.ComponentProps<"button">)}
type="button"
aria-pressed={selected}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function DataTableFacetedFilter<TData, TValue>({
if (!column) return null;

const filterValue = column.getFilterValue();
// oxlint-disable-next-line typescript-eslint(no-unsafe-assignment) -- tanstack getFilterValue() returns unknown; we know our faceted filters use string[]
const selectedValues: string[] = Array.isArray(filterValue)
? filterValue
: [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export const dataTableGlobalFilterFn = (
const meta = cell.column.columnDef.meta;
const displayValue = meta?.getFilterValue
? meta.getFilterValue(value, row)
: String(value ?? "");
: typeof value === "string"
? value
: typeof value === "number" || typeof value === "boolean"
? String(value)
: "";
return displayValue.toLowerCase().includes(searchStr);
});
};
Expand Down
3 changes: 2 additions & 1 deletion apps/apollo-vertex/registry/data-table/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
type RowSelectionState,
type SortingState,
type Table as TanstackTable,
type Updater,
type VisibilityState,
} from "@tanstack/react-table";
import * as React from "react";
Expand Down Expand Up @@ -141,7 +142,7 @@ function DataTable<TData, TValue>({
onColumnVisibilityChange,
onColumnOrderChange,
...(isRowSelectionEnabled && { onRowSelectionChange }),
onGlobalFilterChange: (updater) => {
onGlobalFilterChange: (updater: Updater<string>) => {
onGlobalFilterChange(updater);
resetPageIndex();
},
Expand Down
4 changes: 2 additions & 2 deletions apps/apollo-vertex/registry/shell/shell-auth-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export const useAccessToken = ({

const { data: token, isLoading } = useQuery({
queryKey: TOKEN_QUERY_KEY,
queryFn: async () =>
await ensureValidToken(queryClient, clientId, baseUrl, redirectPath),
queryFn: () =>
ensureValidToken(queryClient, clientId, baseUrl, redirectPath),
refetchInterval: 60 * 1000,
enabled: typeof window !== "undefined",
});
Expand Down
16 changes: 13 additions & 3 deletions apps/apollo-vertex/templates/AiChatLoginGate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,13 @@ export function AiChatLoginGate({ children }: AiChatLoginGateProps) {
let idToken: string | null = null;
if (tokenDataStr) {
try {
const parsed = JSON.parse(tokenDataStr) as { id_token?: unknown };
if (typeof parsed.id_token === "string") {
const parsed: unknown = JSON.parse(tokenDataStr);
if (
typeof parsed === "object" &&
parsed !== null &&
"id_token" in parsed &&
typeof parsed.id_token === "string"
) {
idToken = parsed.id_token;
}
} catch {
Expand Down Expand Up @@ -188,7 +193,12 @@ export function AiChatLoginGate({ children }: AiChatLoginGateProps) {
<p className="text-muted-foreground">
Sign in to UiPath to use the AI Chat demo
</p>
<Button className="cursor-pointer" onClick={login}>
<Button
className="cursor-pointer"
onClick={() => {
void login();
}}
>
<LogIn className="size-4 mr-2" />
Sign in
</Button>
Expand Down
4 changes: 3 additions & 1 deletion apps/apollo-vertex/templates/AiChatTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ function AiChatWithConnection({
<AiChat
messages={messages}
isLoading={isLoading}
onSendMessage={(text) => sendMessage(text)}
onSendMessage={(text) => {
void sendMessage(text);
}}
onStop={stop}
onClearChat={clear}
title={t("ai_assistant")}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
"brace-expansion": ">=5.0.5",
"flatted": ">=3.4.2",
"happy-dom": ">=20.8.8",
"handlebars": ">=4.7.9"
"handlebars": ">=4.7.9",
"path-to-regexp": ">=8.4.0"
}
}
}
86 changes: 74 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading