File tree Expand file tree Collapse file tree 7 files changed +10
-27
lines changed
Expand file tree Collapse file tree 7 files changed +10
-27
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- import { ProviderId } from "./constants " ;
1+ import { ProviderId } from "./metadata " ;
22
33export class ProviderKeyMissingError extends Error {
44 constructor (
Original file line number Diff line number Diff line change 11import { LanguageModel } from "ai" ;
2- import { ProviderId } from "./constants " ;
2+ import { ProviderId } from "./metadata " ;
33import { resolveProviderApiKey } from "./keys" ;
44import { PROVIDER_METADATA } from "./metadata" ;
55import { UnsupportedProviderError } from "./errors" ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- export { SUPPORTED_PROVIDERS , type ProviderId } from "./constants" ;
21export {
2+ SUPPORTED_PROVIDERS ,
3+ type ProviderId ,
34 type ProviderMetadata ,
45 PROVIDER_METADATA ,
56} from "./metadata" ;
@@ -16,4 +17,3 @@ export {
1617 createProviderClient ,
1718 type ClientOptions ,
1819} from "./factory" ;
19- export { getProvider } from "./get-provider" ;
Original file line number Diff line number Diff line change 11import path from "path" ;
22import fs from "fs" ;
33import dotenv from "dotenv" ;
4- import { ProviderId } from "./constants " ;
4+ import { ProviderId } from "./metadata " ;
55import { PROVIDER_METADATA } from "./metadata" ;
66import { getRcConfig , type RcConfig } from "@lingo.dev/config" ;
77import { ProviderKeyMissingError } from "./errors" ;
Original file line number Diff line number Diff line change @@ -59,3 +59,8 @@ export const PROVIDER_METADATA = {
5959} as const satisfies Record < string , ProviderMetadata > ;
6060
6161export type ProviderId = keyof typeof PROVIDER_METADATA ;
62+
63+ // Derive supported providers from metadata keys to prevent drift
64+ export const SUPPORTED_PROVIDERS = Object . freeze (
65+ Object . keys ( PROVIDER_METADATA ) ,
66+ ) as readonly string [ ] as readonly ProviderId [ ] ;
You can’t perform that action at this time.
0 commit comments