import { type ValidateFunction } from 'ajv/dist/2020.js'; import { type LogService } from 'common-services'; import { type NodeEnv, type AppEnvVars } from 'application-services'; import { type OpenAPIReference, type OpenAPI } from 'ya-open-api-types'; import { type ExpressiveJSONSchema, type JSONSchema } from 'ya-json-schema-types'; export declare const DEFAULT_SCHEMA_VALIDATORS_OPTIONS: { readonly lazy: false; readonly dedupe: false; readonly hashLength: 16; readonly buildSchemas: false; }; /** Options for schema validation */ export interface WhookSchemaValidatorsOptions { /** Compile only at first validation */ lazy: boolean; /** * Dedupe schemas based on their JSON representation * to reduce the amount of compiled validations functions */ dedupe: boolean; /** * Size of the shake256 hash for deduping */ hashLength: number; /** * Whether schemas will be built or not */ buildSchemas: boolean; } export interface WhookSchemaValidatorsConfig { DEBUG_NODE_ENVS?: NodeEnv[]; SCHEMA_VALIDATORS_OPTIONS?: WhookSchemaValidatorsOptions; } export type WhookSchemaValidatorsDependencies = WhookSchemaValidatorsConfig & { API: OpenAPI; ENV: AppEnvVars; log?: LogService; }; export type WhookSchemaValidatorsService = ( /** The schema to compile to a validator */ schema: JSONSchema | ExpressiveJSONSchema | OpenAPIReference, /** A unique cache key in order to avoid compiling the schema twice */ cacheKey?: string) => ValidateFunction; export type WhookSchemaValidatorsMap = Record; declare const _default: import("knifecycle").ServiceInitializer; export default _default; export declare function buildSchemaValidatorsMap({ DEBUG_NODE_ENVS, SCHEMA_VALIDATORS_OPTIONS, API, ENV, log, }: { DEBUG_NODE_ENVS: NodeEnv[]; SCHEMA_VALIDATORS_OPTIONS: WhookSchemaValidatorsOptions; API: OpenAPI; ENV: AppEnvVars; log: LogService; }): Promise;