import { Data } from '../atoms'; import type { Vacuo, Terminator } from '../metas'; import type { TransformationLiftPositions, MutatorTransformation, LiftBothTransformation, LiftLeftTransformation, LiftRightTransformation } from '../particles'; import type { MutationOptions, AtomLikeOfOutput } from '../atoms'; /****************************************************************************************************** * * Utils Types * ******************************************************************************************************/ /** * */ declare type TupleToUnion = T[number]; declare type ObjectToUnion> = T[keyof T]; declare type ToUnion> = T extends any[] ? TupleToUnion : T extends Record ? ObjectToUnion : never; interface WrapP { key: K; value: P | Vacuo; } declare type WrapArrayPs = Ps extends [infer F, ...infer R] ? [WrapP, ...WrapArrayPs] : []; declare type WrapObjectPs> = { [K in keyof Ps]: { key: K; value: Ps[K] | Vacuo; }; }; declare type ToBooleanTuple = T extends [infer _, ...infer R] ? [boolean, ...ToBooleanTuple] : []; declare type ToUndefinedableTuple = T extends [infer F, ...infer R] ? [F | undefined, ...ToUndefinedableTuple] : []; declare type ToBooleanObject> = { [K in keyof T]: boolean; }; declare type ToUndefinedableObject> = { [K in keyof T]?: T[K] | undefined; }; /****************************************************************************************************** * * MS Tache Common * ******************************************************************************************************/ /** * */ declare type CustomizeTypes = 'partly' | 'fully'; declare type LiftTypes = Exclude; /** * @typeParam AN - The type of acceptNonAtom * @typeParam CT - The type of customizeTypes * @typeParam LT - The type of MutationLiftPosition */ interface MSTacheCommonConfig, C, Contexts extends any[] = any[], AN extends boolean = boolean, CT extends CustomizeTypes = CustomizeTypes, LT extends LiftTypes = LiftTypes> { /** * Default to `true`. */ acceptNonAtom?: AN; /** * Default to `partly`. */ customizeType?: CT; options?: MutationOptions, C, Contexts> & { lift?: { position?: LT; }; }; /** * Default to `true`. */ autoUpdateContexts?: boolean; sourcesType: 'array' | 'object'; } /****************************************************************************************************** * * Array MS Tache * ******************************************************************************************************/ /** * */ interface ArrayMSTacheTrunkBaseContexts { arity: number; TERMINATOR: Terminator; } declare type ArrayMSTacheFullyTransformation = (contexts: ArrayMSTacheTrunkBaseContexts) => LT extends 'both' ? LiftBothTransformation>, C> : LT extends 'left' ? LiftLeftTransformation>, C> : LT extends 'right' ? LiftRightTransformation>, C> : LT extends 'none' ? MutatorTransformation>, C> : never; interface ArrayMSTacheTrunkContextsForPartly extends ArrayMSTacheTrunkBaseContexts { states: ToBooleanTuple; values: ToUndefinedableTuple; [key: string]: any; } interface ArrayMSTacheConfig extends MSTacheCommonConfig { /** * Indicate how many sources will take into account for the generated Tache. * If is provided, the generated Tache will be loose curried with the number of sources. * * Default to `undefined`, which means the generated Tache will not be curried, the number of sources * took into account is the same as the number of sources passed in. */ arity?: number; transformation: CT extends 'partly' ? (LT extends 'both' ? LiftBothTransformation>, C, [ArrayMSTacheTrunkContextsForPartly]> : LT extends 'left' ? LiftLeftTransformation>, C, [ArrayMSTacheTrunkContextsForPartly]> : LT extends 'right' ? LiftRightTransformation>, C, [ArrayMSTacheTrunkContextsForPartly]> : LT extends 'none' ? MutatorTransformation>, C, [ArrayMSTacheTrunkContextsForPartly]> : never) : CT extends 'fully' ? ArrayMSTacheFullyTransformation : never; sourcesType: 'array'; } declare type WrapArrayToAtomLikeOfOutput = T extends [infer F, ...infer R] ? [ AN extends true ? AtomLikeOfOutput | F : AtomLikeOfOutput, ...WrapArrayToAtomLikeOfOutput ] : []; /** * @typeParam AN - The type of acceptNonAtom */ export declare type ArrayMSTache = (...sources: WrapArrayToAtomLikeOfOutput | [WrapArrayToAtomLikeOfOutput]) => Data; /** * @typeParam AN - The type of acceptNonAtom * @typeParam CT - The type of customizeTypes * @typeParam LT - The type of MutationLiftPosition */ export declare function createArrayMSTache(config: ArrayMSTacheConfig): ArrayMSTache; /****************************************************************************************************** * * Object MS Tache * ******************************************************************************************************/ /** * */ interface ObjectMSTacheTrunkBaseContexts { keysOfSources: Array; TERMINATOR: Terminator; } declare type ObjectMSTacheFullyTransformation, C, LT extends LiftTypes = LiftTypes> = (contexts: ObjectMSTacheTrunkBaseContexts) => LT extends 'both' ? LiftBothTransformation>, C> : LT extends 'left' ? LiftLeftTransformation>, C> : LT extends 'right' ? LiftRightTransformation>, C> : LT extends 'none' ? MutatorTransformation>, C> : never; interface ObjectMSTacheTrunkContextsForPartly = Record> extends ArrayMSTacheTrunkBaseContexts { states: ToBooleanObject; values: ToUndefinedableObject; [key: string]: any; } interface ObjectMSTacheConfig, C, AN extends boolean = boolean, CT extends CustomizeTypes = CustomizeTypes, LT extends LiftTypes = LiftTypes> extends MSTacheCommonConfig { transformation: CT extends 'partly' ? (LT extends 'both' ? LiftBothTransformation>, C, [ObjectMSTacheTrunkContextsForPartly]> : LT extends 'left' ? LiftLeftTransformation>, C, [ObjectMSTacheTrunkContextsForPartly]> : LT extends 'right' ? LiftRightTransformation>, C, [ObjectMSTacheTrunkContextsForPartly]> : LT extends 'none' ? MutatorTransformation>, C, [ObjectMSTacheTrunkContextsForPartly]> : never) : CT extends 'fully' ? ObjectMSTacheFullyTransformation : never; sourcesType: 'object'; } declare type WrapObjectToAtomLikeOfOutput, AN> = { [K in keyof T]: AN extends true ? T[K] | AtomLikeOfOutput : AtomLikeOfOutput; }; /** * @typeParam AN - The type of acceptNonAtom */ export declare type ObjectMSTache = (sources: WrapObjectToAtomLikeOfOutput) => Data; /** * @typeParam AN - The type of acceptNonAtom * @typeParam CT - The type of customizeTypes * @typeParam LT - The type of MutationLiftPosition */ export declare const createObjectMSTache: , C, AN extends boolean = boolean, CT extends CustomizeTypes = CustomizeTypes, LT extends LiftTypes = LiftTypes>(config: ObjectMSTacheConfig) => ObjectMSTache; interface ICreateMSTache { (config: ArrayMSTacheConfig): ArrayMSTache; , C, AN extends boolean = boolean, CT extends CustomizeTypes = CustomizeTypes, LT extends LiftTypes = LiftTypes>(config: ObjectMSTacheConfig): ObjectMSTache; } /** * @return TacheMaker */ export declare const createMSTache: ICreateMSTache; export {}; //# sourceMappingURL=base__ms.taches.d.ts.map