Skip to content

Commit

Permalink
docs: include additional interfaces to docs (#6391)
Browse files Browse the repository at this point in the history
* docs: include additional interfaces to docs

* chore: update api_guardian

* chore: move interfaces to operators/index.ts

* docs: include new groupBy interfaces

* chore: update api_guardian
  • Loading branch information
jakovljevic-mladen authored Dec 27, 2021
1 parent 081ca2b commit 5e78bc4
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 12 deletions.
56 changes: 55 additions & 1 deletion api_guard/dist/types/operators/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ export declare function audit<T>(durationSelector: (value: T) => ObservableInput

export declare function auditTime<T>(duration: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;

export interface BasicGroupByOptions<K, T> {
connector?: () => SubjectLike<T>;
duration?: (grouped: GroupedObservable<K, T>) => ObservableInput<any>;
element?: undefined;
}

export declare function buffer<T>(closingNotifier: Observable<any>): OperatorFunction<T, T[]>;

export declare function bufferCount<T>(bufferSize: number, startBufferEvery?: number | null): OperatorFunction<T, T[]>;
Expand Down Expand Up @@ -47,6 +53,10 @@ export declare function concatWith<T, A extends readonly unknown[]>(...otherSour

export declare function connect<T, O extends ObservableInput<unknown>>(selector: (shared: Observable<T>) => O, config?: ConnectConfig<T>): OperatorFunction<T, ObservedValueOf<O>>;

export interface ConnectConfig<T> {
connector: () => SubjectLike<T>;
}

export declare function count<T>(predicate?: (value: T, index: number) => boolean): OperatorFunction<T, number>;

export declare function debounce<T>(durationSelector: (value: T) => ObservableInput<any>): MonoTypeOperatorFunction<T>;
Expand Down Expand Up @@ -128,6 +138,12 @@ export declare function groupBy<T, K>(key: (value: T) => K, element: void, durat
export declare function groupBy<T, K, R>(key: (value: T) => K, element?: (value: T) => R, duration?: (grouped: GroupedObservable<K, R>) => Observable<any>): OperatorFunction<T, GroupedObservable<K, R>>;
export declare function groupBy<T, K, R>(key: (value: T) => K, element?: (value: T) => R, duration?: (grouped: GroupedObservable<K, R>) => Observable<any>, connector?: () => Subject<R>): OperatorFunction<T, GroupedObservable<K, R>>;

export interface GroupByOptionsWithElement<K, E, T> {
connector?: () => SubjectLike<E>;
duration?: (grouped: GroupedObservable<K, E>) => ObservableInput<any>;
element: (value: T) => E;
}

export declare function ignoreElements(): OperatorFunction<any, never>;

export declare function isEmpty<T>(): OperatorFunction<T, boolean>;
Expand Down Expand Up @@ -220,6 +236,11 @@ export declare function repeatWhen<T>(notifier: (notifications: Observable<void>
export declare function retry<T>(count?: number): MonoTypeOperatorFunction<T>;
export declare function retry<T>(config: RetryConfig): MonoTypeOperatorFunction<T>;

export interface RetryConfig {
count: number;
resetOnSuccess?: boolean;
}

export declare function retryWhen<T>(notifier: (errors: Observable<any>) => Observable<any>): MonoTypeOperatorFunction<T>;

export declare function sample<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T>;
Expand All @@ -235,9 +256,23 @@ export declare function sequenceEqual<T>(compareTo: Observable<T>, comparator?:
export declare function share<T>(): MonoTypeOperatorFunction<T>;
export declare function share<T>(options: ShareConfig<T>): MonoTypeOperatorFunction<T>;

export interface ShareConfig<T> {
connector?: () => SubjectLike<T>;
resetOnComplete?: boolean | (() => Observable<any>);
resetOnError?: boolean | ((error: any) => Observable<any>);
resetOnRefCountZero?: boolean | (() => Observable<any>);
}

export declare function shareReplay<T>(config: ShareReplayConfig): MonoTypeOperatorFunction<T>;
export declare function shareReplay<T>(bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;

export interface ShareReplayConfig {
bufferSize?: number;
refCount: boolean;
scheduler?: SchedulerLike;
windowTime?: number;
}

export declare function single<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;
export declare function single<T>(predicate?: (value: T, index: number, source: Observable<T>) => boolean): MonoTypeOperatorFunction<T>;

Expand Down Expand Up @@ -287,7 +322,12 @@ export declare function tap<T>(observer?: Partial<TapObserver<T>>): MonoTypeOper
export declare function tap<T>(next: (value: T) => void): MonoTypeOperatorFunction<T>;
export declare function tap<T>(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): MonoTypeOperatorFunction<T>;

export declare function throttle<T>(durationSelector: (value: T) => ObservableInput<any>, { leading, trailing }?: ThrottleConfig): MonoTypeOperatorFunction<T>;
export declare function throttle<T>(durationSelector: (value: T) => ObservableInput<any>, config?: ThrottleConfig): MonoTypeOperatorFunction<T>;

export interface ThrottleConfig {
leading?: boolean;
trailing?: boolean;
}

export declare function throttleTime<T>(duration: number, scheduler?: SchedulerLike, config?: import("./throttle").ThrottleConfig): MonoTypeOperatorFunction<T>;

Expand All @@ -302,6 +342,20 @@ export declare function timeout<T, M = unknown>(config: Omit<TimeoutConfig<T, an
export declare function timeout<T>(first: Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export declare function timeout<T>(each: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;

export interface TimeoutConfig<T, O extends ObservableInput<unknown> = ObservableInput<T>, M = unknown> {
each?: number;
first?: number | Date;
meta?: M;
scheduler?: SchedulerLike;
with?: (info: TimeoutInfo<T, M>) => O;
}

export interface TimeoutInfo<T, M = unknown> {
readonly lastValue: T | null;
readonly meta: M;
readonly seen: number;
}

export declare function timeoutWith<T, R>(dueBy: Date, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;
export declare function timeoutWith<T, R>(waitFor: number, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;

Expand Down
3 changes: 3 additions & 0 deletions src/internal/operators/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { from } from '../observable/from';
import { operate } from '../util/lift';
import { fromSubscribable } from '../observable/fromSubscribable';

/**
* An object used to configure {@link connect} operator.
*/
export interface ConnectConfig<T> {
/**
* A factory function used to create the Subject through which the source
Expand Down
4 changes: 2 additions & 2 deletions src/internal/operators/groupBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { ObservableInput, Observer, OperatorFunction, SubjectLike } from '../typ
import { operate } from '../util/lift';
import { OperatorSubscriber } from './OperatorSubscriber';

interface BasicGroupByOptions<K, T> {
export interface BasicGroupByOptions<K, T> {
element?: undefined;
duration?: (grouped: GroupedObservable<K, T>) => ObservableInput<any>;
connector?: () => SubjectLike<T>;
}

interface GroupByOptionsWithElement<K, E, T> {
export interface GroupByOptionsWithElement<K, E, T> {
element: (value: T) => E;
duration?: (grouped: GroupedObservable<K, E>) => ObservableInput<any>;
connector?: () => SubjectLike<E>;
Expand Down
3 changes: 2 additions & 1 deletion src/internal/operators/throttle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ export const defaultThrottleConfig: ThrottleConfig = {
*/
export function throttle<T>(
durationSelector: (value: T) => ObservableInput<any>,
{ leading, trailing }: ThrottleConfig = defaultThrottleConfig
config: ThrottleConfig = defaultThrottleConfig
): MonoTypeOperatorFunction<T> {
return operate((source, subscriber) => {
const { leading, trailing } = config;
let hasValue = false;
let sendValue: T | null = null;
let throttled: Subscription | null = null;
Expand Down
2 changes: 1 addition & 1 deletion src/internal/operators/timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface TimeoutConfig<T, O extends ObservableInput<unknown> = Observabl

/**
* A factory used to create observable to switch to when timeout occurs. Provides
* some information about the source observable's emissions and what delay or
* a {@link TimeoutInfo} about the source observable's emissions and what delay or
* exact time triggered the timeout.
*/
with?: (info: TimeoutInfo<T, M>) => O;
Expand Down
14 changes: 7 additions & 7 deletions src/operators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export { concatAll } from '../internal/operators/concatAll';
export { concatMap } from '../internal/operators/concatMap';
export { concatMapTo } from '../internal/operators/concatMapTo';
export { concatWith } from '../internal/operators/concatWith';
export { connect } from '../internal/operators/connect';
export { connect, ConnectConfig } from '../internal/operators/connect';
export { count } from '../internal/operators/count';
export { debounce } from '../internal/operators/debounce';
export { debounceTime } from '../internal/operators/debounceTime';
Expand All @@ -39,7 +39,7 @@ export { finalize } from '../internal/operators/finalize';
export { find } from '../internal/operators/find';
export { findIndex } from '../internal/operators/findIndex';
export { first } from '../internal/operators/first';
export { groupBy } from '../internal/operators/groupBy';
export { groupBy, BasicGroupByOptions, GroupByOptionsWithElement } from '../internal/operators/groupBy';
export { ignoreElements } from '../internal/operators/ignoreElements';
export { isEmpty } from '../internal/operators/isEmpty';
export { last } from '../internal/operators/last';
Expand Down Expand Up @@ -70,15 +70,15 @@ export { raceWith } from '../internal/operators/raceWith';
export { reduce } from '../internal/operators/reduce';
export { repeat } from '../internal/operators/repeat';
export { repeatWhen } from '../internal/operators/repeatWhen';
export { retry } from '../internal/operators/retry';
export { retry, RetryConfig } from '../internal/operators/retry';
export { retryWhen } from '../internal/operators/retryWhen';
export { refCount } from '../internal/operators/refCount';
export { sample } from '../internal/operators/sample';
export { sampleTime } from '../internal/operators/sampleTime';
export { scan } from '../internal/operators/scan';
export { sequenceEqual } from '../internal/operators/sequenceEqual';
export { share } from '../internal/operators/share';
export { shareReplay } from '../internal/operators/shareReplay';
export { share, ShareConfig } from '../internal/operators/share';
export { shareReplay, ShareReplayConfig } from '../internal/operators/shareReplay';
export { single } from '../internal/operators/single';
export { skip } from '../internal/operators/skip';
export { skipLast } from '../internal/operators/skipLast';
Expand All @@ -95,11 +95,11 @@ export { takeLast } from '../internal/operators/takeLast';
export { takeUntil } from '../internal/operators/takeUntil';
export { takeWhile } from '../internal/operators/takeWhile';
export { tap } from '../internal/operators/tap';
export { throttle } from '../internal/operators/throttle';
export { throttle, ThrottleConfig } from '../internal/operators/throttle';
export { throttleTime } from '../internal/operators/throttleTime';
export { throwIfEmpty } from '../internal/operators/throwIfEmpty';
export { timeInterval } from '../internal/operators/timeInterval';
export { timeout } from '../internal/operators/timeout';
export { timeout, TimeoutConfig, TimeoutInfo } from '../internal/operators/timeout';
export { timeoutWith } from '../internal/operators/timeoutWith';
export { timestamp } from '../internal/operators/timestamp';
export { toArray } from '../internal/operators/toArray';
Expand Down

0 comments on commit 5e78bc4

Please sign in to comment.