import { FakerAvailableLocales } from './faker.model'; import { Header, Methods } from './route.model'; export type ProcessedDatabucket = { uuid: string; id: string; name: string; value: any; parsed: boolean; validJson: boolean; }; export type ProcessedDatabucketWithoutValue = Omit; /** * Object containing invoked callback details. */ export type InvokedCallback = { name: string; url: string; method: keyof typeof Methods; requestHeaders: Header[]; requestBody: any; status: number; responseBody: any; responseHeaders: Header[]; }; /** * Represents an in-flight request. * WebSockets requests or any other long-living * connections can be considered as in-flight requests. */ export type InFlightRequest = { request: { method: keyof typeof Methods; urlPath: string | null; route: string | null; params?: { name: string; value: string; }[]; query?: string | null; queryParams?: any; body?: any; headers?: Header[]; }; completed?: boolean; status?: { code?: any; message?: string; }; uuid: string; routeUUID: string; }; /** * Transaction object containing req/res information after response is closed */ export type Transaction = { request: { method: keyof typeof Methods; urlPath: string | null; route: string | null; params: { name: string; value: string; }[]; query: string | null; queryParams: any; body: any; headers: Header[]; }; response: { statusCode: number; statusMessage: string; headers: Header[]; body: string; }; proxied: boolean; routeUUID: string; routeResponseUUID: string; timestampMs: number; uuid: string; }; export type ServerOptions = { /** * Directory where to find the environment file. * Provide an absolute path to the environment file to avoid false positives when detecting path traversal. */ environmentDirectory: string; /** * List of routes uuids to disable. * Can also accept strings containing a route partial path, e.g. 'users' will disable all routes containing 'users' in their path. */ disabledRoutes?: string[]; /** * Faker options: seed and locale */ fakerOptions?: { locale?: FakerAvailableLocales; seed?: number; }; /** * Environment variables prefix */ envVarsPrefix: string; /** * Enable the admin API * https://mockoon.com/docs/latest/admin-api/overview/ */ enableAdminApi: boolean; /** * Disable TLS */ disableTls: boolean; /** * Maximum number of transaction logs to keep in memory for retrieval via the admin API * In the desktop app, equals to settings.maxLogsPerEnvironment * Can be configured when using serverless (same option) or CLI `--max-transaction-logs` */ maxTransactionLogs: number; /** * Enable random latency from 0 to value specified in the route settings. | */ enableRandomLatency: boolean; /** * Max file upload number (multipart/form-data). * Set to 0 to disable file uploads. (busboy) */ maxFileUploads?: number; /** * Max file upload size (multipart/form-data). */ maxFileSize?: number; /** * Public base URL used to: * - resolve relative callback URLs * - provide the value for the `baseUrl` templating helper * * Must include the protocol and the port if non-standard (e.g. https://toto.com, http://localhost:3000). * ⚠️ This is NOT the bind address (hostname) used by the server * which is configured in the environment definition. */ publicBaseUrl?: string; };