import { DeferredResult, DetailedResult, IMessageAggregator, Result } from './result'; /** * Aggregates successful result values from a collection of {@link Result | Result}. * @param results - The collection of {@link Result | Result} to be mapped. * @param aggregatedErrors - Optional string array to which any error messages will be * appended. Each error is appended as an individual string. * @returns If all {@link Result | results} are successful, returns {@link Success} with an * array containing all returned values. If any {@link Result | results} failed, returns * {@link Failure} with a concatenated summary of all error messages. * @public */ export declare function mapResults(results: Iterable>, aggregatedErrors?: IMessageAggregator): Result; /** * Aggregates successful results from a collection of {@link DetailedResult | DetailedResult}, * optionally ignoring certain error details. * @param results - The collection of {@link DetailedResult | DetailedResult} to be mapped. * @param ignore - An array of error detail values (of type ``) that should be ignored. * @param aggregatedErrors - Optional string array to which any non-ignorable error messages will be * appended. Each error is appended as an individual string. * @returns {@link Success} with an array containing all successful results if all results either * succeeded or returned error details listed in `ignore`. If any results failed with details * that cannot be ignored, returns {@link Failure} with an concatenated summary of all non-ignorable * error messages. * @public */ export declare function mapDetailedResults(results: Iterable>, ignore: TD[], aggregatedErrors?: IMessageAggregator): Result; /** * Aggregates successful results from a a collection of {@link Result | Result}. * @param results - An `Iterable` of {@link Result | Result} from which success * results are to be aggregated. * @param aggregatedErrors - Optional string array to which any returned error messages will be * appended. Each error is appended as an individual string. * @returns {@link Success} with an array of `` if any results were successful. If * all {@link Result | results} failed, returns {@link Failure} with a concatenated * summary of all error messages. * @public */ export declare function mapSuccess(results: Iterable>, aggregatedErrors?: IMessageAggregator): Result; /** * Aggregates error messages from a collection of {@link Result | Result}. * @param results - An iterable collection of {@link Result | Result} for which * error messages are aggregated. * @param aggregatedErrors - Optional string array to which any returned error messages will be * appended. Each error is appended as an individual string. * @returns An array of strings consisting of all error messages returned by * {@link Result | results} in the source collection. Ignores {@link Success} * results and returns an empty array if there were no errors. * @public */ export declare function mapFailures(results: Iterable>, aggregatedErrors?: IMessageAggregator): string[]; /** * Determines if an iterable collection of {@link Result | Result} were all successful. * @param results - The collection of {@link Result | Result} to be tested. * @param successValue - The value to be returned if results are successful. * @param aggregatedErrors - Optional string array to which any returned error messages will be * appended. Each error is appended as an individual string. * @returns Returns {@link Success} with `successValue` if all {@link Result | results} are successful. * If any are unsuccessful, returns {@link Failure} with a concatenated summary of the error * messages from all failed elements. * @public */ export declare function allSucceed(results: Iterable>, successValue: T, aggregatedErrors?: IMessageAggregator): Result; /** * Returns the first successful result from a collection of {@link Result | Result} or {@link DeferredResult | DeferredResult}. * @param results - The collection of {@link Result | Result} or {@link DeferredResult | DeferredResult} to be tested. * @returns The first successful result, or {@link Failure} with a concatenated summary of all error messages. * @public */ export declare function firstSuccess(results: Iterable | DeferredResult>): Result; /** * String-keyed record of initialization functions to be passed to {@link (populateObject:1)} * or {@link (populateObject:2)}. * @public */ export type FieldInitializers = { [key in keyof T]: (state: Partial) => Result; }; /** * Options for the {@link (populateObject:1)} function. * @public */ export interface PopulateObjectOptions { /** * If present, specifies the order in which property values should * be evaluated. Any keys not listed are evaluated after all listed * keys in indeterminate order. If 'order' is not present, keys * are evaluated in indeterminate order. */ order?: (keyof T)[]; /** * Specify handling of `undefined` values. By default, successful * `undefined` results are written to the result object. If this value * is `true` then `undefined` results are suppressed for all properties. * If this value is an array of property keys then `undefined` results * are suppressed for those properties only. */ suppressUndefined?: boolean | (keyof T)[]; } /** * Populates an an object based on a prototype full of field initializers that return {@link Result | Result}. * Returns {@link Success} with the populated object if all initializers succeed, or {@link Failure} with a * concatenated list of all error messages. * @param initializers - An object with the shape of the target but with initializer functions for * each property. * @param options - An optional {@link PopulateObjectOptions | set of options} which * modify the behavior of this call. * @param aggregatedErrors - Optional string array to which any returned error messages will be * appended. Each error is appended as an individual string. * {@label WITH_OPTIONS} * @public */ export declare function populateObject(initializers: FieldInitializers, options?: PopulateObjectOptions, aggregatedErrors?: IMessageAggregator): Result; /** * Populates an an object based on a prototype full of field initializers that return {@link Result | Result}. * Returns {@link Success} with the populated object if all initializers succeed, or {@link Failure} with a * concatenated list of all error messages. * @param initializers - An object with the shape of the target but with initializer functions for * each property. * @param order - Optional order in which keys should be written. * @param aggregatedErrors - Optional string array to which any returned error messages will be * appended. Each error is appended as an individual string. * @public * {@label WITH_ORDER} * @deprecated Pass {@link PopulateObjectOptions} instead. */ export declare function populateObject(initializers: FieldInitializers, order: (keyof T)[] | undefined, aggregatedErrors?: IMessageAggregator): Result; //# sourceMappingURL=mapResults.d.ts.map