35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import { inspect } from 'node:util';
|
|
interface CoerceTypeMap {
|
|
string: string;
|
|
number: number;
|
|
boolean: boolean;
|
|
}
|
|
export type CoerceType = keyof CoerceTypeMap;
|
|
type InferSchema<T extends SchemaDefinition> = {
|
|
[K in keyof T]: T[K]['type'] extends CoerceType ? CoerceTypeMap[T[K]['type']] : string;
|
|
};
|
|
export interface SchemaItem<T extends CoerceType = 'string'> {
|
|
type?: T;
|
|
default?: CoerceTypeMap[T];
|
|
aliases?: string[];
|
|
}
|
|
export type SchemaDefinition = Record<string, SchemaItem<any>>;
|
|
export declare class ConnectionString implements ReadonlyMap<string, string> {
|
|
#private;
|
|
constructor(connectionString: string);
|
|
[inspect.custom](): ReadonlyMap<string, string>;
|
|
get size(): number;
|
|
get<T extends CoerceType = 'string'>(key: string, coerceType?: T): CoerceTypeMap[T] | undefined;
|
|
keys(): MapIterator<string>;
|
|
values(): MapIterator<string>;
|
|
[Symbol.iterator](): MapIterator<[string, string]>;
|
|
entries(): MapIterator<[string, string]>;
|
|
toString(): string;
|
|
has(key: string): boolean;
|
|
forEach(callbackfn: (value: string, key: string, map: ReadonlyMap<string, string>) => void, thisArg?: any): void;
|
|
toSchema<T extends SchemaDefinition>(schema: T, { includeMissing }?: {
|
|
includeMissing?: boolean;
|
|
}): InferSchema<T>;
|
|
}
|
|
export {};
|
|
//# sourceMappingURL=connection-string.d.ts.map
|