Adds a toAuthModesEnum helper in apps/apollo/src/lib/toolkits/utils/toolkit.ts that safely converts a string[] | null | undefined (the auth-mode arrays returned by Thermos, typed as z.array(z.string())) into a validated AUTH_MODES_ENUM[], dropping any value that is not a recognised member of AUTH_MODES_ENUM.
This replaces three unsound ... as AUTH_MODES_ENUM[] casts that were feeding raw Thermos strings into filterAuthModesForServiceFlag, whose parameter is already typed AUTH_MODES_ENUM[]:
get_toolkits.ts: item.authConfigMode and item.composioManagedAuthConfigsget_toolkits_by_slug.ts: itemComposioManagedAuthConfigThe unused import type { AUTH_MODES_ENUM } in get_toolkits.ts is removed (no longer referenced there). In get_toolkits_by_slug.ts the value import of AUTH_MODES_ENUM stays, since it is still used elsewhere in that file.
Behaviour note: the previous casts passed unknown auth-mode strings through to the API response (auth_schemes / composio_managed_auth_schemes are z.array(z.string()), so they were not validated). The helper now drops modes Apollo's enum does not know about. This is fail-closed and consistent with the downstream function's AUTH_MODES_ENUM[] typing; the trade-off is that a new Thermos auth mode would be omitted from these responses until added to AUTH_MODES_ENUM.
Adds 7 unit tests in toolkit.test.ts covering null/undefined/empty, dropping unknown strings, all-unknown, all-valid round-trip, and Object.values(AUTH_MODES_ENUM).
node_modules is not installed in this worktree, so local typecheck/tests were not run; relying on CI check-types and run-vitest-tests.AUTH_MODES_ENUM is an as const string-keyed object (packages/db/src/constants/enum.ts), so Object.values(AUTH_MODES_ENUM) returns exactly the 14 string values (no numeric reverse-mapping pollution).string[] | undefined (z.array(z.string()).optional() in the toolkit schemas; config.authScheme is a Prisma String), so the helper signature accepts them and the ?? [] is now redundant.toAuthModesEnum lives in ./utils/toolkit, already a dependency of both callers, so no new import cycle is introduced.node; outputs match the asserted values exactly.🤖 Generated with Claude Code