import { DateAdapter } from '../date-adapter'; import { IOperatorConfig, Operator, OperatorFnOutput } from './interface'; declare const MERGE_DURATION_OPERATOR_ID: unique symbol; export declare class MergeDurationOperatorError extends Error { } /** * An operator function which takes an occurrence stream with * `hasDuration === true` and merges occurrences which have overlapping * start and end times. * * Because it's possible for all the occurrences in the stream to have * overlapping start and end times, you must provide a `maxDuration` * argument that represents the maximum possible duration for a single * occurrence. If this duration is exceeded, a `MergeDurationOperatorError` * will be thrown. * * - For your convenience, you can globally set a default * `MergeDurationOperator#maxDuration` via * `RScheduleConfig.MergeDurationOperator.defaultMaxDuration`. * * Usage example: * * ```typescript * const MILLISECONDS_IN_HOUR = 1000 * 60 * 60; * * const dates = new Dates({ * dates: [ * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 2 }), * new StandardDateAdapter(new Date(2010, 10, 11, 14), { duration: MILLISECONDS_IN_HOUR * 2 }), * new StandardDateAdapter(new Date(2010, 10, 12, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), * ], * dateAdpter: StandardDateAdapter, * }).pipe( * mergeDuration({ * maxDuration: MILLISECONDS_IN_HOUR * 24 * }) * ) * * dates.occurrences().toArray() === [ * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 3 }), * new StandardDateAdapter(new Date(2010, 10, 12, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), * ] * ``` */ export declare function mergeDuration(args?: { maxDuration?: number; }): OperatorFnOutput; export declare class MergeDurationOperator extends Operator { static isMergeDurationOperator(object: unknown): object is MergeDurationOperator; readonly maxDuration: number; protected readonly [MERGE_DURATION_OPERATOR_ID] = true; constructor(args: { maxDuration?: number; }, config: IOperatorConfig); /** Not actually used but necessary for IRunnable interface */ set(_: 'timezone', value: string | null): MergeDurationOperator; protected calculateIsInfinite(): boolean; protected calculateHasDuration(): boolean; private forwardRun; private reverseRun; } export {}; //# sourceMappingURL=merge-duration.operator.d.ts.map