import { DetailedResult } from '../base'; import { IReadOnlyResultMap, ResultMapResultDetail } from './readonlyResultMap'; import { ResultMapValueFactory } from './resultMap'; import { KeyValueConverters } from './keyValueConverters'; import { Collector, CollectorResultDetail } from './collector'; import { IReadOnlyResultMapValidator } from './resultMapValidator'; import { CollectibleKey, ICollectible } from './collectible'; /** * A read-only interface exposing non-mutating methods of a * {@link Collections.CollectorValidator | CollectorValidator}. * @public */ export interface IReadOnlyCollectorValidator> extends IReadOnlyResultMapValidator, TITEM> { /** * {@inheritdoc Collections.ConvertingCollectorValidator.map} */ readonly map: IReadOnlyResultMap, TITEM>; /** * {@inheritdoc Collections.Collector.get} */ get(key: string): DetailedResult; /** * {@inheritdoc Collections.ResultMap.has} */ has(key: string): boolean; /** * {@inheritdoc Collections.Collector.(getOrAdd:2)} */ getOrAdd(key: string, factory: ResultMapValueFactory, TITEM>): DetailedResult; } /** * Parameters for constructing a {@link Collections.CollectorValidator | CollectorValidator}. * @public */ export interface ICollectorValidatorCreateParams> { readonly collector: Collector; readonly converters: KeyValueConverters, TITEM>; } /** * A {@link Collections.Collector | Collector} wrapper which validates weakly-typed keys * and values before calling the wrapped collector. * @public */ export declare class CollectorValidator> implements IReadOnlyCollectorValidator { readonly converters: KeyValueConverters, TITEM>; get map(): IReadOnlyResultMap, TITEM>; protected _collector: Collector; /** * Constructs a new {@link Collections.ConvertingCollectorValidator | ConvertingCollectorValidator}. * @param params - Required parameters for constructing the collector validator. */ constructor(params: ICollectorValidatorCreateParams); /** * {@inheritdoc Collections.Collector.add} */ add(item: unknown): DetailedResult; /** * {@inheritdoc Collections.Collector.get} */ get(key: string): DetailedResult; /** * {@inheritdoc Collections.Collector.(getOrAdd:2)} */ getOrAdd(key: string, factory: ResultMapValueFactory, TITEM>): DetailedResult; /** * {@inheritdoc Collections.Collector.(getOrAdd:1)} * @param item - The item to add to the collector. */ getOrAdd(item: unknown): DetailedResult; /** * {@inheritdoc Collections.ResultMap.has} */ has(key: string): boolean; /** * {@inheritdoc Collections.Collector.toReadOnly} */ toReadOnly(): IReadOnlyCollectorValidator; /** * Helper to convert a value, returning a {@link DetailedResult | DetailedResult} * and formatting the error message. * @param value - The value to convert. * @returns {@link DetailedSuccess | DetailedSuccess} with the converted value * and detail `success` if conversion is successful, or * {@link DetailedFailure | DetailedFailure} with the error message and detail `invalid-value` * if conversion fails. */ protected _convertValue(value: unknown): DetailedResult; } //# sourceMappingURL=collectorValidator.d.ts.map