Skip to content

Commit 09e1d7e

Browse files
committed
chore: restructure files
1 parent 6f3970b commit 09e1d7e

File tree

7 files changed

+10
-27
lines changed

7 files changed

+10
-27
lines changed

packages/providers/src/constants.ts

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

packages/providers/src/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ProviderId } from "./constants";
1+
import { ProviderId } from "./metadata";
22

33
export class ProviderKeyMissingError extends Error {
44
constructor(

packages/providers/src/factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { LanguageModel } from "ai";
2-
import { ProviderId } from "./constants";
2+
import { ProviderId } from "./metadata";
33
import { resolveProviderApiKey } from "./keys";
44
import { PROVIDER_METADATA } from "./metadata";
55
import { UnsupportedProviderError } from "./errors";

packages/providers/src/get-provider.ts

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

packages/providers/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
export { SUPPORTED_PROVIDERS, type ProviderId } from "./constants";
21
export {
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";

packages/providers/src/keys.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "path";
22
import fs from "fs";
33
import dotenv from "dotenv";
4-
import { ProviderId } from "./constants";
4+
import { ProviderId } from "./metadata";
55
import { PROVIDER_METADATA } from "./metadata";
66
import { getRcConfig, type RcConfig } from "@lingo.dev/config";
77
import { ProviderKeyMissingError } from "./errors";

packages/providers/src/metadata.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ export const PROVIDER_METADATA = {
5959
} as const satisfies Record<string, ProviderMetadata>;
6060

6161
export 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[];

0 commit comments

Comments
 (0)