import Stream from 'stream'; import { qsStrict as strictQs } from 'strict-qs'; import { OPEN_API_METHODS, getOpenAPIOperations, dereferenceOpenAPIOperations } from './libs/openAPIUtils.js'; import { prepareParametersValidators, applyValidators, filterHeaders, prepareBodyValidator, extractOperationSecurityParameters, castSchemaValue, castParameters } from './libs/validation.js'; import { type WhookBodySpec, type WhookResponseSpec, extractBodySpec, extractResponseSpec, checkResponseCharset, checkResponseMediaType, executeHandler, extractProduceableMediaTypes, extractConsumableMediaTypes } from './libs/utils.js'; import { getBody, sendBody } from './libs/body.js'; import initErrorHandler, { DEFAULT_ERROR_URI, DEFAULT_HELP_URI, DEFAULT_ERRORS_DESCRIPTORS, DEFAULT_DEFAULT_ERROR_CODE } from './services/errorHandler.js'; import { DEFAULT_DEBUG_NODE_ENVS, DEFAULT_BUFFER_LIMIT, DEFAULT_PARSERS, DEFAULT_STRINGIFYERS, DEFAULT_DECODERS, DEFAULT_ENCODERS } from './libs/constants.js'; import type { WhookRawOperation, SupportedSecurityScheme } from './libs/openAPIUtils.js'; import type { JsonValue } from 'type-fest'; import type { Provider } from 'knifecycle'; import type { Transform } from 'stream'; import type { WhookHandler, WhookOperation, WhookHTTPTransactionService, WhookResponse } from '@whook/http-transaction'; import type { OpenAPIV3_1 } from 'openapi-types'; import type { LogService } from 'common-services'; import type { IncomingMessage, ServerResponse } from 'node:http'; import type { WhookErrorsDescriptors, WhookErrorDescriptor, WhookErrorHandlerConfig, WhookErrorHandlerDependencies, WhookErrorHandler } from './services/errorHandler.js'; import type { AppEnvVars } from 'application-services'; export type { WhookErrorHandler, WhookErrorHandlerDependencies, WhookErrorsDescriptors, WhookErrorDescriptor, WhookErrorHandlerConfig, WhookBodySpec, WhookResponseSpec, WhookRawOperation, SupportedSecurityScheme, }; export { OPEN_API_METHODS, DEFAULT_DEBUG_NODE_ENVS, DEFAULT_BUFFER_LIMIT, DEFAULT_PARSERS, DEFAULT_STRINGIFYERS, DEFAULT_DECODERS, DEFAULT_ENCODERS, initErrorHandler, DEFAULT_ERROR_URI, DEFAULT_HELP_URI, DEFAULT_ERRORS_DESCRIPTORS, DEFAULT_DEFAULT_ERROR_CODE, dereferenceOpenAPIOperations, getOpenAPIOperations, extractOperationSecurityParameters, castSchemaValue, castParameters, prepareParametersValidators, prepareBodyValidator, applyValidators, filterHeaders, extractBodySpec, extractResponseSpec, checkResponseCharset, checkResponseMediaType, executeHandler, extractProduceableMediaTypes, extractConsumableMediaTypes, getBody, sendBody, }; export type WhookQueryStringParser = (definitions: Parameters[1], query: Parameters[2]) => ReturnType; export type WhookHandlerName = string; export type WhookHandlersService = Record; export type WhookParser = (content: string, bodySpec?: WhookBodySpec) => JsonValue; export type WhookParsers = { [name: string]: WhookParser; }; export type WhookStringifyer = (content: string) => string; export type WhookStringifyers = { [name: string]: WhookStringifyer; }; export type WhookEncoder = { new (...args: unknown[]): T; }; export type WhookEncoders = { [name: string]: WhookEncoder; }; export type WhookDecoder = { new (...args: unknown[]): T; }; export type WhookDecoders = { [name: string]: WhookDecoder; }; export type WhookHTTPRouterConfig = { DEBUG_NODE_ENVS?: string[]; BUFFER_LIMIT?: string; BASE_PATH?: string; }; export type WhookHTTPRouterDependencies = WhookHTTPRouterConfig & { ENV: AppEnvVars; HANDLERS: WhookHandlersService; API: OpenAPIV3_1.Document; PARSERS?: WhookParsers; STRINGIFYERS?: WhookStringifyers; DECODERS?: WhookEncoders; ENCODERS?: WhookDecoders; QUERY_PARSER?: WhookQueryStringParser; log?: LogService; httpTransaction: WhookHTTPTransactionService; errorHandler: WhookErrorHandler; }; export interface WhookHTTPRouterService { (req: IncomingMessage, res: ServerResponse): Promise; } export type WhookHTTPRouterProvider = Provider; declare const _default: import("knifecycle").ProviderInitializer, WhookOperation>>>, WhookHTTPRouterService>; export default _default;