declare type InputTypes = { [type: string]: any; }; declare type InputOptions = { [type in keyof T]?: { [option: string]: any; }; }; declare type InputKeys = { [key: string]: keyof T; }; declare type InputFormat = { types: T; options?: InputOptions; keys: InputKeys; }; declare type GetInputOptions = 'options' extends keyof IF ? (T extends keyof IF['options'] ? IF['options'][T] : never) : never; declare type InputReturn = IF['types'][IF['keys'][K]]; declare type InputBatchReturn = { [K in Ks]: InputReturn; }; declare type Resolve = (value?: T | PromiseLike) => void; declare type Reject = (reason?: any) => void; declare type Output = (data: T) => void; declare type InputSingle = (key: K, type: T, options?: GetInputOptions) => Promise>; declare type InputBatchValueDescriptor = IF['keys'][K] | { type: IF['keys'][K]; options?: GetInputOptions; }; declare type InputBatch = (values: { [K in Ks]: InputBatchValueDescriptor; }, meta?: any) => Promise>; declare type HeadlessInput = { [K in keyof IF['keys']]: InputReturn; }; declare type Input = InputSingle & { batch?: InputBatch; }; declare type Attachments = { then?: Resolve; catch?: Reject; output?: Output; input?: InputSingle; inputBatch?: InputBatch; }; /** * Defines the format of an AdapterExecutor. */ export declare type AdapterExecutor = (input?: Input, output?: Output) => Promise; /** * Contains metadata about the Adapter. */ export declare type AdapterMeta = { description?: string; inputs?: { [K in keyof I['keys']]: string; }; }; /** * Functionally similar to Promise. * @see makeAdapter() */ export declare type Adapter = { exec: () => Promise; promise: () => Promise; output: (onOutput: Output) => Adapter; input: (onInput: InputSingle | HeadlessInput) => Adapter; inputBatch: (onBatchInput: InputBatch) => Adapter; then: (resolve: Resolve) => Adapter; catch: (resolve: Reject) => Adapter; attach: (attachments: Attachments) => Adapter; meta: AdapterMeta; }; /** * Takes an executor function and wraps it in an Adapter. */ export declare const makeAdapter: = InputFormat, O = any>(executor: AdapterExecutor, meta?: AdapterMeta) => Adapter; export {};