@mastra/nestjs 0.1.8-alpha.0 → 0.1.8-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/_types/rxjs/dist/types/index.d.ts +173 -0
- package/dist/_types/rxjs/dist/types/internal/AnyCatcher.d.ts +10 -0
- package/dist/_types/rxjs/dist/types/internal/AsyncSubject.d.ts +15 -0
- package/dist/_types/rxjs/dist/types/internal/BehaviorSubject.d.ts +15 -0
- package/dist/_types/rxjs/dist/types/internal/Notification.d.ts +180 -0
- package/dist/_types/rxjs/dist/types/internal/Observable.d.ts +128 -0
- package/dist/_types/rxjs/dist/types/internal/Operator.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/ReplaySubject.d.ts +49 -0
- package/dist/_types/rxjs/dist/types/internal/Scheduler.d.ts +55 -0
- package/dist/_types/rxjs/dist/types/internal/Subject.d.ts +58 -0
- package/dist/_types/rxjs/dist/types/internal/Subscriber.d.ts +78 -0
- package/dist/_types/rxjs/dist/types/internal/Subscription.d.ts +96 -0
- package/dist/_types/rxjs/dist/types/internal/config.d.ts +73 -0
- package/dist/_types/rxjs/dist/types/internal/firstValueFrom.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/lastValueFrom.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/observable/ConnectableObservable.d.ts +42 -0
- package/dist/_types/rxjs/dist/types/internal/observable/bindCallback.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/observable/bindNodeCallback.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/observable/combineLatest.d.ts +33 -0
- package/dist/_types/rxjs/dist/types/internal/observable/concat.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/observable/connectable.d.ts +27 -0
- package/dist/_types/rxjs/dist/types/internal/observable/defer.d.ts +52 -0
- package/dist/_types/rxjs/dist/types/internal/observable/dom/animationFrames.d.ts +76 -0
- package/dist/_types/rxjs/dist/types/internal/observable/empty.d.ts +72 -0
- package/dist/_types/rxjs/dist/types/internal/observable/forkJoin.d.ts +24 -0
- package/dist/_types/rxjs/dist/types/internal/observable/from.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/observable/fromEvent.d.ts +45 -0
- package/dist/_types/rxjs/dist/types/internal/observable/fromEventPattern.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/observable/generate.d.ts +311 -0
- package/dist/_types/rxjs/dist/types/internal/observable/iif.d.ts +82 -0
- package/dist/_types/rxjs/dist/types/internal/observable/interval.d.ts +49 -0
- package/dist/_types/rxjs/dist/types/internal/observable/merge.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/observable/never.d.ts +40 -0
- package/dist/_types/rxjs/dist/types/internal/observable/of.d.ts +14 -0
- package/dist/_types/rxjs/dist/types/internal/observable/onErrorResumeNext.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/observable/pairs.d.ts +19 -0
- package/dist/_types/rxjs/dist/types/internal/observable/partition.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/observable/race.d.ts +12 -0
- package/dist/_types/rxjs/dist/types/internal/observable/range.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/observable/throwError.d.ts +115 -0
- package/dist/_types/rxjs/dist/types/internal/observable/timer.d.ts +126 -0
- package/dist/_types/rxjs/dist/types/internal/observable/using.d.ts +32 -0
- package/dist/_types/rxjs/dist/types/internal/observable/zip.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/operators/audit.d.ts +48 -0
- package/dist/_types/rxjs/dist/types/internal/operators/auditTime.d.ts +50 -0
- package/dist/_types/rxjs/dist/types/internal/operators/buffer.d.ts +41 -0
- package/dist/_types/rxjs/dist/types/internal/operators/bufferCount.d.ts +54 -0
- package/dist/_types/rxjs/dist/types/internal/operators/bufferTime.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/operators/bufferToggle.d.ts +46 -0
- package/dist/_types/rxjs/dist/types/internal/operators/bufferWhen.d.ts +41 -0
- package/dist/_types/rxjs/dist/types/internal/operators/catchError.d.ts +4 -0
- package/dist/_types/rxjs/dist/types/internal/operators/combineAll.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/operators/combineLatestAll.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/operators/combineLatestWith.d.ts +43 -0
- package/dist/_types/rxjs/dist/types/internal/operators/concatAll.d.ts +59 -0
- package/dist/_types/rxjs/dist/types/internal/operators/concatMap.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/operators/concatMapTo.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/operators/concatWith.d.ts +43 -0
- package/dist/_types/rxjs/dist/types/internal/operators/connect.d.ts +87 -0
- package/dist/_types/rxjs/dist/types/internal/operators/count.d.ts +58 -0
- package/dist/_types/rxjs/dist/types/internal/operators/debounce.d.ts +61 -0
- package/dist/_types/rxjs/dist/types/internal/operators/debounceTime.d.ts +60 -0
- package/dist/_types/rxjs/dist/types/internal/operators/defaultIfEmpty.d.ts +38 -0
- package/dist/_types/rxjs/dist/types/internal/operators/delay.d.ts +59 -0
- package/dist/_types/rxjs/dist/types/internal/operators/delayWhen.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/operators/dematerialize.d.ts +51 -0
- package/dist/_types/rxjs/dist/types/internal/operators/distinct.d.ts +60 -0
- package/dist/_types/rxjs/dist/types/internal/operators/distinctUntilChanged.d.ts +4 -0
- package/dist/_types/rxjs/dist/types/internal/operators/distinctUntilKeyChanged.d.ts +4 -0
- package/dist/_types/rxjs/dist/types/internal/operators/elementAt.d.ts +51 -0
- package/dist/_types/rxjs/dist/types/internal/operators/endWith.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/operators/every.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/operators/exhaust.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/operators/exhaustAll.d.ts +47 -0
- package/dist/_types/rxjs/dist/types/internal/operators/exhaustMap.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/operators/expand.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/operators/filter.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/operators/finalize.d.ts +64 -0
- package/dist/_types/rxjs/dist/types/internal/operators/find.d.ts +12 -0
- package/dist/_types/rxjs/dist/types/internal/operators/findIndex.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/operators/first.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/operators/flatMap.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/operators/groupBy.d.ts +119 -0
- package/dist/_types/rxjs/dist/types/internal/operators/ignoreElements.d.ts +38 -0
- package/dist/_types/rxjs/dist/types/internal/operators/isEmpty.d.ts +64 -0
- package/dist/_types/rxjs/dist/types/internal/operators/last.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/operators/map.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/operators/mapTo.d.ts +10 -0
- package/dist/_types/rxjs/dist/types/internal/operators/materialize.d.ts +52 -0
- package/dist/_types/rxjs/dist/types/internal/operators/max.d.ts +49 -0
- package/dist/_types/rxjs/dist/types/internal/operators/mergeAll.d.ts +62 -0
- package/dist/_types/rxjs/dist/types/internal/operators/mergeMap.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/operators/mergeMapTo.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/operators/mergeScan.d.ts +69 -0
- package/dist/_types/rxjs/dist/types/internal/operators/mergeWith.d.ts +44 -0
- package/dist/_types/rxjs/dist/types/internal/operators/min.d.ts +49 -0
- package/dist/_types/rxjs/dist/types/internal/operators/multicast.d.ts +63 -0
- package/dist/_types/rxjs/dist/types/internal/operators/observeOn.d.ts +56 -0
- package/dist/_types/rxjs/dist/types/internal/operators/onErrorResumeNextWith.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/operators/pairwise.d.ts +46 -0
- package/dist/_types/rxjs/dist/types/internal/operators/pluck.d.ts +18 -0
- package/dist/_types/rxjs/dist/types/internal/operators/publish.d.ts +30 -0
- package/dist/_types/rxjs/dist/types/internal/operators/publishBehavior.d.ts +19 -0
- package/dist/_types/rxjs/dist/types/internal/operators/publishLast.d.ts +69 -0
- package/dist/_types/rxjs/dist/types/internal/operators/publishReplay.d.ts +56 -0
- package/dist/_types/rxjs/dist/types/internal/operators/raceWith.d.ts +29 -0
- package/dist/_types/rxjs/dist/types/internal/operators/reduce.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/operators/refCount.d.ts +61 -0
- package/dist/_types/rxjs/dist/types/internal/operators/repeat.d.ts +108 -0
- package/dist/_types/rxjs/dist/types/internal/operators/repeatWhen.d.ts +38 -0
- package/dist/_types/rxjs/dist/types/internal/operators/retry.d.ts +28 -0
- package/dist/_types/rxjs/dist/types/internal/operators/retryWhen.d.ts +61 -0
- package/dist/_types/rxjs/dist/types/internal/operators/sample.d.ts +43 -0
- package/dist/_types/rxjs/dist/types/internal/operators/sampleTime.d.ts +46 -0
- package/dist/_types/rxjs/dist/types/internal/operators/scan.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/operators/sequenceEqual.d.ts +60 -0
- package/dist/_types/rxjs/dist/types/internal/operators/share.d.ts +43 -0
- package/dist/_types/rxjs/dist/types/internal/operators/shareReplay.d.ts +10 -0
- package/dist/_types/rxjs/dist/types/internal/operators/single.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/operators/skip.d.ts +36 -0
- package/dist/_types/rxjs/dist/types/internal/operators/skipLast.d.ts +45 -0
- package/dist/_types/rxjs/dist/types/internal/operators/skipUntil.d.ts +48 -0
- package/dist/_types/rxjs/dist/types/internal/operators/skipWhile.d.ts +5 -0
- package/dist/_types/rxjs/dist/types/internal/operators/startWith.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/operators/subscribeOn.d.ts +62 -0
- package/dist/_types/rxjs/dist/types/internal/operators/switchAll.d.ts +61 -0
- package/dist/_types/rxjs/dist/types/internal/operators/switchMap.d.ts +7 -0
- package/dist/_types/rxjs/dist/types/internal/operators/switchMapTo.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/operators/switchScan.d.ts +20 -0
- package/dist/_types/rxjs/dist/types/internal/operators/take.d.ts +45 -0
- package/dist/_types/rxjs/dist/types/internal/operators/takeLast.d.ts +42 -0
- package/dist/_types/rxjs/dist/types/internal/operators/takeUntil.d.ts +42 -0
- package/dist/_types/rxjs/dist/types/internal/operators/takeWhile.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/operators/tap.d.ts +72 -0
- package/dist/_types/rxjs/dist/types/internal/operators/throttle.d.ts +78 -0
- package/dist/_types/rxjs/dist/types/internal/operators/throttleTime.d.ts +53 -0
- package/dist/_types/rxjs/dist/types/internal/operators/throwIfEmpty.d.ts +39 -0
- package/dist/_types/rxjs/dist/types/internal/operators/timeInterval.d.ts +50 -0
- package/dist/_types/rxjs/dist/types/internal/operators/timeout.d.ts +257 -0
- package/dist/_types/rxjs/dist/types/internal/operators/timeoutWith.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/operators/timestamp.d.ts +35 -0
- package/dist/_types/rxjs/dist/types/internal/operators/toArray.d.ts +33 -0
- package/dist/_types/rxjs/dist/types/internal/operators/window.d.ts +48 -0
- package/dist/_types/rxjs/dist/types/internal/operators/windowCount.d.ts +66 -0
- package/dist/_types/rxjs/dist/types/internal/operators/windowTime.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/operators/windowToggle.d.ts +51 -0
- package/dist/_types/rxjs/dist/types/internal/operators/windowWhen.d.ts +48 -0
- package/dist/_types/rxjs/dist/types/internal/operators/withLatestFrom.d.ts +4 -0
- package/dist/_types/rxjs/dist/types/internal/operators/zipAll.d.ts +14 -0
- package/dist/_types/rxjs/dist/types/internal/operators/zipWith.d.ts +26 -0
- package/dist/_types/rxjs/dist/types/internal/scheduled/scheduled.d.ts +15 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/Action.d.ts +32 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/AnimationFrameScheduler.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/AsapScheduler.d.ts +6 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/AsyncAction.d.ts +25 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/AsyncScheduler.d.ts +9 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/QueueScheduler.d.ts +4 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/VirtualTimeScheduler.d.ts +49 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/animationFrame.d.ts +38 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/asap.d.ts +41 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/async.d.ts +53 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/queue.d.ts +69 -0
- package/dist/_types/rxjs/dist/types/internal/scheduler/timerHandle.d.ts +2 -0
- package/dist/_types/rxjs/dist/types/internal/symbol/observable.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/types.d.ts +301 -0
- package/dist/_types/rxjs/dist/types/internal/util/ArgumentOutOfRangeError.d.ts +21 -0
- package/dist/_types/rxjs/dist/types/internal/util/EmptyError.d.ts +23 -0
- package/dist/_types/rxjs/dist/types/internal/util/NotFoundError.d.ts +19 -0
- package/dist/_types/rxjs/dist/types/internal/util/ObjectUnsubscribedError.d.ts +20 -0
- package/dist/_types/rxjs/dist/types/internal/util/SequenceError.d.ts +19 -0
- package/dist/_types/rxjs/dist/types/internal/util/UnsubscriptionError.d.ts +16 -0
- package/dist/_types/rxjs/dist/types/internal/util/identity.d.ts +44 -0
- package/dist/_types/rxjs/dist/types/internal/util/isObservable.d.ts +8 -0
- package/dist/_types/rxjs/dist/types/internal/util/noop.d.ts +2 -0
- package/dist/_types/rxjs/dist/types/internal/util/pipe.d.ts +14 -0
- package/dist/index.cjs +3 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -226
- package/dist/index.js.map +1 -1
- package/dist/interceptors/request-tracking.interceptor.d.ts +1 -1
- package/dist/interceptors/streaming.interceptor.d.ts +1 -1
- package/dist/interceptors/tracing.interceptor.d.ts +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Observable } from '../Observable';
|
|
2
|
+
import { SchedulerLike } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.
|
|
5
|
+
*/
|
|
6
|
+
export declare function pairs<T>(arr: readonly T[], scheduler?: SchedulerLike): Observable<[string, T]>;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.
|
|
9
|
+
*/
|
|
10
|
+
export declare function pairs<O extends Record<string, unknown>>(obj: O, scheduler?: SchedulerLike): Observable<[keyof O, O[keyof O]]>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.
|
|
13
|
+
*/
|
|
14
|
+
export declare function pairs<T>(iterable: Iterable<T>, scheduler?: SchedulerLike): Observable<[string, T]>;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8.
|
|
17
|
+
*/
|
|
18
|
+
export declare function pairs(n: number | bigint | boolean | ((...args: any[]) => any) | symbol, scheduler?: SchedulerLike): Observable<[never, never]>;
|
|
19
|
+
//# sourceMappingURL=pairs.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ObservableInput } from '../types';
|
|
2
|
+
import { Observable } from '../Observable';
|
|
3
|
+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
|
4
|
+
export declare function partition<T, U extends T, A>(source: ObservableInput<T>, predicate: (this: A, value: T, index: number) => value is U, thisArg: A): [Observable<U>, Observable<Exclude<T, U>>];
|
|
5
|
+
export declare function partition<T, U extends T>(source: ObservableInput<T>, predicate: (value: T, index: number) => value is U): [Observable<U>, Observable<Exclude<T, U>>];
|
|
6
|
+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
|
|
7
|
+
export declare function partition<T, A>(source: ObservableInput<T>, predicate: (this: A, value: T, index: number) => boolean, thisArg: A): [Observable<T>, Observable<T>];
|
|
8
|
+
export declare function partition<T>(source: ObservableInput<T>, predicate: (value: T, index: number) => boolean): [Observable<T>, Observable<T>];
|
|
9
|
+
//# sourceMappingURL=partition.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Observable } from '../Observable';
|
|
2
|
+
import { ObservableInput, ObservableInputTuple } from '../types';
|
|
3
|
+
import { Subscriber } from '../Subscriber';
|
|
4
|
+
export declare function race<T extends readonly unknown[]>(inputs: [...ObservableInputTuple<T>]): Observable<T[number]>;
|
|
5
|
+
export declare function race<T extends readonly unknown[]>(...inputs: [...ObservableInputTuple<T>]): Observable<T[number]>;
|
|
6
|
+
/**
|
|
7
|
+
* An observable initializer function for both the static version and the
|
|
8
|
+
* operator version of race.
|
|
9
|
+
* @param sources The sources to race
|
|
10
|
+
*/
|
|
11
|
+
export declare function raceInit<T>(sources: ObservableInput<T>[]): (subscriber: Subscriber<T>) => void;
|
|
12
|
+
//# sourceMappingURL=race.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SchedulerLike } from '../types';
|
|
2
|
+
import { Observable } from '../Observable';
|
|
3
|
+
export declare function range(start: number, count?: number): Observable<number>;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated The `scheduler` parameter will be removed in v8. Use `range(start, count).pipe(observeOn(scheduler))` instead. Details: Details: https://rxjs.dev/deprecations/scheduler-argument
|
|
6
|
+
*/
|
|
7
|
+
export declare function range(start: number, count: number | undefined, scheduler: SchedulerLike): Observable<number>;
|
|
8
|
+
//# sourceMappingURL=range.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Observable } from '../Observable';
|
|
2
|
+
import { SchedulerLike } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an observable that will create an error instance and push it to the consumer as an error
|
|
5
|
+
* immediately upon subscription.
|
|
6
|
+
*
|
|
7
|
+
* <span class="informal">Just errors and does nothing else</span>
|
|
8
|
+
*
|
|
9
|
+
* 
|
|
10
|
+
*
|
|
11
|
+
* This creation function is useful for creating an observable that will create an error and error every
|
|
12
|
+
* time it is subscribed to. Generally, inside of most operators when you might want to return an errored
|
|
13
|
+
* observable, this is unnecessary. In most cases, such as in the inner return of {@link concatMap},
|
|
14
|
+
* {@link mergeMap}, {@link defer}, and many others, you can simply throw the error, and RxJS will pick
|
|
15
|
+
* that up and notify the consumer of the error.
|
|
16
|
+
*
|
|
17
|
+
* ## Example
|
|
18
|
+
*
|
|
19
|
+
* Create a simple observable that will create a new error with a timestamp and log it
|
|
20
|
+
* and the message every time you subscribe to it
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { throwError } from 'rxjs';
|
|
24
|
+
*
|
|
25
|
+
* let errorCount = 0;
|
|
26
|
+
*
|
|
27
|
+
* const errorWithTimestamp$ = throwError(() => {
|
|
28
|
+
* const error: any = new Error(`This is error number ${ ++errorCount }`);
|
|
29
|
+
* error.timestamp = Date.now();
|
|
30
|
+
* return error;
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* errorWithTimestamp$.subscribe({
|
|
34
|
+
* error: err => console.log(err.timestamp, err.message)
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* errorWithTimestamp$.subscribe({
|
|
38
|
+
* error: err => console.log(err.timestamp, err.message)
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Logs the timestamp and a new error message for each subscription
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* ### Unnecessary usage
|
|
45
|
+
*
|
|
46
|
+
* Using `throwError` inside of an operator or creation function
|
|
47
|
+
* with a callback, is usually not necessary
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { of, concatMap, timer, throwError } from 'rxjs';
|
|
51
|
+
*
|
|
52
|
+
* const delays$ = of(1000, 2000, Infinity, 3000);
|
|
53
|
+
*
|
|
54
|
+
* delays$.pipe(
|
|
55
|
+
* concatMap(ms => {
|
|
56
|
+
* if (ms < 10000) {
|
|
57
|
+
* return timer(ms);
|
|
58
|
+
* } else {
|
|
59
|
+
* // This is probably overkill.
|
|
60
|
+
* return throwError(() => new Error(`Invalid time ${ ms }`));
|
|
61
|
+
* }
|
|
62
|
+
* })
|
|
63
|
+
* )
|
|
64
|
+
* .subscribe({
|
|
65
|
+
* next: console.log,
|
|
66
|
+
* error: console.error
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* You can just throw the error instead
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { of, concatMap, timer } from 'rxjs';
|
|
74
|
+
*
|
|
75
|
+
* const delays$ = of(1000, 2000, Infinity, 3000);
|
|
76
|
+
*
|
|
77
|
+
* delays$.pipe(
|
|
78
|
+
* concatMap(ms => {
|
|
79
|
+
* if (ms < 10000) {
|
|
80
|
+
* return timer(ms);
|
|
81
|
+
* } else {
|
|
82
|
+
* // Cleaner and easier to read for most folks.
|
|
83
|
+
* throw new Error(`Invalid time ${ ms }`);
|
|
84
|
+
* }
|
|
85
|
+
* })
|
|
86
|
+
* )
|
|
87
|
+
* .subscribe({
|
|
88
|
+
* next: console.log,
|
|
89
|
+
* error: console.error
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @param errorFactory A factory function that will create the error instance that is pushed.
|
|
94
|
+
*/
|
|
95
|
+
export declare function throwError(errorFactory: () => any): Observable<never>;
|
|
96
|
+
/**
|
|
97
|
+
* Returns an observable that will error with the specified error immediately upon subscription.
|
|
98
|
+
*
|
|
99
|
+
* @param error The error instance to emit
|
|
100
|
+
* @deprecated Support for passing an error value will be removed in v8. Instead, pass a factory function to `throwError(() => new Error('test'))`. This is
|
|
101
|
+
* because it will create the error at the moment it should be created and capture a more appropriate stack trace. If
|
|
102
|
+
* for some reason you need to create the error ahead of time, you can still do that: `const err = new Error('test'); throwError(() => err);`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function throwError(error: any): Observable<never>;
|
|
105
|
+
/**
|
|
106
|
+
* Notifies the consumer of an error using a given scheduler by scheduling it at delay `0` upon subscription.
|
|
107
|
+
*
|
|
108
|
+
* @param errorOrErrorFactory An error instance or error factory
|
|
109
|
+
* @param scheduler A scheduler to use to schedule the error notification
|
|
110
|
+
* @deprecated The `scheduler` parameter will be removed in v8.
|
|
111
|
+
* Use `throwError` in combination with {@link observeOn}: `throwError(() => new Error('test')).pipe(observeOn(scheduler));`.
|
|
112
|
+
* Details: https://rxjs.dev/deprecations/scheduler-argument
|
|
113
|
+
*/
|
|
114
|
+
export declare function throwError(errorOrErrorFactory: any, scheduler: SchedulerLike): Observable<never>;
|
|
115
|
+
//# sourceMappingURL=throwError.d.ts.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Observable } from '../Observable';
|
|
2
|
+
import { SchedulerLike } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an observable that will wait for a specified time period, or exact date, before
|
|
5
|
+
* emitting the number 0.
|
|
6
|
+
*
|
|
7
|
+
* <span class="informal">Used to emit a notification after a delay.</span>
|
|
8
|
+
*
|
|
9
|
+
* This observable is useful for creating delays in code, or racing against other values
|
|
10
|
+
* for ad-hoc timeouts.
|
|
11
|
+
*
|
|
12
|
+
* The `delay` is specified by default in milliseconds, however providing a custom scheduler could
|
|
13
|
+
* create a different behavior.
|
|
14
|
+
*
|
|
15
|
+
* ## Examples
|
|
16
|
+
*
|
|
17
|
+
* Wait 3 seconds and start another observable
|
|
18
|
+
*
|
|
19
|
+
* You might want to use `timer` to delay subscription to an
|
|
20
|
+
* observable by a set amount of time. Here we use a timer with
|
|
21
|
+
* {@link concatMapTo} or {@link concatMap} in order to wait
|
|
22
|
+
* a few seconds and start a subscription to a source.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { of, timer, concatMap } from 'rxjs';
|
|
26
|
+
*
|
|
27
|
+
* // This could be any observable
|
|
28
|
+
* const source = of(1, 2, 3);
|
|
29
|
+
*
|
|
30
|
+
* timer(3000)
|
|
31
|
+
* .pipe(concatMap(() => source))
|
|
32
|
+
* .subscribe(console.log);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* Take all values until the start of the next minute
|
|
36
|
+
*
|
|
37
|
+
* Using a `Date` as the trigger for the first emission, you can
|
|
38
|
+
* do things like wait until midnight to fire an event, or in this case,
|
|
39
|
+
* wait until a new minute starts (chosen so the example wouldn't take
|
|
40
|
+
* too long to run) in order to stop watching a stream. Leveraging
|
|
41
|
+
* {@link takeUntil}.
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { interval, takeUntil, timer } from 'rxjs';
|
|
45
|
+
*
|
|
46
|
+
* // Build a Date object that marks the
|
|
47
|
+
* // next minute.
|
|
48
|
+
* const currentDate = new Date();
|
|
49
|
+
* const startOfNextMinute = new Date(
|
|
50
|
+
* currentDate.getFullYear(),
|
|
51
|
+
* currentDate.getMonth(),
|
|
52
|
+
* currentDate.getDate(),
|
|
53
|
+
* currentDate.getHours(),
|
|
54
|
+
* currentDate.getMinutes() + 1
|
|
55
|
+
* );
|
|
56
|
+
*
|
|
57
|
+
* // This could be any observable stream
|
|
58
|
+
* const source = interval(1000);
|
|
59
|
+
*
|
|
60
|
+
* const result = source.pipe(
|
|
61
|
+
* takeUntil(timer(startOfNextMinute))
|
|
62
|
+
* );
|
|
63
|
+
*
|
|
64
|
+
* result.subscribe(console.log);
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* ### Known Limitations
|
|
68
|
+
*
|
|
69
|
+
* - The {@link asyncScheduler} uses `setTimeout` which has limitations for how far in the future it can be scheduled.
|
|
70
|
+
*
|
|
71
|
+
* - If a `scheduler` is provided that returns a timestamp other than an epoch from `now()`, and
|
|
72
|
+
* a `Date` object is passed to the `dueTime` argument, the calculation for when the first emission
|
|
73
|
+
* should occur will be incorrect. In this case, it would be best to do your own calculations
|
|
74
|
+
* ahead of time, and pass a `number` in as the `dueTime`.
|
|
75
|
+
*
|
|
76
|
+
* @param due If a `number`, the amount of time in milliseconds to wait before emitting.
|
|
77
|
+
* If a `Date`, the exact time at which to emit.
|
|
78
|
+
* @param scheduler The scheduler to use to schedule the delay. Defaults to {@link asyncScheduler}.
|
|
79
|
+
*/
|
|
80
|
+
export declare function timer(due: number | Date, scheduler?: SchedulerLike): Observable<0>;
|
|
81
|
+
/**
|
|
82
|
+
* Creates an observable that starts an interval after a specified delay, emitting incrementing numbers -- starting at `0` --
|
|
83
|
+
* on each interval after words.
|
|
84
|
+
*
|
|
85
|
+
* The `delay` and `intervalDuration` are specified by default in milliseconds, however providing a custom scheduler could
|
|
86
|
+
* create a different behavior.
|
|
87
|
+
*
|
|
88
|
+
* ## Example
|
|
89
|
+
*
|
|
90
|
+
* ### Start an interval that starts right away
|
|
91
|
+
*
|
|
92
|
+
* Since {@link interval} waits for the passed delay before starting,
|
|
93
|
+
* sometimes that's not ideal. You may want to start an interval immediately.
|
|
94
|
+
* `timer` works well for this. Here we have both side-by-side so you can
|
|
95
|
+
* see them in comparison.
|
|
96
|
+
*
|
|
97
|
+
* Note that this observable will never complete.
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { timer, interval } from 'rxjs';
|
|
101
|
+
*
|
|
102
|
+
* timer(0, 1000).subscribe(n => console.log('timer', n));
|
|
103
|
+
* interval(1000).subscribe(n => console.log('interval', n));
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* ### Known Limitations
|
|
107
|
+
*
|
|
108
|
+
* - The {@link asyncScheduler} uses `setTimeout` which has limitations for how far in the future it can be scheduled.
|
|
109
|
+
*
|
|
110
|
+
* - If a `scheduler` is provided that returns a timestamp other than an epoch from `now()`, and
|
|
111
|
+
* a `Date` object is passed to the `dueTime` argument, the calculation for when the first emission
|
|
112
|
+
* should occur will be incorrect. In this case, it would be best to do your own calculations
|
|
113
|
+
* ahead of time, and pass a `number` in as the `startDue`.
|
|
114
|
+
* @param startDue If a `number`, is the time to wait before starting the interval.
|
|
115
|
+
* If a `Date`, is the exact time at which to start the interval.
|
|
116
|
+
* @param intervalDuration The delay between each value emitted in the interval. Passing a
|
|
117
|
+
* negative number here will result in immediate completion after the first value is emitted, as though
|
|
118
|
+
* no `intervalDuration` was passed at all.
|
|
119
|
+
* @param scheduler The scheduler to use to schedule the delay. Defaults to {@link asyncScheduler}.
|
|
120
|
+
*/
|
|
121
|
+
export declare function timer(startDue: number | Date, intervalDuration: number, scheduler?: SchedulerLike): Observable<number>;
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated The signature allowing `undefined` to be passed for `intervalDuration` will be removed in v8. Use the `timer(dueTime, scheduler?)` signature instead.
|
|
124
|
+
*/
|
|
125
|
+
export declare function timer(dueTime: number | Date, unused: undefined, scheduler?: SchedulerLike): Observable<0>;
|
|
126
|
+
//# sourceMappingURL=timer.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Observable } from '../Observable';
|
|
2
|
+
import { Unsubscribable, ObservableInput, ObservedValueOf } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an Observable that uses a resource which will be disposed at the same time as the Observable.
|
|
5
|
+
*
|
|
6
|
+
* <span class="informal">Use it when you catch yourself cleaning up after an Observable.</span>
|
|
7
|
+
*
|
|
8
|
+
* `using` is a factory operator, which accepts two functions. First function returns a disposable resource.
|
|
9
|
+
* It can be an arbitrary object that implements `unsubscribe` method. Second function will be injected with
|
|
10
|
+
* that object and should return an Observable. That Observable can use resource object during its execution.
|
|
11
|
+
* Both functions passed to `using` will be called every time someone subscribes - neither an Observable nor
|
|
12
|
+
* resource object will be shared in any way between subscriptions.
|
|
13
|
+
*
|
|
14
|
+
* When Observable returned by `using` is subscribed, Observable returned from the second function will be subscribed
|
|
15
|
+
* as well. All its notifications (nexted values, completion and error events) will be emitted unchanged by the output
|
|
16
|
+
* Observable. If however someone unsubscribes from the Observable or source Observable completes or errors by itself,
|
|
17
|
+
* the `unsubscribe` method on resource object will be called. This can be used to do any necessary clean up, which
|
|
18
|
+
* otherwise would have to be handled by hand. Note that complete or error notifications are not emitted when someone
|
|
19
|
+
* cancels subscription to an Observable via `unsubscribe`, so `using` can be used as a hook, allowing you to make
|
|
20
|
+
* sure that all resources which need to exist during an Observable execution will be disposed at appropriate time.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link defer}
|
|
23
|
+
*
|
|
24
|
+
* @param {function(): ISubscription} resourceFactory A function which creates any resource object
|
|
25
|
+
* that implements `unsubscribe` method.
|
|
26
|
+
* @param {function(resource: ISubscription): Observable<T>} observableFactory A function which
|
|
27
|
+
* creates an Observable, that can use injected resource object.
|
|
28
|
+
* @return {Observable<T>} An Observable that behaves the same as Observable returned by `observableFactory`, but
|
|
29
|
+
* which - when completed, errored or unsubscribed - will also call `unsubscribe` on created resource object.
|
|
30
|
+
*/
|
|
31
|
+
export declare function using<T extends ObservableInput<any>>(resourceFactory: () => Unsubscribable | void, observableFactory: (resource: Unsubscribable | void) => T | void): Observable<ObservedValueOf<T>>;
|
|
32
|
+
//# sourceMappingURL=using.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Observable } from '../Observable';
|
|
2
|
+
import { ObservableInputTuple } from '../types';
|
|
3
|
+
export declare function zip<A extends readonly unknown[]>(sources: [...ObservableInputTuple<A>]): Observable<A>;
|
|
4
|
+
export declare function zip<A extends readonly unknown[], R>(sources: [...ObservableInputTuple<A>], resultSelector: (...values: A) => R): Observable<R>;
|
|
5
|
+
export declare function zip<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A>;
|
|
6
|
+
export declare function zip<A extends readonly unknown[], R>(...sourcesAndResultSelector: [...ObservableInputTuple<A>, (...values: A) => R]): Observable<R>;
|
|
7
|
+
//# sourceMappingURL=zip.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MonoTypeOperatorFunction, ObservableInput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Ignores source values for a duration determined by another Observable, then
|
|
4
|
+
* emits the most recent value from the source Observable, then repeats this
|
|
5
|
+
* process.
|
|
6
|
+
*
|
|
7
|
+
* <span class="informal">It's like {@link auditTime}, but the silencing
|
|
8
|
+
* duration is determined by a second Observable.</span>
|
|
9
|
+
*
|
|
10
|
+
* 
|
|
11
|
+
*
|
|
12
|
+
* `audit` is similar to `throttle`, but emits the last value from the silenced
|
|
13
|
+
* time window, instead of the first value. `audit` emits the most recent value
|
|
14
|
+
* from the source Observable on the output Observable as soon as its internal
|
|
15
|
+
* timer becomes disabled, and ignores source values while the timer is enabled.
|
|
16
|
+
* Initially, the timer is disabled. As soon as the first source value arrives,
|
|
17
|
+
* the timer is enabled by calling the `durationSelector` function with the
|
|
18
|
+
* source value, which returns the "duration" Observable. When the duration
|
|
19
|
+
* Observable emits a value, the timer is disabled, then the most
|
|
20
|
+
* recent source value is emitted on the output Observable, and this process
|
|
21
|
+
* repeats for the next source value.
|
|
22
|
+
*
|
|
23
|
+
* ## Example
|
|
24
|
+
*
|
|
25
|
+
* Emit clicks at a rate of at most one click per second
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { fromEvent, audit, interval } from 'rxjs';
|
|
29
|
+
*
|
|
30
|
+
* const clicks = fromEvent(document, 'click');
|
|
31
|
+
* const result = clicks.pipe(audit(ev => interval(1000)));
|
|
32
|
+
* result.subscribe(x => console.log(x));
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link auditTime}
|
|
36
|
+
* @see {@link debounce}
|
|
37
|
+
* @see {@link delayWhen}
|
|
38
|
+
* @see {@link sample}
|
|
39
|
+
* @see {@link throttle}
|
|
40
|
+
*
|
|
41
|
+
* @param durationSelector A function
|
|
42
|
+
* that receives a value from the source Observable, for computing the silencing
|
|
43
|
+
* duration, returned as an Observable or a Promise.
|
|
44
|
+
* @return A function that returns an Observable that performs rate-limiting of
|
|
45
|
+
* emissions from the source Observable.
|
|
46
|
+
*/
|
|
47
|
+
export declare function audit<T>(durationSelector: (value: T) => ObservableInput<any>): MonoTypeOperatorFunction<T>;
|
|
48
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Ignores source values for `duration` milliseconds, then emits the most recent
|
|
4
|
+
* value from the source Observable, then repeats this process.
|
|
5
|
+
*
|
|
6
|
+
* <span class="informal">When it sees a source value, it ignores that plus
|
|
7
|
+
* the next ones for `duration` milliseconds, and then it emits the most recent
|
|
8
|
+
* value from the source.</span>
|
|
9
|
+
*
|
|
10
|
+
* 
|
|
11
|
+
*
|
|
12
|
+
* `auditTime` is similar to `throttleTime`, but emits the last value from the
|
|
13
|
+
* silenced time window, instead of the first value. `auditTime` emits the most
|
|
14
|
+
* recent value from the source Observable on the output Observable as soon as
|
|
15
|
+
* its internal timer becomes disabled, and ignores source values while the
|
|
16
|
+
* timer is enabled. Initially, the timer is disabled. As soon as the first
|
|
17
|
+
* source value arrives, the timer is enabled. After `duration` milliseconds (or
|
|
18
|
+
* the time unit determined internally by the optional `scheduler`) has passed,
|
|
19
|
+
* the timer is disabled, then the most recent source value is emitted on the
|
|
20
|
+
* output Observable, and this process repeats for the next source value.
|
|
21
|
+
* Optionally takes a {@link SchedulerLike} for managing timers.
|
|
22
|
+
*
|
|
23
|
+
* ## Example
|
|
24
|
+
*
|
|
25
|
+
* Emit clicks at a rate of at most one click per second
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { fromEvent, auditTime } from 'rxjs';
|
|
29
|
+
*
|
|
30
|
+
* const clicks = fromEvent(document, 'click');
|
|
31
|
+
* const result = clicks.pipe(auditTime(1000));
|
|
32
|
+
* result.subscribe(x => console.log(x));
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link audit}
|
|
36
|
+
* @see {@link debounceTime}
|
|
37
|
+
* @see {@link delay}
|
|
38
|
+
* @see {@link sampleTime}
|
|
39
|
+
* @see {@link throttleTime}
|
|
40
|
+
*
|
|
41
|
+
* @param {number} duration Time to wait before emitting the most recent source
|
|
42
|
+
* value, measured in milliseconds or the time unit determined internally
|
|
43
|
+
* by the optional `scheduler`.
|
|
44
|
+
* @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
|
|
45
|
+
* managing the timers that handle the rate-limiting behavior.
|
|
46
|
+
* @return A function that returns an Observable that performs rate-limiting of
|
|
47
|
+
* emissions from the source Observable.
|
|
48
|
+
*/
|
|
49
|
+
export declare function auditTime<T>(duration: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
|
|
50
|
+
//# sourceMappingURL=auditTime.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { OperatorFunction, ObservableInput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Buffers the source Observable values until `closingNotifier` emits.
|
|
4
|
+
*
|
|
5
|
+
* <span class="informal">Collects values from the past as an array, and emits
|
|
6
|
+
* that array only when another Observable emits.</span>
|
|
7
|
+
*
|
|
8
|
+
* 
|
|
9
|
+
*
|
|
10
|
+
* Buffers the incoming Observable values until the given `closingNotifier`
|
|
11
|
+
* `ObservableInput` (that internally gets converted to an Observable)
|
|
12
|
+
* emits a value, at which point it emits the buffer on the output
|
|
13
|
+
* Observable and starts a new buffer internally, awaiting the next time
|
|
14
|
+
* `closingNotifier` emits.
|
|
15
|
+
*
|
|
16
|
+
* ## Example
|
|
17
|
+
*
|
|
18
|
+
* On every click, emit array of most recent interval events
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { fromEvent, interval, buffer } from 'rxjs';
|
|
22
|
+
*
|
|
23
|
+
* const clicks = fromEvent(document, 'click');
|
|
24
|
+
* const intervalEvents = interval(1000);
|
|
25
|
+
* const buffered = intervalEvents.pipe(buffer(clicks));
|
|
26
|
+
* buffered.subscribe(x => console.log(x));
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @see {@link bufferCount}
|
|
30
|
+
* @see {@link bufferTime}
|
|
31
|
+
* @see {@link bufferToggle}
|
|
32
|
+
* @see {@link bufferWhen}
|
|
33
|
+
* @see {@link window}
|
|
34
|
+
*
|
|
35
|
+
* @param closingNotifier An `ObservableInput` that signals the
|
|
36
|
+
* buffer to be emitted on the output Observable.
|
|
37
|
+
* @return A function that returns an Observable of buffers, which are arrays
|
|
38
|
+
* of values.
|
|
39
|
+
*/
|
|
40
|
+
export declare function buffer<T>(closingNotifier: ObservableInput<any>): OperatorFunction<T, T[]>;
|
|
41
|
+
//# sourceMappingURL=buffer.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { OperatorFunction } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Buffers the source Observable values until the size hits the maximum
|
|
4
|
+
* `bufferSize` given.
|
|
5
|
+
*
|
|
6
|
+
* <span class="informal">Collects values from the past as an array, and emits
|
|
7
|
+
* that array only when its size reaches `bufferSize`.</span>
|
|
8
|
+
*
|
|
9
|
+
* 
|
|
10
|
+
*
|
|
11
|
+
* Buffers a number of values from the source Observable by `bufferSize` then
|
|
12
|
+
* emits the buffer and clears it, and starts a new buffer each
|
|
13
|
+
* `startBufferEvery` values. If `startBufferEvery` is not provided or is
|
|
14
|
+
* `null`, then new buffers are started immediately at the start of the source
|
|
15
|
+
* and when each buffer closes and is emitted.
|
|
16
|
+
*
|
|
17
|
+
* ## Examples
|
|
18
|
+
*
|
|
19
|
+
* Emit the last two click events as an array
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { fromEvent, bufferCount } from 'rxjs';
|
|
23
|
+
*
|
|
24
|
+
* const clicks = fromEvent(document, 'click');
|
|
25
|
+
* const buffered = clicks.pipe(bufferCount(2));
|
|
26
|
+
* buffered.subscribe(x => console.log(x));
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* On every click, emit the last two click events as an array
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { fromEvent, bufferCount } from 'rxjs';
|
|
33
|
+
*
|
|
34
|
+
* const clicks = fromEvent(document, 'click');
|
|
35
|
+
* const buffered = clicks.pipe(bufferCount(2, 1));
|
|
36
|
+
* buffered.subscribe(x => console.log(x));
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @see {@link buffer}
|
|
40
|
+
* @see {@link bufferTime}
|
|
41
|
+
* @see {@link bufferToggle}
|
|
42
|
+
* @see {@link bufferWhen}
|
|
43
|
+
* @see {@link pairwise}
|
|
44
|
+
* @see {@link windowCount}
|
|
45
|
+
*
|
|
46
|
+
* @param {number} bufferSize The maximum size of the buffer emitted.
|
|
47
|
+
* @param {number} [startBufferEvery] Interval at which to start a new buffer.
|
|
48
|
+
* For example if `startBufferEvery` is `2`, then a new buffer will be started
|
|
49
|
+
* on every other value from the source. A new buffer is started at the
|
|
50
|
+
* beginning of the source by default.
|
|
51
|
+
* @return A function that returns an Observable of arrays of buffered values.
|
|
52
|
+
*/
|
|
53
|
+
export declare function bufferCount<T>(bufferSize: number, startBufferEvery?: number | null): OperatorFunction<T, T[]>;
|
|
54
|
+
//# sourceMappingURL=bufferCount.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OperatorFunction, SchedulerLike } from '../types';
|
|
2
|
+
export declare function bufferTime<T>(bufferTimeSpan: number, scheduler?: SchedulerLike): OperatorFunction<T, T[]>;
|
|
3
|
+
export declare function bufferTime<T>(bufferTimeSpan: number, bufferCreationInterval: number | null | undefined, scheduler?: SchedulerLike): OperatorFunction<T, T[]>;
|
|
4
|
+
export declare function bufferTime<T>(bufferTimeSpan: number, bufferCreationInterval: number | null | undefined, maxBufferSize: number, scheduler?: SchedulerLike): OperatorFunction<T, T[]>;
|
|
5
|
+
//# sourceMappingURL=bufferTime.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { OperatorFunction, ObservableInput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Buffers the source Observable values starting from an emission from
|
|
4
|
+
* `openings` and ending when the output of `closingSelector` emits.
|
|
5
|
+
*
|
|
6
|
+
* <span class="informal">Collects values from the past as an array. Starts
|
|
7
|
+
* collecting only when `opening` emits, and calls the `closingSelector`
|
|
8
|
+
* function to get an Observable that tells when to close the buffer.</span>
|
|
9
|
+
*
|
|
10
|
+
* 
|
|
11
|
+
*
|
|
12
|
+
* Buffers values from the source by opening the buffer via signals from an
|
|
13
|
+
* Observable provided to `openings`, and closing and sending the buffers when
|
|
14
|
+
* a Subscribable or Promise returned by the `closingSelector` function emits.
|
|
15
|
+
*
|
|
16
|
+
* ## Example
|
|
17
|
+
*
|
|
18
|
+
* Every other second, emit the click events from the next 500ms
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { fromEvent, interval, bufferToggle, EMPTY } from 'rxjs';
|
|
22
|
+
*
|
|
23
|
+
* const clicks = fromEvent(document, 'click');
|
|
24
|
+
* const openings = interval(1000);
|
|
25
|
+
* const buffered = clicks.pipe(bufferToggle(openings, i =>
|
|
26
|
+
* i % 2 ? interval(500) : EMPTY
|
|
27
|
+
* ));
|
|
28
|
+
* buffered.subscribe(x => console.log(x));
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see {@link buffer}
|
|
32
|
+
* @see {@link bufferCount}
|
|
33
|
+
* @see {@link bufferTime}
|
|
34
|
+
* @see {@link bufferWhen}
|
|
35
|
+
* @see {@link windowToggle}
|
|
36
|
+
*
|
|
37
|
+
* @param openings A Subscribable or Promise of notifications to start new
|
|
38
|
+
* buffers.
|
|
39
|
+
* @param closingSelector A function that takes
|
|
40
|
+
* the value emitted by the `openings` observable and returns a Subscribable or Promise,
|
|
41
|
+
* which, when it emits, signals that the associated buffer should be emitted
|
|
42
|
+
* and cleared.
|
|
43
|
+
* @return A function that returns an Observable of arrays of buffered values.
|
|
44
|
+
*/
|
|
45
|
+
export declare function bufferToggle<T, O>(openings: ObservableInput<O>, closingSelector: (value: O) => ObservableInput<any>): OperatorFunction<T, T[]>;
|
|
46
|
+
//# sourceMappingURL=bufferToggle.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ObservableInput, OperatorFunction } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Buffers the source Observable values, using a factory function of closing
|
|
4
|
+
* Observables to determine when to close, emit, and reset the buffer.
|
|
5
|
+
*
|
|
6
|
+
* <span class="informal">Collects values from the past as an array. When it
|
|
7
|
+
* starts collecting values, it calls a function that returns an Observable that
|
|
8
|
+
* tells when to close the buffer and restart collecting.</span>
|
|
9
|
+
*
|
|
10
|
+
* 
|
|
11
|
+
*
|
|
12
|
+
* Opens a buffer immediately, then closes the buffer when the observable
|
|
13
|
+
* returned by calling `closingSelector` function emits a value. When it closes
|
|
14
|
+
* the buffer, it immediately opens a new buffer and repeats the process.
|
|
15
|
+
*
|
|
16
|
+
* ## Example
|
|
17
|
+
*
|
|
18
|
+
* Emit an array of the last clicks every [1-5] random seconds
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { fromEvent, bufferWhen, interval } from 'rxjs';
|
|
22
|
+
*
|
|
23
|
+
* const clicks = fromEvent(document, 'click');
|
|
24
|
+
* const buffered = clicks.pipe(
|
|
25
|
+
* bufferWhen(() => interval(1000 + Math.random() * 4000))
|
|
26
|
+
* );
|
|
27
|
+
* buffered.subscribe(x => console.log(x));
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see {@link buffer}
|
|
31
|
+
* @see {@link bufferCount}
|
|
32
|
+
* @see {@link bufferTime}
|
|
33
|
+
* @see {@link bufferToggle}
|
|
34
|
+
* @see {@link windowWhen}
|
|
35
|
+
*
|
|
36
|
+
* @param {function(): Observable} closingSelector A function that takes no
|
|
37
|
+
* arguments and returns an Observable that signals buffer closure.
|
|
38
|
+
* @return A function that returns an Observable of arrays of buffered values.
|
|
39
|
+
*/
|
|
40
|
+
export declare function bufferWhen<T>(closingSelector: () => ObservableInput<any>): OperatorFunction<T, T[]>;
|
|
41
|
+
//# sourceMappingURL=bufferWhen.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Observable } from '../Observable';
|
|
2
|
+
import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';
|
|
3
|
+
export declare function catchError<T, O extends ObservableInput<any>>(selector: (err: any, caught: Observable<T>) => O): OperatorFunction<T, T | ObservedValueOf<O>>;
|
|
4
|
+
//# sourceMappingURL=catchError.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OperatorFunction, ObservableInput } from '../types';
|
|
2
|
+
export declare function combineLatestAll<T>(): OperatorFunction<ObservableInput<T>, T[]>;
|
|
3
|
+
export declare function combineLatestAll<T>(): OperatorFunction<any, T[]>;
|
|
4
|
+
export declare function combineLatestAll<T, R>(project: (...values: T[]) => R): OperatorFunction<ObservableInput<T>, R>;
|
|
5
|
+
export declare function combineLatestAll<R>(project: (...values: Array<any>) => R): OperatorFunction<any, R>;
|
|
6
|
+
//# sourceMappingURL=combineLatestAll.d.ts.map
|