import { Data, Mutation } from '../atoms'; import type { IsArray, IsTuple, ObjectPrettify } from '../../@types/index'; import type { DataLike, MutationLike } from '../atoms'; import type { ReplayDataMediator, ReplayMutationMediator } from '../mediators'; interface BatchMakeOptions { forceWrap: boolean; } declare type WrapToData = Target extends Data ? Data : Target extends ReplayDataMediator ? ReplayDataMediator : Target extends Mutation ? Data : Target extends ReplayMutationMediator ? ReplayDataMediator : Data; export declare type WrapDataInArray = IsArray extends true ? T extends any[] ? (T extends Array ? Array> : never) : (T extends ReadonlyArray ? ReadonlyArray> : never) : IsTuple extends true ? T extends any[] ? T extends [infer First, ...infer Rest] ? [WrapToData, ...WrapDataInArray] : [] : T extends readonly [infer First, ...infer Rest] ? readonly [WrapToData, ...WrapDataInArray] : readonly [] : never; export declare type ForceWrapDataInArray = IsArray extends true ? T extends any[] ? (T extends Array ? Array> : never) : (T extends ReadonlyArray ? ReadonlyArray> : never) : IsTuple extends true ? T extends any[] ? T extends [infer First, ...infer Rest] ? [Data, ...ForceWrapDataInArray] : [] : T extends readonly [infer First, ...infer Rest] ? readonly [Data, ...ForceWrapDataInArray] : readonly [] : never; /** * forceWrap - true: items will be wrapped in Data. See {@link forceWrapToData}. * * forceWrap - false: Mutations will be transform to Data, Datas will not be handled, * other values will be wrapped in Data. See {@link wrapToData}. * @example * ``` * const tupleA: [number, Data, number] = [1, Data.of(2), 3] * const arrayA = [1, 2, 3] * // Expect: [Data, Data, Data] * const dataInTupleA = makeDataInArray(tupleA) * // Expect: Data[] * const dataInArrayA = makeDataInArray(arrayA) * ``` */ export declare function makeDataInArray(targets: V, options?: BatchMakeOptions & { forceWrap: false; }): WrapDataInArray; export declare function makeDataInArray(targets: V, options?: BatchMakeOptions & { forceWrap: true; }): ForceWrapDataInArray; /** * Curried version of {@link makeDataInArray}. */ export declare const makeDataInArray_: (...args: any[]) => any; declare type WrapDataInObject> = ObjectPrettify<{ [Key in keyof T]: WrapToData; }>; declare type ForceWrapDataInObject> = ObjectPrettify<{ [Key in keyof T]: Data; }>; /** * forceWrap - true: items will be wrapped in Data. See {@link forceWrapToData}. * * forceWrap - false: Mutations will be transform to Data, Datas will not be handled, * other values will be wrapped in Data. See {@link wrapToData}. * @example * ``` * const indexedObject: { [key: string]: number } = { a: 1, b: 2, c: 3 } * // Expect: Record> * const dataInIndexedObject = makeDataInObject(indexedObject) * const namedObject = { a: 1, b: Data.of(2), c: 3 } * // Expect: { a: Data, b: Data, c: Data } * const dataInNamedObject = makeDataInObject(namedObject) * ``` */ export declare function makeDataInObject>(targets: V, options?: BatchMakeOptions & { forceWrap: false; }): WrapDataInObject; export declare function makeDataInObject>(targets: V, options?: BatchMakeOptions & { forceWrap: true; }): ForceWrapDataInObject; /** * Curried version of {@link makeDataInObject}. */ export declare const makeDataInObject_: (...args: any[]) => any; /** * forceWrap - true: items will be wrapped in Mutation. * * forceWrap - false: Datas will be transform to Mutation, Mutations will not be handled, other values will be wrapped in Mutation. */ export declare const createMutationInArray: (arr: V[], options?: BatchMakeOptions) => Array>; export declare const createMutationInArray_: (...args: any[]) => any; /** * forceWrap - true: items will be wrapped in Mutation. * * forceWrap - false: Datas will be transform to Mutation, Mutations will not be handled, other values will be wrapped in Mutation. */ export declare const createMutationInObject: (obj: Record, options?: BatchMakeOptions) => Record>; export declare const createMutationInObject_: (...args: any[]) => any; /** * forceWrap - true: functions will be wrapped in Mutation, other values will be wrapped in Data. * * forceWrap - false: Atoms will not be handled, functions will be wrapped in Mutation, other values will be wrapped in Data. */ export declare const createAtomInArray: (arr: V[], options?: BatchMakeOptions) => Array | MutationLike>; export declare const createAtomInArray_: (...args: any[]) => any; /** * forceWrap - true: functions will be wrapped in Mutation, other values will be wrapped in Data. * * forceWrap - false: Atoms will not be handled, functions will be wrapped in Mutation, other values will be wrapped in Data. */ export declare const createAtomInObject: (obj: Record, options?: BatchMakeOptions) => Record | MutationLike>; export declare const createAtomInObject_: (...args: any[]) => any; export {}; //# sourceMappingURL=batch-create.helpers.d.ts.map