import type { RedisOptions } from 'ioredis'; import type { IProcessedDataConfig } from 'n8n-workflow'; import type { schema } from './schema'; type GetPathSegments = Traversable extends Filter ? [] : { [K in ValidKeys]: [K, ...GetPathSegments]; }[ValidKeys]; type JoinByDotting = T extends [infer F] ? F : T extends [infer F, ...infer R] ? F extends string ? R extends string[] ? `${F}.${JoinByDotting}` : never : never : string; type ToDottedPath = JoinByDotting>; type CollectPathsByType = ToDottedPath>; type NumericPath = CollectPathsByType; type BooleanPath = CollectPathsByType; type StringLiteralArrayPath = CollectPathsByType; type StringPath = CollectPathsByType; type ConfigOptionPath = NumericPath | BooleanPath | StringPath | StringLiteralArrayPath | keyof ExceptionPaths; type ToReturnType = T extends NumericPath ? number : T extends BooleanPath ? boolean : T extends StringLiteralArrayPath ? StringLiteralMap[T] : T extends keyof ExceptionPaths ? ExceptionPaths[T] : T extends StringPath ? string : unknown; type ExceptionPaths = { 'queue.bull.redis': RedisOptions; processedDataManager: IProcessedDataConfig; 'ui.banners.dismissed': string[] | undefined; easyAIWorkflowOnboarded: boolean | undefined; }; type GetPathSegmentsWithUnions = T extends ReadonlyArray ? [C] : { [K in ValidKeys]: [K, ...GetPathSegmentsWithUnions]; }[ValidKeys]; type ToPathUnionPair = T extends [...infer Path, infer Union] ? Path extends string[] ? { path: ToDottedPath; union: Union; } : never : never; type ToStringLiteralMap = { [Path in T['path']]: Extract['union']; }; type StringLiteralMap = ToStringLiteralMap>>; type ValidKeys = keyof T extends string ? keyof T extends keyof NumberConstructor ? never : keyof T : never; type RemoveExcess = T extends [...infer Path, 'format' | 'default'] ? Path extends string[] ? Path : never : never; declare module 'convict' { interface Config { getEnv(path: Path): ToReturnType; } } export {};