@dbs-portal/tool-mock
Version:
API mocking toolkit using MSW for DBS Portal development workflows
110 lines • 2.67 kB
TypeScript
/**
* Build system integration types
*/
import type { RequestHandler } from 'msw';
/**
* Vite plugin options
*/
export interface ViteMSWPluginOptions {
/** Enable the plugin */
enabled?: boolean;
/** Mock mode */
mode?: 'development' | 'testing' | 'storybook';
/** Public directory for service worker */
publicDir?: string;
/** Service worker filename */
serviceWorkerFilename?: string;
/** Mock handlers */
handlers?: RequestHandler[];
/** Auto-setup MSW */
autoSetup?: boolean;
/** Verbose logging */
verbose?: boolean;
/** Custom configuration */
config?: {
delay?: number | [number, number];
logging?: boolean;
errorSimulation?: {
networkErrorRate?: number;
serverErrorRate?: number;
};
};
}
/**
* Development server options
*/
export interface DevServerOptions {
/** Port for dev server */
port?: number;
/** Host for dev server */
host?: string;
/** Enable HTTPS */
https?: boolean;
/** CORS configuration */
cors?: boolean | {
origin?: string | string[];
methods?: string[];
allowedHeaders?: string[];
};
/** Proxy configuration */
proxy?: Record<string, string | {
target: string;
changeOrigin?: boolean;
rewrite?: (path: string) => string;
}>;
}
/**
* Service worker configuration
*/
export interface ServiceWorkerConfig {
/** Service worker URL */
url?: string;
/** Service worker scope */
scope?: string;
/** Update strategy */
updateViaCache?: 'imports' | 'all' | 'none';
/** Registration options */
registrationOptions?: RegistrationOptions;
}
/**
* Build utilities configuration
*/
export interface BuildUtilsConfig {
/** Output directory */
outDir?: string;
/** Source directory */
srcDir?: string;
/** Include source maps */
sourcemap?: boolean;
/** Minify output */
minify?: boolean;
/** External dependencies */
external?: string[];
}
/**
* Build mock module configuration
*/
export interface BuildMockModuleConfig {
/** Module name */
name: string;
/** Module path */
path: string;
/** Auto-import */
autoImport?: boolean;
/** Conditional loading */
condition?: () => boolean;
}
/**
* Hot reload configuration
*/
export interface HotReloadConfig {
/** Enable hot reload */
enabled?: boolean;
/** Watch patterns */
watchPatterns?: string[];
/** Debounce delay */
debounceDelay?: number;
/** Reload strategy */
strategy?: 'full' | 'handlers-only';
}
//# sourceMappingURL=types.d.ts.map