import { ReadonlyObjectMapLike } from "./collections.js"; import { ErrorSafeEventListenerLike, EventSourceLike, StoreLike } from "./events.js"; import { Function1, Optional, SideEffect1 } from "./functions.js"; import { BackpressureStrategy, DisposableContainerLike, DisposableLike, QueueableLike } from "./utils.js"; export declare const DispatcherLikeEvent_ready: unique symbol; export declare const DispatcherLikeEvent_capacityExceeded: unique symbol; export declare const DispatcherLikeEvent_completed: unique symbol; export declare const DispatcherLike_complete: unique symbol; export declare const DispatcherLike_isCompleted: unique symbol; /** * A `QueueableLike` type that consumes enqueued events to * be dispatched from any execution constext. * * @noInheritDoc */ export interface DispatcherLike extends QueueableLike, EventSourceLike, DisposableLike { readonly [DispatcherLike_isCompleted]: boolean; /** * Communicates to the dispatcher that no more events will be enqueued. */ [DispatcherLike_complete](): void; } export declare const PauseableLike_isPaused: unique symbol; export declare const PauseableLike_pause: unique symbol; export declare const PauseableLike_resume: unique symbol; /** * @noInheritDoc */ export interface PauseableLike extends DisposableLike { /** * Boolean flag indicating if the PauseableLike is currently paused or not. */ readonly [PauseableLike_isPaused]: StoreLike; /** * Imperatively pause the source. */ [PauseableLike_pause](): void; /** * Imperatively resume the source. */ [PauseableLike_resume](): void; } export declare const SchedulerLike_inContinuation: unique symbol; export declare const SchedulerLike_maxYieldInterval: unique symbol; export declare const SchedulerLike_now: unique symbol; export declare const SchedulerLike_requestYield: unique symbol; export declare const SchedulerLike_schedule: unique symbol; export declare const SchedulerLike_shouldYield: unique symbol; export declare const ContinuationContextLike_yield: unique symbol; export interface ContinuationContextLike { [ContinuationContextLike_yield](delay?: number): void; } /** * Schedulers are the core unit of concurrency, orchestration and * cooperative multi-tasking. * * @noInheritDoc */ export interface SchedulerLike extends DisposableContainerLike { /** * Boolean flag indicating the scheduler is currently * running a continuation. */ readonly [SchedulerLike_inContinuation]: boolean; /** * The max number of milliseconds the scheduler will run * before yielding control back to the underlying system scheduler. */ readonly [SchedulerLike_maxYieldInterval]: number; /** * The current time in milliseconds. */ readonly [SchedulerLike_now]: number; /** * Boolean flag indicating whether a running continuation * should yield control back to the scheduler. */ readonly [SchedulerLike_shouldYield]: boolean; /** * Request the scheduler to yield the current continuation. */ [SchedulerLike_requestYield](): void; /** * Schedule a continuation on the Scheduler. * @param continuation - The continuation to run on the scheduler. * @param options */ [SchedulerLike_schedule](continuation: SideEffect1, options?: { /** * The amount of time in ms to delay execution of the continuation. */ readonly delay?: number; }): DisposableLike; } export declare const VirtualTimeSchedulerLike_run: unique symbol; /** * A non-concurrent scheduler that simulates time but executes synchronously. * * @noInheritDoc */ export interface VirtualTimeSchedulerLike extends SchedulerLike, DisposableLike { /** * Runs the scheduler synchronously until it has no more * enqueued continuations, at which time the scheduler will auto dispose. */ [VirtualTimeSchedulerLike_run](): void; } /** * A `SchedulerLike` that supports imperative pausing and resuming * of it's run loop. * * @noInheritDoc */ export interface PauseableSchedulerLike extends SchedulerLike, PauseableLike { } export declare const ObserverLike_notify: unique symbol; /** * A consumer of push-based notifications. * * @noInheritDoc */ export interface ObserverLike extends DispatcherLike, SchedulerLike { /** * Notifies the observer of the next notification produced by the source. * * @param next - The next notification value. */ [ObserverLike_notify](event: T): void; } export declare const ObservableLike_isDeferred: unique symbol; export declare const ObservableLike_isMulticasted: unique symbol; export declare const ObservableLike_isPure: unique symbol; export declare const ObservableLike_isRunnable: unique symbol; export declare const ObservableLike_observe: unique symbol; /** * @noInheritDoc */ export interface ObservableLike { /** * Indicates if the `ObservableLike` is deferred, ie. cold. */ readonly [ObservableLike_isDeferred]: boolean; /** * Indicates if the `ObservableLike` is multicasted, ie. hot. */ readonly [ObservableLike_isMulticasted]: boolean; /** * Indicates if subscribing to the `ObservableLike` is free of side-effects */ readonly [ObservableLike_isPure]: boolean; /** * Indicates if the `ObservableLike` supports being subscribed to * on a VirtualTimeScheduler. */ readonly [ObservableLike_isRunnable]: boolean; /** * Subscribes the given `ObserverLike` to the `ObservableLike` source. * * @param observer - The observer. */ [ObservableLike_observe](observer: ObserverLike): void; } /** * @noInheritDoc */ export interface DeferredObservableLike extends ObservableLike { readonly [ObservableLike_isDeferred]: true; readonly [ObservableLike_isMulticasted]: false; } /** * @noInheritDoc */ export interface RunnableLike extends DeferredObservableLike { readonly [ObservableLike_isRunnable]: true; } /** * @noInheritDoc */ export interface PureObservableLike extends ObservableLike { readonly [ObservableLike_isPure]: true; } /** * @noInheritDoc */ export interface PureDeferredObservableLike extends DeferredObservableLike, PureObservableLike { readonly [ObservableLike_isMulticasted]: false; readonly [ObservableLike_isPure]: true; readonly [ObservableLike_isDeferred]: true; } /** * @noInheritDoc */ export interface DeferredObservableWithSideEffectsLike extends DeferredObservableLike { readonly [ObservableLike_isPure]: false; readonly [ObservableLike_isRunnable]: false; } /** * @noInheritDoc */ export interface PureRunnableLike extends RunnableLike, PureDeferredObservableLike { readonly [ObservableLike_isDeferred]: true; readonly [ObservableLike_isPure]: true; readonly [ObservableLike_isRunnable]: true; } /** * @noInheritDoc */ export interface RunnableWithSideEffectsLike extends RunnableLike { readonly [ObservableLike_isPure]: false; } /** * @noInheritDoc */ export interface MulticastObservableLike extends PureObservableLike { readonly [ObservableLike_isDeferred]: false; readonly [ObservableLike_isMulticasted]: true; readonly [ObservableLike_isRunnable]: false; } /** * @noInheritDoc */ export interface SubjectLike extends MulticastObservableLike, ErrorSafeEventListenerLike { } /** * @noInheritDoc */ export interface PauseableObservableLike extends MulticastObservableLike, PauseableLike { } export declare const FlowableLike_flow: unique symbol; /** * @noInheritDoc */ export interface FlowableLike { [FlowableLike_flow](scheduler: SchedulerLike, options?: { readonly backpressureStrategy?: BackpressureStrategy; readonly capacity?: number; readonly replay?: number; }): PauseableObservableLike; } /** * Represents a duplex stream * * @noInheritDoc */ export interface StreamLike extends DispatcherLike, MulticastObservableLike { } export declare const StreamableLike_stream: unique symbol; /** * A container that supports bi-directional streaming. * * @typeparam TReq * @typeparam T * @typeparam TStream * * @noInheritDoc */ export interface StreamableLike = StreamLike> { /** * Subscribe to the Streamable. * * @param scheduler - The scheduler to subscribe to the stream with. * @param options */ [StreamableLike_stream](scheduler: SchedulerLike, options?: { /** * The number of items to buffer for replay when an observer subscribes * to the stream. */ readonly replay?: number; /** * The capacity of the stream's request queue. */ readonly capacity?: number; readonly backpressureStrategy?: BackpressureStrategy; }): TStream; } export type StreamOf = ReturnType; export declare const CacheLike_get: unique symbol; export interface CacheLike extends StreamLike, Optional>>, never> { [CacheLike_get](index: string): ObservableLike; }