@n1k1t/mock-server
Version:
The ultimate toolkit to intercept, transform, and simulate HTTP/WS traffic with type-safe expectations
30 lines • 1.25 kB
TypeScript
import type { TFunction } from '../../types';
import type config from '../config';
import type * as endpoints from '../server/endpoints';
import type * as methods from './methods';
export interface IRemoteClientConnectOptions {
baseUrl?: string;
timeout?: number;
}
export type TMethodsSchema = {
[K in keyof typeof methods]: TFunction<Promise<typeof methods[K]['TSchema']['outgoing']>, [typeof methods[K]['TSchema']['incoming']]>;
};
export type TEndpoints = {
[K in keyof typeof endpoints]: {
http: (typeof endpoints)[K]['TSchema']['locations']['http'];
io: (typeof endpoints)[K]['TSchema']['locations']['io'];
incoming: (typeof endpoints)[K]['TSchema']['incoming'];
outgoing: (typeof endpoints)[K]['TSchema']['outgoing'];
location: (typeof endpoints)[K]['TSchema']['locations']['http'] extends {
path: infer TPath;
method: infer TMethod;
} ? {
url: `${typeof config['storage']['routes']['system']['root']}${TPath extends string ? TPath : never}`;
method: TMethod extends string ? TMethod : never;
} : {
url: string & {};
method: string & {};
};
};
};
//# sourceMappingURL=types.d.ts.map