Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
@@ -0,0 +1,18 @@
|
||||
export type AdapterStatus = "not_configured" | "configured" | "healthy" | "degraded" | "unavailable";
|
||||
|
||||
export type AdapterDefinition<TAdapter = unknown> = {
|
||||
key: string;
|
||||
status: AdapterStatus;
|
||||
adapter?: TAdapter;
|
||||
};
|
||||
|
||||
const adapters = new Map<string, AdapterDefinition>();
|
||||
|
||||
export function defineAdapter<TAdapter>(definition: AdapterDefinition<TAdapter>): AdapterDefinition<TAdapter> {
|
||||
adapters.set(definition.key, definition as AdapterDefinition);
|
||||
return definition;
|
||||
}
|
||||
|
||||
export function getAdapter<TAdapter = unknown>(key: string): AdapterDefinition<TAdapter> {
|
||||
return (adapters.get(key) as AdapterDefinition<TAdapter> | undefined) ?? { key, status: "not_configured" };
|
||||
}
|
||||
Reference in new issue
Block a user