reactor-core-ts 3.2.2 → 3.2.4
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/README.md +5 -0
- package/dist/core/demand.d.ts +4 -0
- package/dist/core/demand.d.ts.map +1 -1
- package/dist/core/demand.js +12 -4
- package/dist/core/demand.js.map +1 -1
- package/dist/internal/deep-value.d.ts +9 -0
- package/dist/internal/deep-value.d.ts.map +1 -0
- package/dist/internal/deep-value.js +159 -0
- package/dist/internal/deep-value.js.map +1 -0
- package/dist/internal/iterable-transform.d.ts +8 -1
- package/dist/internal/iterable-transform.d.ts.map +1 -1
- package/dist/internal/iterable-transform.js +7 -5
- package/dist/internal/iterable-transform.js.map +1 -1
- package/dist/internal/iteration-demand.d.ts +18 -0
- package/dist/internal/iteration-demand.d.ts.map +1 -0
- package/dist/internal/iteration-demand.js +34 -0
- package/dist/internal/iteration-demand.js.map +1 -0
- package/dist/internal/publisher-terminal.d.ts +25 -0
- package/dist/internal/publisher-terminal.d.ts.map +1 -0
- package/dist/internal/publisher-terminal.js +128 -0
- package/dist/internal/publisher-terminal.js.map +1 -0
- package/dist/publisher/flux.d.ts.map +1 -1
- package/dist/publisher/flux.js +22 -12
- package/dist/publisher/flux.js.map +1 -1
- package/dist/publisher/mono.d.ts.map +1 -1
- package/dist/publisher/mono.js +2 -1
- package/dist/publisher/mono.js.map +1 -1
- package/dist/publisher/operators/aggregate.d.ts.map +1 -1
- package/dist/publisher/operators/aggregate.js +136 -143
- package/dist/publisher/operators/aggregate.js.map +1 -1
- package/dist/publisher/operators/buffer-lift.d.ts +5 -0
- package/dist/publisher/operators/buffer-lift.d.ts.map +1 -0
- package/dist/publisher/operators/buffer-lift.js +197 -0
- package/dist/publisher/operators/buffer-lift.js.map +1 -0
- package/dist/publisher/operators/compat/flux.d.ts.map +1 -1
- package/dist/publisher/operators/compat/flux.js +86 -35
- package/dist/publisher/operators/compat/flux.js.map +1 -1
- package/dist/publisher/operators/coordination.d.ts.map +1 -1
- package/dist/publisher/operators/coordination.js +3 -4
- package/dist/publisher/operators/coordination.js.map +1 -1
- package/dist/publisher/operators/lifecycle.d.ts.map +1 -1
- package/dist/publisher/operators/lifecycle.js +64 -21
- package/dist/publisher/operators/lifecycle.js.map +1 -1
- package/dist/publisher/operators/lift.d.ts +2 -0
- package/dist/publisher/operators/lift.d.ts.map +1 -1
- package/dist/publisher/operators/lift.js +173 -3
- package/dist/publisher/operators/lift.js.map +1 -1
- package/dist/publisher/operators/selection.d.ts +5 -0
- package/dist/publisher/operators/selection.d.ts.map +1 -1
- package/dist/publisher/operators/selection.js +11 -2
- package/dist/publisher/operators/selection.js.map +1 -1
- package/dist/publisher/operators/terminal-mono.d.ts +12 -0
- package/dist/publisher/operators/terminal-mono.d.ts.map +1 -0
- package/dist/publisher/operators/terminal-mono.js +244 -0
- package/dist/publisher/operators/terminal-mono.js.map +1 -0
- package/dist/publisher/operators/terminal.d.ts.map +1 -1
- package/dist/publisher/operators/terminal.js +12 -25
- package/dist/publisher/operators/terminal.js.map +1 -1
- package/dist/publisher/operators/time.d.ts.map +1 -1
- package/dist/publisher/operators/time.js +2 -0
- package/dist/publisher/operators/time.js.map +1 -1
- package/dist/subscription/iterable-subscription.d.ts.map +1 -1
- package/dist/subscription/iterable-subscription.js +5 -2
- package/dist/subscription/iterable-subscription.js.map +1 -1
- package/package.json +1 -1
- package/dist/internal/iterable-terminal.d.ts +0 -12
- package/dist/internal/iterable-terminal.d.ts.map +0 -1
- package/dist/internal/iterable-terminal.js +0 -49
- package/dist/internal/iterable-terminal.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordination.js","names":[],"sources":["../../../src/publisher/operators/coordination.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Reactor coordination and combination compatibility operators for Flux.\n */\nimport {Context} from \"@/context/context.js\";\nimport {AsyncQueue} from \"@/internal/async-queue.js\";\nimport {toAsyncIterator} from \"@/internal/iterable.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {scheduleDelay} from \"@/publisher/helpers.js\";\nimport type {PublisherInput} from \"@/publisher/types.js\";\nimport {Schedulers} from \"@/schedulers/schedulers.js\";\nimport type {DurationInput, Scheduler} from \"@/schedulers/types.js\";\nimport {Signal} from \"@/signal/signal.js\";\n\n/** Flux enriched with the key produced by `groupBy`. */\nexport type GroupedFlux<K, T> = Flux<T> & {\n /** Group key shared by all values in this grouped Flux. */\n readonly key: K;\n};\n\n/** Browser timing metadata emitted by `timed`. */\nexport interface Timed<T> {\n /** Source value associated with this timing sample. */\n readonly value: T;\n /** Timestamp in scheduler milliseconds. */\n readonly timestamp: number;\n /** Milliseconds elapsed since the previous value. */\n readonly elapsed: number;\n}\n\ndeclare module \"@/publisher/flux.js\" {\n /** Coordination and combination compatibility operators added to Flux. */\n interface Flux<T> {\n /** Concatenates mapped publishers and delays mapper/source errors where possible. */\n concatMapDelayError<R>(mapper: (value: T) => PublisherInput<R>): Flux<R>;\n\n /** Maps each value to an iterable and concatenates the iterable values. */\n concatMapIterable<R>(mapper: (value: T) => Iterable<R>): Flux<R>;\n\n /** Recursively expands values breadth-first. */\n expand(expander: (value: T) => PublisherInput<T>, capacityHint?: number): Flux<T>;\n\n /** Recursively expands values depth-first. */\n expandDeep(expander: (value: T) => PublisherInput<T>, capacityHint?: number): Flux<T>;\n\n /** Filters values using an asynchronous boolean publisher. */\n filterWhen(predicate: (value: T) => PublisherInput<boolean>): Flux<T>;\n\n /** Flat maps values and delays mapper/source errors where possible. */\n flatMapDelayError<R>(mapper: (value: T) => PublisherInput<R>, concurrency?: number): Flux<R>;\n\n /** Maps each value to an iterable and merges the iterable values. */\n flatMapIterable<R>(mapper: (value: T) => Iterable<R>): Flux<R>;\n\n /** Flat maps values while preserving source order. */\n flatMapSequential<R>(mapper: (value: T) => PublisherInput<R>, concurrency?: number): Flux<R>;\n\n /** Flat maps values sequentially and delays mapper/source errors where possible. */\n flatMapSequentialDelayError<R>(mapper: (value: T) => PublisherInput<R>, concurrency?: number): Flux<R>;\n\n /** Groups values by key and emits one finite grouped Flux per key. */\n groupBy<K>(keySelector: (value: T) => K): Flux<GroupedFlux<K, T>>;\n\n /** Joins each left value with a Flux of right values. */\n groupJoin<TRight, R>(\n right: PublisherInput<TRight>,\n leftEnd: (left: T) => PublisherInput<unknown>,\n rightEnd: (right: TRight) => PublisherInput<unknown>,\n resultSelector: (left: T, right: Flux<TRight>) => R\n ): Flux<R>;\n\n /** Indexes each value or maps the generated index and value. */\n index<R = readonly [number, T]>(mapper?: (index: number, value: T) => R): Flux<R>;\n\n /** Joins each left and right value with a result selector. */\n join<TRight, R>(\n right: PublisherInput<TRight>,\n leftEnd: (left: T) => PublisherInput<unknown>,\n rightEnd: (right: TRight) => PublisherInput<unknown>,\n resultSelector: (left: T, right: TRight) => R\n ): Flux<R>;\n\n /** Merges this source with others and emits finite values sorted by a comparator. */\n mergeComparingWith(comparator: (left: T, right: T) => number, ...others: readonly PublisherInput<T>[]): Flux<T>;\n\n /** Merges this source with others and emits finite values sorted by a comparator. */\n mergeOrderedWith(comparator: (left: T, right: T) => number, ...others: readonly PublisherInput<T>[]): Flux<T>;\n\n /** Relays the first source between this source and another publisher to signal. */\n or(other: PublisherInput<T>): Flux<T>;\n\n /** Returns this source as a browser single-threaded parallel-compatible view. */\n parallel(...args: unknown[]): Flux<T>;\n\n /** Repeats this source when a companion publisher signals. */\n repeatWhen(companion: (signals: Flux<number>) => PublisherInput<unknown>): Flux<T>;\n\n /** Retries this source when a companion publisher signals. */\n retryWhen(companion: (errors: Flux<unknown>) => PublisherInput<unknown>): Flux<T>;\n\n /** Samples the latest value when a sampler publisher signals or a period elapses. */\n sample(sampler: DurationInput | PublisherInput<unknown>, scheduler?: Scheduler): Flux<T>;\n\n /** Emits the first value in each sampling period. */\n sampleFirst(period: DurationInput, scheduler?: Scheduler): Flux<T>;\n\n /** Emits a value only if its throttler publisher completes before another value arrives. */\n sampleTimeout(throttler: (value: T) => PublisherInput<unknown>): Flux<T>;\n\n /** Skips values until the predicate matches, including the matching value. */\n skipUntil(predicate: (value: T) => boolean): Flux<T>;\n\n /** Skips values until another publisher signals. */\n skipUntilOther(other: PublisherInput<unknown>): Flux<T>;\n\n /** Transforms this source after observing its first signal. */\n switchOnFirst<R>(transformer: (signal: Signal<T>, source: Flux<T>) => PublisherInput<R>): Flux<R>;\n\n /** Relays values until another publisher signals. */\n takeUntilOther(other: PublisherInput<unknown>): Flux<T>;\n\n /** Emits browser timing metadata for each value. */\n timed(scheduler?: Scheduler): Flux<Timed<T>>;\n\n /** Combines each value with the latest value from another publisher. */\n withLatestFrom<U, R = readonly [T, U]>(other: PublisherInput<U>, combinator?: (left: T, right: U) => R): Flux<R>;\n\n /** Zips this source with a synchronous iterable. */\n zipWithIterable<U, R = readonly [T, U]>(other: Iterable<U>, combinator?: (left: T, right: U) => R): Flux<R>;\n }\n}\n\nFlux.prototype.concatMapDelayError = function concatMapDelayError<T, R>(\n this: Flux<T>,\n mapper: (value: T) => PublisherInput<R>\n): Flux<R> {\n return delayErrors(this.concatMap(mapper));\n};\n\nFlux.prototype.concatMapIterable = function concatMapIterable<T, R>(\n this: Flux<T>,\n mapper: (value: T) => Iterable<R>\n): Flux<R> {\n return this.concatMap(value => Flux.fromIterable(mapper(value)));\n};\n\nFlux.prototype.expand = function expand<T>(\n this: Flux<T>,\n expander: (value: T) => PublisherInput<T>,\n _capacityHint?: number\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const queue: T[] = [];\n for await (const value of source.iterate(signal, context)) {\n queue.push(value);\n }\n for (let index = 0; index < queue.length && !signal.aborted; index += 1) {\n const value = queue[index] as T;\n yield value;\n for await (const child of Flux.from(expander(value)).iterate(signal, context)) {\n queue.push(child);\n }\n }\n });\n};\n\nFlux.prototype.expandDeep = function expandDeep<T>(\n this: Flux<T>,\n expander: (value: T) => PublisherInput<T>,\n _capacityHint?: number\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const stack: T[] = [];\n for await (const value of source.iterate(signal, context)) {\n stack.push(value);\n }\n while (stack.length > 0 && !signal.aborted) {\n const value = stack.pop() as T;\n yield value;\n const children: T[] = [];\n for await (const child of Flux.from(expander(value)).iterate(signal, context)) {\n children.push(child);\n }\n for (let index = children.length - 1; index >= 0; index -= 1) {\n stack.push(children[index] as T);\n }\n }\n });\n};\n\nFlux.prototype.filterWhen = function filterWhen<T>(\n this: Flux<T>,\n predicate: (value: T) => PublisherInput<boolean>\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const value of source.iterate(signal, context)) {\n if (await firstValueFromContext(predicate(value), signal, context)) {\n yield value;\n }\n }\n });\n};\n\nFlux.prototype.flatMapDelayError = function flatMapDelayError<T, R>(\n this: Flux<T>,\n mapper: (value: T) => PublisherInput<R>,\n concurrency?: number\n): Flux<R> {\n return delayErrors(this.flatMap(mapper, concurrency));\n};\n\nFlux.prototype.flatMapIterable = function flatMapIterable<T, R>(\n this: Flux<T>,\n mapper: (value: T) => Iterable<R>\n): Flux<R> {\n return this.flatMap(value => Flux.fromIterable(mapper(value)));\n};\n\nFlux.prototype.flatMapSequential = function flatMapSequential<T, R>(\n this: Flux<T>,\n mapper: (value: T) => PublisherInput<R>,\n _concurrency?: number\n): Flux<R> {\n return this.concatMap(mapper);\n};\n\nFlux.prototype.flatMapSequentialDelayError = function flatMapSequentialDelayError<T, R>(\n this: Flux<T>,\n mapper: (value: T) => PublisherInput<R>,\n concurrency?: number\n): Flux<R> {\n return delayErrors(this.flatMapSequential(mapper, concurrency));\n};\n\nFlux.prototype.groupBy = function groupBy<T, K>(this: Flux<T>, keySelector: (value: T) => K): Flux<GroupedFlux<K, T>> {\n const source = this;\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<GroupedFlux<K, T>>(signal);\n void (async () => {\n try {\n const groups = new Map<K, T[]>();\n for await (const value of source.iterate(signal, context)) {\n const key = keySelector(value);\n const values = groups.get(key);\n if (values) {\n values.push(value);\n } else {\n groups.set(key, [value]);\n }\n }\n for (const [key, values] of groups) {\n const group = Flux.fromIterable(values) as GroupedFlux<K, T>;\n Object.defineProperty(group, \"key\", {enumerable: true, value: key});\n queue.push(group);\n }\n queue.complete();\n } catch (error) {\n queue.error(error);\n }\n })();\n return queue;\n });\n};\n\nFlux.prototype.groupJoin = function groupJoin<T, TRight, R>(\n this: Flux<T>,\n right: PublisherInput<TRight>,\n _leftEnd: (left: T) => PublisherInput<unknown>,\n _rightEnd: (right: TRight) => PublisherInput<unknown>,\n resultSelector: (left: T, right: Flux<TRight>) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const rightValues = await collect(right, signal, context);\n for await (const left of source.iterate(signal, context)) {\n yield resultSelector(left, Flux.fromIterable(rightValues));\n }\n });\n};\n\nFlux.prototype.index = function index<T, R = readonly [number, T]>(\n this: Flux<T>,\n mapper?: (index: number, value: T) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let indexValue = 0;\n for await (const value of source.iterate(signal, context)) {\n yield mapper ? mapper(indexValue, value) : ([indexValue, value] as unknown as R);\n indexValue += 1;\n }\n });\n};\n\nFlux.prototype.join = function join<T, TRight, R>(\n this: Flux<T>,\n right: PublisherInput<TRight>,\n _leftEnd: (left: T) => PublisherInput<unknown>,\n _rightEnd: (right: TRight) => PublisherInput<unknown>,\n resultSelector: (left: T, right: TRight) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const rightValues = await collect(right, signal, context);\n for await (const left of source.iterate(signal, context)) {\n for (const rightValue of rightValues) {\n yield resultSelector(left, rightValue);\n }\n }\n });\n};\n\nFlux.prototype.mergeComparingWith = function mergeComparingWith<T>(\n this: Flux<T>,\n comparator: (left: T, right: T) => number,\n ...others: readonly PublisherInput<T>[]\n): Flux<T> {\n return Flux.mergeComparing(comparator, this, ...others);\n};\n\nFlux.prototype.mergeOrderedWith = function mergeOrderedWith<T>(\n this: Flux<T>,\n comparator: (left: T, right: T) => number,\n ...others: readonly PublisherInput<T>[]\n): Flux<T> {\n return Flux.mergeOrdered(comparator, this, ...others);\n};\n\nFlux.prototype.or = function or<T>(this: Flux<T>, other: PublisherInput<T>): Flux<T> {\n return Flux.firstWithSignal(this, other);\n};\n\nFlux.prototype.parallel = function parallel<T>(this: Flux<T>, ..._args: unknown[]): Flux<T> {\n return this;\n};\n\nFlux.prototype.repeatWhen = function repeatWhen<T>(\n this: Flux<T>,\n _companion: (signals: Flux<number>) => PublisherInput<unknown>\n): Flux<T> {\n return this.repeat(1);\n};\n\nFlux.prototype.retryWhen = function retryWhen<T>(\n this: Flux<T>,\n _companion: (errors: Flux<unknown>) => PublisherInput<unknown>\n): Flux<T> {\n return this.retry(1);\n};\n\nFlux.prototype.sample = function sample<T>(\n this: Flux<T>,\n sampler: DurationInput | PublisherInput<unknown>,\n scheduler: Scheduler = Schedulers.timeout()\n): Flux<T> {\n return isDuration(sampler) ? samplePeriodically(this, sampler, scheduler) : sampleWithPublisher(this, sampler);\n};\n\nFlux.prototype.sampleFirst = function sampleFirst<T>(\n this: Flux<T>,\n period: DurationInput,\n scheduler: Scheduler = Schedulers.timeout()\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let open = true;\n for await (const value of source.iterate(signal, context)) {\n if (!open) {\n continue;\n }\n open = false;\n yield value;\n void scheduleDelay(scheduler, period, signal).then(() => {\n open = true;\n });\n }\n });\n};\n\nFlux.prototype.sampleTimeout = function sampleTimeout<T>(\n this: Flux<T>,\n throttler: (value: T) => PublisherInput<unknown>\n): Flux<T> {\n const source = this;\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<T>(signal);\n let version = 0;\n void (async () => {\n try {\n for await (const value of source.iterate(signal, context)) {\n version += 1;\n const current = version;\n void drain(throttler(value), signal, context).then(() => {\n if (current === version) {\n queue.push(value);\n }\n }, error => queue.error(error));\n }\n queue.complete();\n } catch (error) {\n queue.error(error);\n }\n })();\n return queue;\n });\n};\n\nFlux.prototype.skipUntil = function skipUntil<T>(this: Flux<T>, predicate: (value: T) => boolean): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let open = false;\n for await (const value of source.iterate(signal, context)) {\n if (!open && predicate(value)) {\n open = true;\n }\n if (open) {\n yield value;\n }\n }\n });\n};\n\nFlux.prototype.skipUntilOther = function skipUntilOther<T>(this: Flux<T>, other: PublisherInput<unknown>): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n await firstValueFromContext(other, signal, context);\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.switchOnFirst = function switchOnFirst<T, R>(\n this: Flux<T>,\n transformer: (signal: Signal<T>, source: Flux<T>) => PublisherInput<R>\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const iterator = toAsyncIterator(source.iterate(signal, context));\n try {\n const first = await iterator.next();\n const firstSignal = first.done ? Signal.complete<T>() : Signal.next(first.value);\n const rest = first.done ? Flux.empty<T>() : Flux.concat(Flux.just(first.value), new Flux(() => ({[Symbol.asyncIterator]: () => iterator})));\n for await (const value of Flux.from(transformer(firstSignal, rest)).iterate(signal, context)) {\n yield value;\n }\n } catch (error) {\n for await (const value of Flux.from(transformer(Signal.error<T>(error), Flux.error<T>(error))).iterate(signal, context)) {\n yield value;\n }\n }\n });\n};\n\nFlux.prototype.takeUntilOther = function takeUntilOther<T>(this: Flux<T>, other: PublisherInput<unknown>): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const stop: Promise<true> = firstValueFromContext(other, signal, context).then(() => true);\n const iterator = toAsyncIterator(source.iterate(signal, context));\n try {\n while (!signal.aborted) {\n const result = await Promise.race<IteratorResult<T> | true>([iterator.next(), stop]);\n if (result === true || result.done) {\n return;\n }\n yield result.value;\n }\n } finally {\n await iterator.return?.();\n }\n });\n};\n\nFlux.prototype.timed = function timed<T>(\n this: Flux<T>,\n scheduler: Scheduler = Schedulers.timeout()\n): Flux<Timed<T>> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let last = scheduler.now();\n for await (const value of source.iterate(signal, context)) {\n const timestamp = scheduler.now();\n yield {elapsed: timestamp - last, timestamp, value};\n last = timestamp;\n }\n });\n};\n\nFlux.prototype.withLatestFrom = function withLatestFrom<T, U, R = readonly [T, U]>(\n this: Flux<T>,\n other: PublisherInput<U>,\n combinator?: (left: T, right: U) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let latest: U | undefined;\n let hasLatest = false;\n void (async () => {\n for await (const value of Flux.from(other).iterate(signal, context)) {\n latest = value;\n hasLatest = true;\n }\n })();\n for await (const value of source.iterate(signal, context)) {\n if (hasLatest) {\n yield combinator ? combinator(value, latest as U) : ([value, latest] as unknown as R);\n }\n }\n });\n};\n\nFlux.prototype.zipWithIterable = function zipWithIterable<T, U, R = readonly [T, U]>(\n this: Flux<T>,\n other: Iterable<U>,\n combinator?: (left: T, right: U) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const iterator = other[Symbol.iterator]();\n for await (const value of source.iterate(signal, context)) {\n const next = iterator.next();\n if (next.done) {\n return;\n }\n yield combinator ? combinator(value, next.value) : ([value, next.value] as unknown as R);\n }\n });\n};\n\n/** Returns a Flux that preserves values while allowing delayed-error naming parity. */\nfunction delayErrors<T>(source: Flux<T>): Flux<T> {\n return source;\n}\n\n/** Collects a finite publisher input into an array. */\nasync function collect<T>(source: PublisherInput<T>, signal: AbortSignal, context: Context): Promise<T[]> {\n const values: T[] = [];\n for await (const value of Flux.from(source).iterate(signal, context)) {\n values.push(value);\n }\n return values;\n}\n\n/** Consumes a publisher input and ignores all values. */\nasync function drain(source: PublisherInput<unknown>, signal: AbortSignal, context: Context): Promise<void> {\n for await (const _ of Flux.from(source).iterate(signal, context)) {\n // ignored\n }\n}\n\n/** Resolves the first value from a publisher input using the current subscriber context. */\nasync function firstValueFromContext<T>(source: PublisherInput<T>, signal: AbortSignal, context: Context): Promise<T | undefined> {\n const iterator = toAsyncIterator(Flux.from(source).iterate(signal, context));\n try {\n const result = await iterator.next();\n return result.done ? undefined : result.value;\n } finally {\n await iterator.return?.();\n }\n}\n\n/** Returns true when a value is a duration input instead of a publisher input. */\nfunction isDuration(value: unknown): value is DurationInput {\n return typeof value === \"number\" || (typeof value === \"object\" && value !== null && !isPublisherLike(value));\n}\n\n/** Returns true when a value looks like a publisher or iterable source. */\nfunction isPublisherLike(value: object): boolean {\n return (\n typeof (value as { subscribe?: unknown }).subscribe === \"function\" ||\n typeof (value as { then?: unknown }).then === \"function\" ||\n typeof (value as { [Symbol.iterator]?: unknown })[Symbol.iterator] === \"function\" ||\n typeof (value as { [Symbol.asyncIterator]?: unknown })[Symbol.asyncIterator] === \"function\"\n );\n}\n\n/** Samples the latest source value whenever a scheduler period elapses. */\nfunction samplePeriodically<T>(source: Flux<T>, period: DurationInput, scheduler: Scheduler): Flux<T> {\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<T>(signal);\n let latest: T | undefined;\n let hasLatest = false;\n const periodic = scheduler.schedulePeriodically(() => {\n if (hasLatest) {\n queue.push(latest as T);\n hasLatest = false;\n }\n }, period, period);\n signal.addEventListener(\"abort\", () => periodic.dispose(), {once: true});\n void (async () => {\n try {\n for await (const value of source.iterate(signal, context)) {\n latest = value;\n hasLatest = true;\n }\n periodic.dispose();\n queue.complete();\n } catch (error) {\n periodic.dispose();\n queue.error(error);\n }\n })();\n return queue;\n });\n}\n\n/** Samples the latest source value whenever another publisher emits. */\nfunction sampleWithPublisher<T>(source: Flux<T>, sampler: PublisherInput<unknown>): Flux<T> {\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<T>(signal);\n let latest: T | undefined;\n let hasLatest = false;\n void (async () => {\n try {\n await Promise.all([\n (async () => {\n for await (const value of source.iterate(signal, context)) {\n latest = value;\n hasLatest = true;\n }\n })(),\n (async () => {\n for await (const _ of Flux.from(sampler).iterate(signal, context)) {\n if (hasLatest) {\n queue.push(latest as T);\n hasLatest = false;\n }\n }\n })()\n ]);\n queue.complete();\n } cat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AS;GACnB,SAAS,OAAO;IACZ,MAAM,MAAM,KAAK;GACrB;EACJ,EAAA,CAAG;EACH,OAAO;CACX,CAAC;AACL"}
|
|
1
|
+
{"version":3,"file":"coordination.js","names":[],"sources":["../../../src/publisher/operators/coordination.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Reactor coordination and combination compatibility operators for Flux.\n */\nimport {Context} from \"@/context/context.js\";\nimport {AsyncQueue} from \"@/internal/async-queue.js\";\nimport {toAsyncIterator} from \"@/internal/iterable.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {collectPublisher, drainPublisher} from \"@/internal/publisher-terminal.js\";\nimport {scheduleDelay} from \"@/publisher/helpers.js\";\nimport type {PublisherInput} from \"@/publisher/types.js\";\nimport {Schedulers} from \"@/schedulers/schedulers.js\";\nimport type {DurationInput, Scheduler} from \"@/schedulers/types.js\";\nimport {Signal} from \"@/signal/signal.js\";\n\n/** Flux enriched with the key produced by `groupBy`. */\nexport type GroupedFlux<K, T> = Flux<T> & {\n /** Group key shared by all values in this grouped Flux. */\n readonly key: K;\n};\n\n/** Browser timing metadata emitted by `timed`. */\nexport interface Timed<T> {\n /** Source value associated with this timing sample. */\n readonly value: T;\n /** Timestamp in scheduler milliseconds. */\n readonly timestamp: number;\n /** Milliseconds elapsed since the previous value. */\n readonly elapsed: number;\n}\n\ndeclare module \"@/publisher/flux.js\" {\n /** Coordination and combination compatibility operators added to Flux. */\n interface Flux<T> {\n /** Concatenates mapped publishers and delays mapper/source errors where possible. */\n concatMapDelayError<R>(mapper: (value: T) => PublisherInput<R>): Flux<R>;\n\n /** Maps each value to an iterable and concatenates the iterable values. */\n concatMapIterable<R>(mapper: (value: T) => Iterable<R>): Flux<R>;\n\n /** Recursively expands values breadth-first. */\n expand(expander: (value: T) => PublisherInput<T>, capacityHint?: number): Flux<T>;\n\n /** Recursively expands values depth-first. */\n expandDeep(expander: (value: T) => PublisherInput<T>, capacityHint?: number): Flux<T>;\n\n /** Filters values using an asynchronous boolean publisher. */\n filterWhen(predicate: (value: T) => PublisherInput<boolean>): Flux<T>;\n\n /** Flat maps values and delays mapper/source errors where possible. */\n flatMapDelayError<R>(mapper: (value: T) => PublisherInput<R>, concurrency?: number): Flux<R>;\n\n /** Maps each value to an iterable and merges the iterable values. */\n flatMapIterable<R>(mapper: (value: T) => Iterable<R>): Flux<R>;\n\n /** Flat maps values while preserving source order. */\n flatMapSequential<R>(mapper: (value: T) => PublisherInput<R>, concurrency?: number): Flux<R>;\n\n /** Flat maps values sequentially and delays mapper/source errors where possible. */\n flatMapSequentialDelayError<R>(mapper: (value: T) => PublisherInput<R>, concurrency?: number): Flux<R>;\n\n /** Groups values by key and emits one finite grouped Flux per key. */\n groupBy<K>(keySelector: (value: T) => K): Flux<GroupedFlux<K, T>>;\n\n /** Joins each left value with a Flux of right values. */\n groupJoin<TRight, R>(\n right: PublisherInput<TRight>,\n leftEnd: (left: T) => PublisherInput<unknown>,\n rightEnd: (right: TRight) => PublisherInput<unknown>,\n resultSelector: (left: T, right: Flux<TRight>) => R\n ): Flux<R>;\n\n /** Indexes each value or maps the generated index and value. */\n index<R = readonly [number, T]>(mapper?: (index: number, value: T) => R): Flux<R>;\n\n /** Joins each left and right value with a result selector. */\n join<TRight, R>(\n right: PublisherInput<TRight>,\n leftEnd: (left: T) => PublisherInput<unknown>,\n rightEnd: (right: TRight) => PublisherInput<unknown>,\n resultSelector: (left: T, right: TRight) => R\n ): Flux<R>;\n\n /** Merges this source with others and emits finite values sorted by a comparator. */\n mergeComparingWith(comparator: (left: T, right: T) => number, ...others: readonly PublisherInput<T>[]): Flux<T>;\n\n /** Merges this source with others and emits finite values sorted by a comparator. */\n mergeOrderedWith(comparator: (left: T, right: T) => number, ...others: readonly PublisherInput<T>[]): Flux<T>;\n\n /** Relays the first source between this source and another publisher to signal. */\n or(other: PublisherInput<T>): Flux<T>;\n\n /** Returns this source as a browser single-threaded parallel-compatible view. */\n parallel(...args: unknown[]): Flux<T>;\n\n /** Repeats this source when a companion publisher signals. */\n repeatWhen(companion: (signals: Flux<number>) => PublisherInput<unknown>): Flux<T>;\n\n /** Retries this source when a companion publisher signals. */\n retryWhen(companion: (errors: Flux<unknown>) => PublisherInput<unknown>): Flux<T>;\n\n /** Samples the latest value when a sampler publisher signals or a period elapses. */\n sample(sampler: DurationInput | PublisherInput<unknown>, scheduler?: Scheduler): Flux<T>;\n\n /** Emits the first value in each sampling period. */\n sampleFirst(period: DurationInput, scheduler?: Scheduler): Flux<T>;\n\n /** Emits a value only if its throttler publisher completes before another value arrives. */\n sampleTimeout(throttler: (value: T) => PublisherInput<unknown>): Flux<T>;\n\n /** Skips values until the predicate matches, including the matching value. */\n skipUntil(predicate: (value: T) => boolean): Flux<T>;\n\n /** Skips values until another publisher signals. */\n skipUntilOther(other: PublisherInput<unknown>): Flux<T>;\n\n /** Transforms this source after observing its first signal. */\n switchOnFirst<R>(transformer: (signal: Signal<T>, source: Flux<T>) => PublisherInput<R>): Flux<R>;\n\n /** Relays values until another publisher signals. */\n takeUntilOther(other: PublisherInput<unknown>): Flux<T>;\n\n /** Emits browser timing metadata for each value. */\n timed(scheduler?: Scheduler): Flux<Timed<T>>;\n\n /** Combines each value with the latest value from another publisher. */\n withLatestFrom<U, R = readonly [T, U]>(other: PublisherInput<U>, combinator?: (left: T, right: U) => R): Flux<R>;\n\n /** Zips this source with a synchronous iterable. */\n zipWithIterable<U, R = readonly [T, U]>(other: Iterable<U>, combinator?: (left: T, right: U) => R): Flux<R>;\n }\n}\n\nFlux.prototype.concatMapDelayError = function concatMapDelayError<T, R>(\n this: Flux<T>,\n mapper: (value: T) => PublisherInput<R>\n): Flux<R> {\n return delayErrors(this.concatMap(mapper));\n};\n\nFlux.prototype.concatMapIterable = function concatMapIterable<T, R>(\n this: Flux<T>,\n mapper: (value: T) => Iterable<R>\n): Flux<R> {\n return this.concatMap(value => Flux.fromIterable(mapper(value)));\n};\n\nFlux.prototype.expand = function expand<T>(\n this: Flux<T>,\n expander: (value: T) => PublisherInput<T>,\n _capacityHint?: number\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const queue: T[] = [];\n for await (const value of source.iterate(signal, context)) {\n queue.push(value);\n }\n for (let index = 0; index < queue.length && !signal.aborted; index += 1) {\n const value = queue[index] as T;\n yield value;\n for await (const child of Flux.from(expander(value)).iterate(signal, context)) {\n queue.push(child);\n }\n }\n });\n};\n\nFlux.prototype.expandDeep = function expandDeep<T>(\n this: Flux<T>,\n expander: (value: T) => PublisherInput<T>,\n _capacityHint?: number\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const stack: T[] = [];\n for await (const value of source.iterate(signal, context)) {\n stack.push(value);\n }\n while (stack.length > 0 && !signal.aborted) {\n const value = stack.pop() as T;\n yield value;\n const children: T[] = [];\n for await (const child of Flux.from(expander(value)).iterate(signal, context)) {\n children.push(child);\n }\n for (let index = children.length - 1; index >= 0; index -= 1) {\n stack.push(children[index] as T);\n }\n }\n });\n};\n\nFlux.prototype.filterWhen = function filterWhen<T>(\n this: Flux<T>,\n predicate: (value: T) => PublisherInput<boolean>\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const value of source.iterate(signal, context)) {\n if (await firstValueFromContext(predicate(value), signal, context)) {\n yield value;\n }\n }\n });\n};\n\nFlux.prototype.flatMapDelayError = function flatMapDelayError<T, R>(\n this: Flux<T>,\n mapper: (value: T) => PublisherInput<R>,\n concurrency?: number\n): Flux<R> {\n return delayErrors(this.flatMap(mapper, concurrency));\n};\n\nFlux.prototype.flatMapIterable = function flatMapIterable<T, R>(\n this: Flux<T>,\n mapper: (value: T) => Iterable<R>\n): Flux<R> {\n return this.flatMap(value => Flux.fromIterable(mapper(value)));\n};\n\nFlux.prototype.flatMapSequential = function flatMapSequential<T, R>(\n this: Flux<T>,\n mapper: (value: T) => PublisherInput<R>,\n _concurrency?: number\n): Flux<R> {\n return this.concatMap(mapper);\n};\n\nFlux.prototype.flatMapSequentialDelayError = function flatMapSequentialDelayError<T, R>(\n this: Flux<T>,\n mapper: (value: T) => PublisherInput<R>,\n concurrency?: number\n): Flux<R> {\n return delayErrors(this.flatMapSequential(mapper, concurrency));\n};\n\nFlux.prototype.groupBy = function groupBy<T, K>(this: Flux<T>, keySelector: (value: T) => K): Flux<GroupedFlux<K, T>> {\n const source = this;\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<GroupedFlux<K, T>>(signal);\n void (async () => {\n try {\n const groups = new Map<K, T[]>();\n for await (const value of source.iterate(signal, context)) {\n const key = keySelector(value);\n const values = groups.get(key);\n if (values) {\n values.push(value);\n } else {\n groups.set(key, [value]);\n }\n }\n for (const [key, values] of groups) {\n const group = Flux.fromIterable(values) as GroupedFlux<K, T>;\n Object.defineProperty(group, \"key\", {enumerable: true, value: key});\n queue.push(group);\n }\n queue.complete();\n } catch (error) {\n queue.error(error);\n }\n })();\n return queue;\n });\n};\n\nFlux.prototype.groupJoin = function groupJoin<T, TRight, R>(\n this: Flux<T>,\n right: PublisherInput<TRight>,\n _leftEnd: (left: T) => PublisherInput<unknown>,\n _rightEnd: (right: TRight) => PublisherInput<unknown>,\n resultSelector: (left: T, right: Flux<TRight>) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const rightValues = await collect(right, signal, context);\n for await (const left of source.iterate(signal, context)) {\n yield resultSelector(left, Flux.fromIterable(rightValues));\n }\n });\n};\n\nFlux.prototype.index = function index<T, R = readonly [number, T]>(\n this: Flux<T>,\n mapper?: (index: number, value: T) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let indexValue = 0;\n for await (const value of source.iterate(signal, context)) {\n yield mapper ? mapper(indexValue, value) : ([indexValue, value] as unknown as R);\n indexValue += 1;\n }\n });\n};\n\nFlux.prototype.join = function join<T, TRight, R>(\n this: Flux<T>,\n right: PublisherInput<TRight>,\n _leftEnd: (left: T) => PublisherInput<unknown>,\n _rightEnd: (right: TRight) => PublisherInput<unknown>,\n resultSelector: (left: T, right: TRight) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const rightValues = await collect(right, signal, context);\n for await (const left of source.iterate(signal, context)) {\n for (const rightValue of rightValues) {\n yield resultSelector(left, rightValue);\n }\n }\n });\n};\n\nFlux.prototype.mergeComparingWith = function mergeComparingWith<T>(\n this: Flux<T>,\n comparator: (left: T, right: T) => number,\n ...others: readonly PublisherInput<T>[]\n): Flux<T> {\n return Flux.mergeComparing(comparator, this, ...others);\n};\n\nFlux.prototype.mergeOrderedWith = function mergeOrderedWith<T>(\n this: Flux<T>,\n comparator: (left: T, right: T) => number,\n ...others: readonly PublisherInput<T>[]\n): Flux<T> {\n return Flux.mergeOrdered(comparator, this, ...others);\n};\n\nFlux.prototype.or = function or<T>(this: Flux<T>, other: PublisherInput<T>): Flux<T> {\n return Flux.firstWithSignal(this, other);\n};\n\nFlux.prototype.parallel = function parallel<T>(this: Flux<T>, ..._args: unknown[]): Flux<T> {\n return this;\n};\n\nFlux.prototype.repeatWhen = function repeatWhen<T>(\n this: Flux<T>,\n _companion: (signals: Flux<number>) => PublisherInput<unknown>\n): Flux<T> {\n return this.repeat(1);\n};\n\nFlux.prototype.retryWhen = function retryWhen<T>(\n this: Flux<T>,\n _companion: (errors: Flux<unknown>) => PublisherInput<unknown>\n): Flux<T> {\n return this.retry(1);\n};\n\nFlux.prototype.sample = function sample<T>(\n this: Flux<T>,\n sampler: DurationInput | PublisherInput<unknown>,\n scheduler: Scheduler = Schedulers.timeout()\n): Flux<T> {\n return isDuration(sampler) ? samplePeriodically(this, sampler, scheduler) : sampleWithPublisher(this, sampler);\n};\n\nFlux.prototype.sampleFirst = function sampleFirst<T>(\n this: Flux<T>,\n period: DurationInput,\n scheduler: Scheduler = Schedulers.timeout()\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let open = true;\n for await (const value of source.iterate(signal, context)) {\n if (!open) {\n continue;\n }\n open = false;\n yield value;\n void scheduleDelay(scheduler, period, signal).then(() => {\n open = true;\n });\n }\n });\n};\n\nFlux.prototype.sampleTimeout = function sampleTimeout<T>(\n this: Flux<T>,\n throttler: (value: T) => PublisherInput<unknown>\n): Flux<T> {\n const source = this;\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<T>(signal);\n let version = 0;\n void (async () => {\n try {\n for await (const value of source.iterate(signal, context)) {\n version += 1;\n const current = version;\n void drain(throttler(value), signal, context).then(() => {\n if (current === version) {\n queue.push(value);\n }\n }, error => queue.error(error));\n }\n queue.complete();\n } catch (error) {\n queue.error(error);\n }\n })();\n return queue;\n });\n};\n\nFlux.prototype.skipUntil = function skipUntil<T>(this: Flux<T>, predicate: (value: T) => boolean): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let open = false;\n for await (const value of source.iterate(signal, context)) {\n if (!open && predicate(value)) {\n open = true;\n }\n if (open) {\n yield value;\n }\n }\n });\n};\n\nFlux.prototype.skipUntilOther = function skipUntilOther<T>(this: Flux<T>, other: PublisherInput<unknown>): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n await firstValueFromContext(other, signal, context);\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.switchOnFirst = function switchOnFirst<T, R>(\n this: Flux<T>,\n transformer: (signal: Signal<T>, source: Flux<T>) => PublisherInput<R>\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const iterator = toAsyncIterator(source.iterate(signal, context));\n try {\n const first = await iterator.next();\n const firstSignal = first.done ? Signal.complete<T>() : Signal.next(first.value);\n const rest = first.done ? Flux.empty<T>() : Flux.concat(Flux.just(first.value), new Flux(() => ({[Symbol.asyncIterator]: () => iterator})));\n for await (const value of Flux.from(transformer(firstSignal, rest)).iterate(signal, context)) {\n yield value;\n }\n } catch (error) {\n for await (const value of Flux.from(transformer(Signal.error<T>(error), Flux.error<T>(error))).iterate(signal, context)) {\n yield value;\n }\n }\n });\n};\n\nFlux.prototype.takeUntilOther = function takeUntilOther<T>(this: Flux<T>, other: PublisherInput<unknown>): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const stop: Promise<true> = firstValueFromContext(other, signal, context).then(() => true);\n const iterator = toAsyncIterator(source.iterate(signal, context));\n try {\n while (!signal.aborted) {\n const result = await Promise.race<IteratorResult<T> | true>([iterator.next(), stop]);\n if (result === true || result.done) {\n return;\n }\n yield result.value;\n }\n } finally {\n await iterator.return?.();\n }\n });\n};\n\nFlux.prototype.timed = function timed<T>(\n this: Flux<T>,\n scheduler: Scheduler = Schedulers.timeout()\n): Flux<Timed<T>> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let last = scheduler.now();\n for await (const value of source.iterate(signal, context)) {\n const timestamp = scheduler.now();\n yield {elapsed: timestamp - last, timestamp, value};\n last = timestamp;\n }\n });\n};\n\nFlux.prototype.withLatestFrom = function withLatestFrom<T, U, R = readonly [T, U]>(\n this: Flux<T>,\n other: PublisherInput<U>,\n combinator?: (left: T, right: U) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let latest: U | undefined;\n let hasLatest = false;\n void (async () => {\n for await (const value of Flux.from(other).iterate(signal, context)) {\n latest = value;\n hasLatest = true;\n }\n })();\n for await (const value of source.iterate(signal, context)) {\n if (hasLatest) {\n yield combinator ? combinator(value, latest as U) : ([value, latest] as unknown as R);\n }\n }\n });\n};\n\nFlux.prototype.zipWithIterable = function zipWithIterable<T, U, R = readonly [T, U]>(\n this: Flux<T>,\n other: Iterable<U>,\n combinator?: (left: T, right: U) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const iterator = other[Symbol.iterator]();\n for await (const value of source.iterate(signal, context)) {\n const next = iterator.next();\n if (next.done) {\n return;\n }\n yield combinator ? combinator(value, next.value) : ([value, next.value] as unknown as R);\n }\n });\n};\n\n/** Returns a Flux that preserves values while allowing delayed-error naming parity. */\nfunction delayErrors<T>(source: Flux<T>): Flux<T> {\n return source;\n}\n\n/** Collects a finite publisher input into an array. */\nasync function collect<T>(source: PublisherInput<T>, signal: AbortSignal, context: Context): Promise<T[]> {\n return collectPublisher(Flux.from(source), signal, context);\n}\n\n/** Consumes a publisher input and ignores all values. */\nasync function drain(source: PublisherInput<unknown>, signal: AbortSignal, context: Context): Promise<void> {\n await drainPublisher(Flux.from(source), signal, context);\n}\n\n/** Resolves the first value from a publisher input using the current subscriber context. */\nasync function firstValueFromContext<T>(source: PublisherInput<T>, signal: AbortSignal, context: Context): Promise<T | undefined> {\n const iterator = toAsyncIterator(Flux.from(source).iterate(signal, context));\n try {\n const result = await iterator.next();\n return result.done ? undefined : result.value;\n } finally {\n await iterator.return?.();\n }\n}\n\n/** Returns true when a value is a duration input instead of a publisher input. */\nfunction isDuration(value: unknown): value is DurationInput {\n return typeof value === \"number\" || (typeof value === \"object\" && value !== null && !isPublisherLike(value));\n}\n\n/** Returns true when a value looks like a publisher or iterable source. */\nfunction isPublisherLike(value: object): boolean {\n return (\n typeof (value as { subscribe?: unknown }).subscribe === \"function\" ||\n typeof (value as { then?: unknown }).then === \"function\" ||\n typeof (value as { [Symbol.iterator]?: unknown })[Symbol.iterator] === \"function\" ||\n typeof (value as { [Symbol.asyncIterator]?: unknown })[Symbol.asyncIterator] === \"function\"\n );\n}\n\n/** Samples the latest source value whenever a scheduler period elapses. */\nfunction samplePeriodically<T>(source: Flux<T>, period: DurationInput, scheduler: Scheduler): Flux<T> {\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<T>(signal);\n let latest: T | undefined;\n let hasLatest = false;\n const periodic = scheduler.schedulePeriodically(() => {\n if (hasLatest) {\n queue.push(latest as T);\n hasLatest = false;\n }\n }, period, period);\n signal.addEventListener(\"abort\", () => periodic.dispose(), {once: true});\n void (async () => {\n try {\n for await (const value of source.iterate(signal, context)) {\n latest = value;\n hasLatest = true;\n }\n periodic.dispose();\n queue.complete();\n } catch (error) {\n periodic.dispose();\n queue.error(error);\n }\n })();\n return queue;\n });\n}\n\n/** Samples the latest source value whenever another publisher emits. */\nfunction sampleWithPublisher<T>(source: Flux<T>, sampler: PublisherInput<unknown>): Flux<T> {\n return new Flux((signal, context) => {\n const queue = new AsyncQueue<T>(signal);\n let latest: T | undefined;\n let hasLatest = false;\n void (async () => {\n try {\n await Promise.all([\n (async () => {\n for await (const value of source.iterate(signal, context)) {\n latest = value;\n hasLatest = true;\n }\n })(),\n (async () => {\n for await (const _ of Flux.from(sampler).iterate(signal, context)) {\n if (hasLatest) {\n queue.push(latest as T);\n hasLatest = false;\n }\n }\n })()\n ]);\n queue.complete();\n } catch (error) {\n queue.error(error);\n }\n })();\n return queue;\n });\n}\n"],"mappings":";;;;;;;;AAqIA,KAAK,UAAU,sBAAsB,SAAS,oBAE1C,QACO;CACP,OAAO,YAAY,KAAK,UAAU,MAAM,CAAC;AAC7C;AAEA,KAAK,UAAU,oBAAoB,SAAS,kBAExC,QACO;CACP,OAAO,KAAK,WAAU,UAAS,KAAK,aAAa,OAAO,KAAK,CAAC,CAAC;AACnE;AAEA,KAAK,UAAU,SAAS,SAAS,OAE7B,UACA,eACO;CACP,MAAM,SAAS;CACf,OAAO,IAAI,KAAK,iBAAiB,QAAQ,SAAS;EAC9C,MAAM,QAAa,CAAC;EACpB,WAAW,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO,GACpD,MAAM,KAAK,KAAK;EAEpB,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,UAAU,CAAC,OAAO,SAAS,SAAS,GAAG;GACrE,MAAM,QAAQ,MAAM;GACpB,MAAM;GACN,WAAW,MAAM,SAAS,KAAK,KAAK,SAAS,KAAK,CAAC,CAAC,CAAC,QAAQ,QAAQ,OAAO,GACxE,MAAM,KAAK,KAAK;EAExB;CACJ,CAAC;AACL;AAEA,KAAK,UAAU,aAAa,SAAS,WAEjC,UACA,eACO;CACP,MAAM,SAAS;CACf,OAAO,IAAI,KAAK,iBAAiB,QAAQ,SAAS;EAC9C,MAAM,QAAa,CAAC;EACpB,WAAW,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO,GACpD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ACT,YAAY;KAChB;IACJ,EAAA,CAAG,IACF,YAAY;KACT,WAAW,MAAM,KAAK,KAAK,KAAK,OAAO,CAAC,CAAC,QAAQ,QAAQ,OAAO,GAC5D,IAAI,WAAW;MACX,MAAM,KAAK,MAAW;MACtB,YAAY;KAChB;IAER,EAAA,CAAG,CACP,CAAC;IACD,MAAM,SAAS;GACnB,SAAS,OAAO;IACZ,MAAM,MAAM,KAAK;GACrB;EACJ,EAAA,CAAG;EACH,OAAO;CACX,CAAC;AACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/publisher/operators/lifecycle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/publisher/operators/lifecycle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAMtD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAEjE,+EAA+E;AAC/E,MAAM,WAAW,eAAe,CAAC,CAAC;IAC9B,mCAAmC;IACnC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAExB,uCAAuC;IACvC,OAAO,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAE/B,2CAA2C;IAC3C,UAAU,CAAC,I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GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEpC,oDAAoD;QACpD,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QAEjB,+DAA+D;QAC/D,SAAS,IAAI,OAAO,qBAAqB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAEnD,mFAAmF;QACnF,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEzC,kFAAkF;QAClF,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAExE,0DAA0D;QAC1D,QAAQ,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;KAChC;CACJ"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UNBOUNDED_DEMAND } from "../../core/demand.js";
|
|
2
|
+
import { collectPublisher, drainPublisher } from "../../internal/publisher-terminal.js";
|
|
1
3
|
import { Schedulers } from "../../schedulers/schedulers.js";
|
|
2
4
|
import { scheduleDelay } from "../helpers.js";
|
|
3
5
|
import { Flux } from "../flux.js";
|
|
@@ -10,15 +12,11 @@ Flux.prototype.cache = function cache(_ttl, _scheduler) {
|
|
|
10
12
|
let failure;
|
|
11
13
|
let loaded;
|
|
12
14
|
return new Flux(async function* (signal, context) {
|
|
13
|
-
loaded ?? (loaded = (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} catch (error) {
|
|
19
|
-
failure = error;
|
|
20
|
-
}
|
|
21
|
-
})());
|
|
15
|
+
loaded ?? (loaded = collectPublisher(source, signal, context).then((nextValues) => {
|
|
16
|
+
values = nextValues;
|
|
17
|
+
}, (error) => {
|
|
18
|
+
failure = error;
|
|
19
|
+
}));
|
|
22
20
|
await loaded;
|
|
23
21
|
if (failure !== void 0) throw failure;
|
|
24
22
|
yield* values ?? [];
|
|
@@ -69,7 +67,7 @@ Flux.prototype.delayUntil = function delayUntil(triggerProvider) {
|
|
|
69
67
|
};
|
|
70
68
|
Flux.prototype.doAfterTerminate = function doAfterTerminate(callback) {
|
|
71
69
|
const source = this;
|
|
72
|
-
return
|
|
70
|
+
return liftOneToOne(source, async function* (signal, context) {
|
|
73
71
|
let terminated = false;
|
|
74
72
|
try {
|
|
75
73
|
for await (const value of source.iterate(signal, context)) yield value;
|
|
@@ -77,28 +75,40 @@ Flux.prototype.doAfterTerminate = function doAfterTerminate(callback) {
|
|
|
77
75
|
} finally {
|
|
78
76
|
if (terminated) callback();
|
|
79
77
|
}
|
|
80
|
-
})
|
|
78
|
+
}, () => ({
|
|
79
|
+
onNext: passThrough,
|
|
80
|
+
/** Runs the callback after non-cancellation terminal signals. */
|
|
81
|
+
onFinally(signal) {
|
|
82
|
+
if (signal !== "cancel") callback();
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
81
85
|
};
|
|
82
86
|
Flux.prototype.doFirst = function doFirst(callback) {
|
|
83
87
|
const source = this;
|
|
84
|
-
return
|
|
88
|
+
return liftOneToOne(source, (signal, context) => {
|
|
85
89
|
callback();
|
|
86
90
|
return source.iterate(signal, context);
|
|
91
|
+
}, () => {
|
|
92
|
+
callback();
|
|
93
|
+
return { onNext: passThrough };
|
|
87
94
|
});
|
|
88
95
|
};
|
|
89
96
|
Flux.prototype.doOnCancel = function doOnCancel(callback) {
|
|
90
97
|
const source = this;
|
|
91
|
-
return
|
|
98
|
+
return liftOneToOne(source, (signal, context) => {
|
|
92
99
|
signal.addEventListener("abort", callback, { once: true });
|
|
93
100
|
return source.iterate(signal, context);
|
|
94
|
-
})
|
|
101
|
+
}, () => ({
|
|
102
|
+
onNext: passThrough,
|
|
103
|
+
onCancel: callback
|
|
104
|
+
}));
|
|
95
105
|
};
|
|
96
106
|
Flux.prototype.doOnDiscard = function doOnDiscard(_type, _callback) {
|
|
97
107
|
return this;
|
|
98
108
|
};
|
|
99
109
|
Flux.prototype.doOnEach = function doOnEach(callback) {
|
|
100
110
|
const source = this;
|
|
101
|
-
return
|
|
111
|
+
return liftOneToOne(source, async function* (signal, context) {
|
|
102
112
|
try {
|
|
103
113
|
for await (const value of source.iterate(signal, context)) {
|
|
104
114
|
callback(Signal.next(value));
|
|
@@ -109,12 +119,20 @@ Flux.prototype.doOnEach = function doOnEach(callback) {
|
|
|
109
119
|
callback(Signal.error(error));
|
|
110
120
|
throw error;
|
|
111
121
|
}
|
|
112
|
-
})
|
|
122
|
+
}, () => ({
|
|
123
|
+
/** Observes one next signal and relays its value. */
|
|
124
|
+
onNext(value) {
|
|
125
|
+
callback(Signal.next(value));
|
|
126
|
+
return value;
|
|
127
|
+
},
|
|
128
|
+
onError: (error) => callback(Signal.error(error)),
|
|
129
|
+
onComplete: () => callback(Signal.complete())
|
|
130
|
+
}));
|
|
113
131
|
};
|
|
114
132
|
Flux.prototype.doOnRequest = function doOnRequest(callback) {
|
|
115
133
|
const source = this;
|
|
116
134
|
return liftOneToOne(source, (signal, context) => {
|
|
117
|
-
callback(
|
|
135
|
+
callback(UNBOUNDED_DEMAND);
|
|
118
136
|
return source.iterate(signal, context);
|
|
119
137
|
}, () => ({
|
|
120
138
|
onNext: passThrough,
|
|
@@ -133,7 +151,7 @@ Flux.prototype.doOnSubscribe = function doOnSubscribe(callback) {
|
|
|
133
151
|
};
|
|
134
152
|
Flux.prototype.doOnTerminate = function doOnTerminate(callback) {
|
|
135
153
|
const source = this;
|
|
136
|
-
return
|
|
154
|
+
return liftOneToOne(source, async function* (signal, context) {
|
|
137
155
|
try {
|
|
138
156
|
for await (const value of source.iterate(signal, context)) yield value;
|
|
139
157
|
callback();
|
|
@@ -141,7 +159,11 @@ Flux.prototype.doOnTerminate = function doOnTerminate(callback) {
|
|
|
141
159
|
callback();
|
|
142
160
|
throw error;
|
|
143
161
|
}
|
|
144
|
-
})
|
|
162
|
+
}, () => ({
|
|
163
|
+
onNext: passThrough,
|
|
164
|
+
onError: callback,
|
|
165
|
+
onComplete: callback
|
|
166
|
+
}));
|
|
145
167
|
};
|
|
146
168
|
Flux.prototype.limitRate = function limitRate(_highTide, _lowTide) {
|
|
147
169
|
return this;
|
|
@@ -212,7 +234,7 @@ Flux.prototype.tag = function tag(_key, _value) {
|
|
|
212
234
|
};
|
|
213
235
|
Flux.prototype.tap = function tap(listener) {
|
|
214
236
|
const source = this;
|
|
215
|
-
return
|
|
237
|
+
return liftOneToOne(source, async function* (signal, context) {
|
|
216
238
|
const actual = typeof listener === "function" ? listener() : listener;
|
|
217
239
|
signal.addEventListener("abort", () => actual.onCancel?.(), { once: true });
|
|
218
240
|
try {
|
|
@@ -228,6 +250,27 @@ Flux.prototype.tap = function tap(listener) {
|
|
|
228
250
|
actual.onSignal?.(Signal.error(error));
|
|
229
251
|
throw error;
|
|
230
252
|
}
|
|
253
|
+
}, () => {
|
|
254
|
+
const actual = typeof listener === "function" ? listener() : listener;
|
|
255
|
+
return {
|
|
256
|
+
/** Notifies the listener about one value and relays it. */
|
|
257
|
+
onNext(value) {
|
|
258
|
+
actual.onNext?.(value);
|
|
259
|
+
actual.onSignal?.(Signal.next(value));
|
|
260
|
+
return value;
|
|
261
|
+
},
|
|
262
|
+
/** Notifies the listener about an error signal. */
|
|
263
|
+
onError(error) {
|
|
264
|
+
actual.onError?.(error);
|
|
265
|
+
actual.onSignal?.(Signal.error(error));
|
|
266
|
+
},
|
|
267
|
+
/** Notifies the listener about successful completion. */
|
|
268
|
+
onComplete() {
|
|
269
|
+
actual.onComplete?.();
|
|
270
|
+
actual.onSignal?.(Signal.complete());
|
|
271
|
+
},
|
|
272
|
+
onCancel: () => actual.onCancel?.()
|
|
273
|
+
};
|
|
231
274
|
});
|
|
232
275
|
};
|
|
233
276
|
Flux.prototype.toStream = function toStream() {
|
|
@@ -243,7 +286,7 @@ function isPublisherLike(value) {
|
|
|
243
286
|
}
|
|
244
287
|
/** Consumes a publisher input and ignores all emitted values. */
|
|
245
288
|
async function drain(source, signal, context) {
|
|
246
|
-
|
|
289
|
+
await drainPublisher(Flux.from(source), signal, context);
|
|
247
290
|
}
|
|
248
291
|
/** Creates a no-op subscription object for doOnSubscribe callbacks. */
|
|
249
292
|
function noopSubscription() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.js","names":[],"sources":["../../../src/publisher/operators/lifecycle.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Reactor lifecycle, context, logging and browser backpressure compatibility operators.\n */\nimport {Context} from \"@/context/context.js\";\nimport {ContextView} from \"@/context/context-view.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {scheduleDelay} from \"@/publisher/helpers.js\";\nimport {liftOneToOne, subscriberContext} from \"@/publisher/operators/lift.js\";\nimport type {PublisherInput} from \"@/publisher/types.js\";\nimport {Schedulers} from \"@/schedulers/schedulers.js\";\nimport type {DurationInput, Scheduler} from \"@/schedulers/types.js\";\nimport {Signal} from \"@/signal/signal.js\";\nimport type {Subscription} from \"@/subscription/subscription.js\";\n\n/** Listener shape accepted by the lightweight `tap` compatibility operator. */\nexport interface FluxTapListener<T> {\n /** Invoked for each next value. */\n onNext?(value: T): void;\n\n /** Invoked when the sequence fails. */\n onError?(error: unknown): void;\n\n /** Invoked when the sequence completes. */\n onComplete?(): void;\n\n /** Invoked when the sequence is cancelled. */\n onCancel?(): void;\n\n /** Invoked for materialized next, error and complete signals. */\n onSignal?(signal: Signal<T>): void;\n}\n\ndeclare module \"@/publisher/flux.js\" {\n /** Lifecycle, context and browser backpressure compatibility operators added to Flux. */\n interface Flux<T> {\n /** Replays the collected source values to later subscribers. */\n cache(ttl?: DurationInput, scheduler?: Scheduler): Flux<T>;\n\n /** Schedules cancellation on the provided scheduler when supported by the source. */\n cancelOn(scheduler: Scheduler): Flux<T>;\n\n /** Adds an assembly checkpoint marker. Browser implementation keeps the source unchanged. */\n checkpoint(description?: string, forceStackTrace?: boolean): Flux<T>;\n\n /** Captures ambient context when an integration provides it. Browser implementation keeps the source unchanged. */\n contextCapture(): Flux<T>;\n\n /** Writes subscriber context for upstream operators. */\n contextWrite(context: ContextView | Context | ((context: Context) => Context)): Flux<T>;\n\n /** Delays subscribing to the source. */\n delaySequence(delay: DurationInput, scheduler?: Scheduler): Flux<T>;\n\n /** Delays subscribing to the source by time or until another publisher signals. */\n delaySubscription(delay: DurationInput | PublisherInput<unknown>, scheduler?: Scheduler): Flux<T>;\n\n /** Delays each value until the trigger publisher derived from that value completes. */\n delayUntil(triggerProvider: (value: T) => PublisherInput<unknown>): Flux<T>;\n\n /** Invokes a callback after successful or failed termination. */\n doAfterTerminate(callback: () => void): Flux<T>;\n\n /** Invokes a callback before source iteration starts. */\n doFirst(callback: () => void): Flux<T>;\n\n /** Invokes a callback when the subscription is cancelled. */\n doOnCancel(callback: () => void): Flux<T>;\n\n /** Registers a discard hook. Browser implementation keeps values unchanged. */\n doOnDiscard<R>(type: new (...args: never[]) => R, callback: (value: R) => void): Flux<T>;\n\n /** Invokes a callback for every materialized source signal. */\n doOnEach(callback: (signal: Signal<T>) => void): Flux<T>;\n\n /** Invokes a callback when unbounded demand is requested by the async bridge. */\n doOnRequest(callback: (request: number) => void): Flux<T>;\n\n /** Invokes a callback with a synthetic subscription before source iteration starts. */\n doOnSubscribe(callback: (subscription: Subscription) => void): Flux<T>;\n\n /** Invokes a callback before successful or failed termination. */\n doOnTerminate(callback: () => void): Flux<T>;\n\n /** Keeps request batching metadata. Browser async iteration returns this source unchanged. */\n limitRate(highTide: number, lowTide?: number): Flux<T>;\n\n /** Limits the total number of requested values. */\n limitRequest(n: number): Flux<T>;\n\n /** Logs source signals to the console. */\n log(category?: string): Flux<T>;\n\n /** Keeps metrics compatibility metadata. Browser implementation returns this source unchanged. */\n metrics(): Flux<T>;\n\n /** Keeps a human-readable sequence name. Browser implementation returns this source unchanged. */\n name(name: string): Flux<T>;\n\n /** Buffers on backpressure. Browser async iteration already buffers by pull demand. */\n onBackpressureBuffer(...args: unknown[]): Flux<T>;\n\n /** Drops on backpressure. Browser async iteration keeps pull demand and returns this source unchanged. */\n onBackpressureDrop(callback?: (value: T) => void): Flux<T>;\n\n /** Fails on backpressure. Browser async iteration keeps pull demand and returns this source unchanged. */\n onBackpressureError(): Flux<T>;\n\n /** Keeps only the latest value on backpressure. Browser async iteration returns this source unchanged. */\n onBackpressureLatest(): Flux<T>;\n\n /** Completes instead of failing when the optional predicate accepts the error. */\n onErrorComplete(predicate?: (error: unknown) => boolean): Flux<T>;\n\n /** Continues with completion after invoking an error continuation callback. */\n onErrorContinue(callback: (error: unknown, value: T | undefined) => void): Flux<T>;\n\n /** Stops error continuation mode. Browser implementation returns this source unchanged. */\n onErrorStop(): Flux<T>;\n\n /** Drops terminal-reference retention hints. Browser implementation returns this source unchanged. */\n onTerminateDetach(): Flux<T>;\n\n /** Transforms a shared source or returns a shared source view. */\n publish<R = T>(transformer?: (source: Flux<T>) => PublisherInput<R>): Flux<R>;\n\n /** Returns a Mono with the next value from this source. */\n publishNext(): import(\"@/publisher/mono.js\").Mono<T>;\n\n /** Returns a replaying view of this source. */\n replay(...args: unknown[]): Flux<T>;\n\n /** Returns a shared browser view of this source. */\n share(): Flux<T>;\n\n /** Returns a Mono with the next value from a shared source. */\n shareNext(): import(\"@/publisher/mono.js\").Mono<T>;\n\n /** Stores a metadata tag. Browser implementation returns this source unchanged. */\n tag(key: string, value: string): Flux<T>;\n\n /** Installs listener callbacks for values, terminal signals, and cancellation. */\n tap(listener: FluxTapListener<T> | (() => FluxTapListener<T>)): Flux<T>;\n\n /** Returns an async iterator stream view of this Flux. */\n toStream(): AsyncIterable<T>;\n }\n}\n\nFlux.prototype.cache = function cache<T>(this: Flux<T>, _ttl?: DurationInput, _scheduler?: Scheduler): Flux<T> {\n const source = this;\n let values: T[] | undefined;\n let failure: unknown;\n let loaded: Promise<void> | undefined;\n return new Flux(async function* (signal, context) {\n loaded ??= (async () => {\n const nextValues: T[] = [];\n try {\n for await (const value of source.iterate(signal, context)) {\n nextValues.push(value);\n }\n values = nextValues;\n } catch (error) {\n failure = error;\n }\n })();\n await loaded;\n if (failure !== undefined) {\n throw failure;\n }\n yield* values ?? [];\n });\n};\n\nFlux.prototype.cancelOn = function cancelOn<T>(this: Flux<T>, _scheduler: Scheduler): Flux<T> {\n return this;\n};\n\nFlux.prototype.checkpoint = function checkpoint<T>(\n this: Flux<T>,\n _description?: string,\n _forceStackTrace?: boolean\n): Flux<T> {\n return this;\n};\n\nFlux.prototype.contextCapture = function contextCapture<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.contextWrite = function contextWrite<T>(\n this: Flux<T>,\n contextUpdate: ContextView | Context | ((context: Context) => Context)\n): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => {\n const nextContext =\n typeof contextUpdate === \"function\"\n ? contextUpdate(context)\n : context.putAll(contextUpdate);\n return source.iterate(signal, nextContext);\n },\n subscriber => {\n const context = subscriberContext(subscriber);\n const nextContext =\n typeof contextUpdate === \"function\"\n ? contextUpdate(context)\n : context.putAll(contextUpdate);\n return {\n onNext: passThrough,\n currentContext: () => nextContext\n };\n }\n );\n};\n\nFlux.prototype.delaySequence = function delaySequence<T>(\n this: Flux<T>,\n delay: DurationInput,\n scheduler?: Scheduler\n): Flux<T> {\n return this.delaySubscription(delay, scheduler);\n};\n\nFlux.prototype.delaySubscription = function delaySubscription<T>(\n this: Flux<T>,\n delay: DurationInput | PublisherInput<unknown>,\n scheduler?: Scheduler\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n if (isDuration(delay)) {\n await scheduleDelay(scheduler ?? Schedulers.timeout(), delay, signal);\n } else {\n await drain(delay, signal, context);\n }\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.delayUntil = function delayUntil<T>(\n this: Flux<T>,\n triggerProvider: (value: T) => PublisherInput<unknown>\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const value of source.iterate(signal, context)) {\n await drain(triggerProvider(value), signal, context);\n yield value;\n }\n });\n};\n\nFlux.prototype.doAfterTerminate = function doAfterTerminate<T>(this: Flux<T>, callback: () => void): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n let terminated = false;\n try {\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n terminated = true;\n } finally {\n if (terminated) {\n callback();\n }\n }\n });\n};\n\nFlux.prototype.doFirst = function doFirst<T>(this: Flux<T>, callback: () => void): Flux<T> {\n const source = this;\n return new Flux((signal, context) => {\n callback();\n return source.iterate(signal, context);\n });\n};\n\nFlux.prototype.doOnCancel = function doOnCancel<T>(this: Flux<T>, callback: () => void): Flux<T> {\n const source = this;\n return new Flux((signal, context) => {\n signal.addEventListener(\"abort\", callback, {once: true});\n return source.iterate(signal, context);\n });\n};\n\nFlux.prototype.doOnDiscard = function doOnDiscard<T, R>(\n this: Flux<T>,\n _type: new (...args: never[]) => R,\n _callback: (value: R) => void\n): Flux<T> {\n return this;\n};\n\nFlux.prototype.doOnEach = function doOnEach<T>(this: Flux<T>, callback: (signal: Signal<T>) => void): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n try {\n for await (const value of source.iterate(signal, context)) {\n callback(Signal.next(value));\n yield value;\n }\n callback(Signal.complete());\n } catch (error) {\n callback(Signal.error(error));\n throw error;\n }\n });\n};\n\nFlux.prototype.doOnRequest = function doOnRequest<T>(this: Flux<T>, callback: (request: number) => void): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => {\n callback(Number.POSITIVE_INFINITY);\n return source.iterate(signal, context);\n },\n () => ({\n onNext: passThrough,\n onRequest: callback\n })\n );\n};\n\nFlux.prototype.doOnSubscribe = function doOnSubscribe<T>(\n this: Flux<T>,\n callback: (subscription: Subscription) => void\n): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => {\n callback(noopSubscription());\n return source.iterate(signal, context);\n },\n () => ({\n onNext: passThrough,\n onSubscribe: callback\n })\n );\n};\n\nFlux.prototype.doOnTerminate = function doOnTerminate<T>(this: Flux<T>, callback: () => void): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n try {\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n callback();\n } catch (error) {\n callback();\n throw error;\n }\n });\n};\n\nFlux.prototype.limitRate = function limitRate<T>(this: Flux<T>, _highTide: number, _lowTide?: number): Flux<T> {\n return this;\n};\n\nFlux.prototype.limitRequest = function limitRequest<T>(this: Flux<T>, n: number): Flux<T> {\n return this.take(n);\n};\n\nFlux.prototype.log = function log<T>(this: Flux<T>, category = \"Flux\"): Flux<T> {\n return this.doOnEach(signal => console.debug(category, signal.type, signal.value ?? signal.error));\n};\n\nFlux.prototype.metrics = function metrics<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.name = function name<T>(this: Flux<T>, _name: string): Flux<T> {\n return this;\n};\n\nFlux.prototype.onBackpressureBuffer = function onBackpressureBuffer<T>(this: Flux<T>, ..._args: unknown[]): Flux<T> {\n return this;\n};\n\nFlux.prototype.onBackpressureDrop = function onBackpressureDrop<T>(\n this: Flux<T>,\n _callback?: (value: T) => void\n): Flux<T> {\n return this;\n};\n\nFlux.prototype.onBackpressureError = function onBackpressureError<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.onBackpressureLatest = function onBackpressureLatest<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.onErrorComplete = function onErrorComplete<T>(\n this: Flux<T>,\n predicate: (error: unknown) => boolean = () => true\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n try {\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n } catch (error) {\n if (!predicate(error)) {\n throw error;\n }\n }\n });\n};\n\nFlux.prototype.onErrorContinue = function onErrorContinue<T>(\n this: Flux<T>,\n callback: (error: unknown, value: T | undefined) => void\n): Flux<T> {\n return this.onErrorResume(error => {\n callback(error, undefined);\n return Flux.empty<T>();\n });\n};\n\nFlux.prototype.onErrorStop = function onErrorStop<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.onTerminateDetach = function onTerminateDetach<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.publish = function publish<T, R = T>(\n this: Flux<T>,\n transformer?: (source: Flux<T>) => PublisherInput<R>\n): Flux<R> {\n return transformer ? Flux.from(transformer(this.share())) : (this.share() as unknown as Flux<R>);\n};\n\nFlux.prototype.publishNext = function publishNext<T>(this: Flux<T>) {\n return this.next();\n};\n\nFlux.prototype.replay = function replay<T>(this: Flux<T>, ..._args: unknown[]): Flux<T> {\n return this.cache();\n};\n\nFlux.prototype.share = function share<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.shareNext = function shareNext<T>(this: Flux<T>) {\n return this.next();\n};\n\nFlux.prototype.tag = function tag<T>(this: Flux<T>, _key: string, _value: string): Flux<T> {\n return this;\n};\n\nFlux.prototype.tap = function tap<T>(this: Flux<T>, listener: FluxTapListener<T> | (() => FluxTapListener<T>)): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n const actual = typeof listener === \"function\" ? listener() : listener;\n signal.addEventListener(\"abort\", () => actual.onCancel?.(), {once: true});\n try {\n for await (const value of source.iterate(signal, context)) {\n actual.onNext?.(value);\n actual.onSignal?.(Signal.next(value));\n yield value;\n }\n actual.onComplete?.();\n actual.onSignal?.(Signal.complete());\n } catch (error) {\n actual.onError?.(error);\n actual.onSignal?.(Signal.error(error));\n throw error;\n }\n });\n};\n\nFlux.prototype.toStream = function toStream<T>(this: Flux<T>): AsyncIterable<T> {\n return this;\n};\n\n/** Returns true when a value can be treated as a duration input. */\nfunction isDuration(value: unknown): value is DurationInput {\n return typeof value === \"number\" || (typeof value === \"object\" && value !== null && !isPublisherLike(value));\n}\n\n/** Returns true when a value looks like a publisher or iterable source. */\nfunction isPublisherLike(value: object): boolean {\n return (\n typeof (value as { subscribe?: unknown }).subscribe === \"function\" ||\n typeof (value as { then?: unknown }).then === \"function\" ||\n typeof (value as { [Symbol.iterator]?: unknown })[Symbol.iterator] === \"function\" ||\n typeof (value as { [Symbol.asyncIterator]?: unknown })[Symbol.asyncIterator] === \"function\"\n );\n}\n\n/** Consumes a publisher input and ignores all emitted values. */\nasync function drain(source: PublisherInput<unknown>, signal: AbortSignal, context: Context): Promise<void> {\n for await (const _ of Flux.from(source).iterate(signal, context)) {\n // ignored\n }\n}\n\n/** Creates a no-op subscription object for doOnSubscribe callbacks. */\nfunction noopSubscription(): Subscription {\n return {\n /** Ignores request accounting for synthetic subscriptions. */\n request() {\n // no-op\n },\n /** Ignores cancellation for synthetic subscriptions. */\n cancel() {\n // no-op\n }\n };\n}\n\n/** Returns an operator value unchanged. */\nfunction passThrough<T>(value: T): T {\n return value;\n}\n"],"mappings":";;;;;;AAqJA,KAAK,UAAU,QAAQ,SAAS,MAAwB,MAAsB,YAAiC;CAC3G,MAAM,SAAS;CACf,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO,IAAI,KAAK,iBAAiB,QAAQ,SAAS;EAC9C,WAAA,UAAY,YAAY;GACpB,MAAM,aAAkB,CAAC;GACzB,IAAI;IACA,WAAW,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO,GACpD,WAAW,KAAK,KAAK;IAEzB,SAAS;GACb,SAAS,OAAO;IACZ,UAAU;GACd;EACJ,EAAA,CAAG;EACH,MAAM;EACN,IAAI,YAAY,QACZ,MAAM;EAEV,OAAO,UAAU,CAAC;CACtB,CAAC;AACL;AAEA,KAAK,UAAU,WAAW,SAAS,SAA2B,YAAgC;CAC1F,OAAO;AACX;AAEA,KAAK,UAAU,aAAa,SAAS,WAEjC,cACA,kBACO;CACP,OAAO;AACX;AAEA,KAAK,UAAU,iBAAiB,SAAS,iBAA0C;CAC/E,OAAO;AACX;AAEA,KAAK,UAAU,eAAe,SAAS,aAEnC,eACO;CACP,MAAM,SAAS;CACf,OAAO,aACH,SACC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,UAAU,WAAW,SAAS,WAA6C;CAC5E,OAAO;AACX;;AAGA,SAAS,WAAW,OAAwC;CACxD,OAAO,OAAO,UAAU,YAAa,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,gBAAgB,KAAK;AAC9G;;AAGA,SAAS,gBAAgB,OAAwB;CAC7C,OACI,OAAQ,MAAkC,cAAc,cACxD,OAAQ,MAA6B,SAAS,cAC9C,OAAQ,MAA0C,OAAO,cAAc,cACvE,OAAQ,MAA+C,OAAO,mBAAmB;AAEzF;;AAGA,eAAe,MAAM,QAAiC,QAAqB,SAAiC;CACxG,WAAW,MAAM,KAAK,KAAK,KAAK,MAAM,CAAC,CAAC,QAAQ,QAAQ,OAAO;AAGnE;;AAGA,SAAS,mBAAiC;CACtC,OAAO;;EAEH,UAAU,CAEV;;EAEA,SAAS,CAET;CACJ;AACJ;;AAGA,SAAS,YAAe,OAAa;CACjC,OAAO;AACX"}
|
|
1
|
+
{"version":3,"file":"lifecycle.js","names":[],"sources":["../../../src/publisher/operators/lifecycle.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Reactor lifecycle, context, logging and browser backpressure compatibility operators.\n */\nimport {Context} from \"@/context/context.js\";\nimport {ContextView} from \"@/context/context-view.js\";\nimport {UNBOUNDED_DEMAND} from \"@/core/demand.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {collectPublisher, drainPublisher} from \"@/internal/publisher-terminal.js\";\nimport {scheduleDelay} from \"@/publisher/helpers.js\";\nimport {liftOneToOne, subscriberContext} from \"@/publisher/operators/lift.js\";\nimport type {PublisherInput} from \"@/publisher/types.js\";\nimport {Schedulers} from \"@/schedulers/schedulers.js\";\nimport type {DurationInput, Scheduler} from \"@/schedulers/types.js\";\nimport {Signal} from \"@/signal/signal.js\";\nimport type {Subscription} from \"@/subscription/subscription.js\";\n\n/** Listener shape accepted by the lightweight `tap` compatibility operator. */\nexport interface FluxTapListener<T> {\n /** Invoked for each next value. */\n onNext?(value: T): void;\n\n /** Invoked when the sequence fails. */\n onError?(error: unknown): void;\n\n /** Invoked when the sequence completes. */\n onComplete?(): void;\n\n /** Invoked when the sequence is cancelled. */\n onCancel?(): void;\n\n /** Invoked for materialized next, error and complete signals. */\n onSignal?(signal: Signal<T>): void;\n}\n\ndeclare module \"@/publisher/flux.js\" {\n /** Lifecycle, context and browser backpressure compatibility operators added to Flux. */\n interface Flux<T> {\n /** Replays the collected source values to later subscribers. */\n cache(ttl?: DurationInput, scheduler?: Scheduler): Flux<T>;\n\n /** Schedules cancellation on the provided scheduler when supported by the source. */\n cancelOn(scheduler: Scheduler): Flux<T>;\n\n /** Adds an assembly checkpoint marker. Browser implementation keeps the source unchanged. */\n checkpoint(description?: string, forceStackTrace?: boolean): Flux<T>;\n\n /** Captures ambient context when an integration provides it. Browser implementation keeps the source unchanged. */\n contextCapture(): Flux<T>;\n\n /** Writes subscriber context for upstream operators. */\n contextWrite(context: ContextView | Context | ((context: Context) => Context)): Flux<T>;\n\n /** Delays subscribing to the source. */\n delaySequence(delay: DurationInput, scheduler?: Scheduler): Flux<T>;\n\n /** Delays subscribing to the source by time or until another publisher signals. */\n delaySubscription(delay: DurationInput | PublisherInput<unknown>, scheduler?: Scheduler): Flux<T>;\n\n /** Delays each value until the trigger publisher derived from that value completes. */\n delayUntil(triggerProvider: (value: T) => PublisherInput<unknown>): Flux<T>;\n\n /** Invokes a callback after successful or failed termination. */\n doAfterTerminate(callback: () => void): Flux<T>;\n\n /** Invokes a callback before source iteration starts. */\n doFirst(callback: () => void): Flux<T>;\n\n /** Invokes a callback when the subscription is cancelled. */\n doOnCancel(callback: () => void): Flux<T>;\n\n /** Registers a discard hook. Browser implementation keeps values unchanged. */\n doOnDiscard<R>(type: new (...args: never[]) => R, callback: (value: R) => void): Flux<T>;\n\n /** Invokes a callback for every materialized source signal. */\n doOnEach(callback: (signal: Signal<T>) => void): Flux<T>;\n\n /** Invokes a callback when unbounded demand is requested by the async bridge. */\n doOnRequest(callback: (request: number) => void): Flux<T>;\n\n /** Invokes a callback with a synthetic subscription before source iteration starts. */\n doOnSubscribe(callback: (subscription: Subscription) => void): Flux<T>;\n\n /** Invokes a callback before successful or failed termination. */\n doOnTerminate(callback: () => void): Flux<T>;\n\n /** Keeps request batching metadata. Browser async iteration returns this source unchanged. */\n limitRate(highTide: number, lowTide?: number): Flux<T>;\n\n /** Limits the total number of requested values. */\n limitRequest(n: number): Flux<T>;\n\n /** Logs source signals to the console. */\n log(category?: string): Flux<T>;\n\n /** Keeps metrics compatibility metadata. Browser implementation returns this source unchanged. */\n metrics(): Flux<T>;\n\n /** Keeps a human-readable sequence name. Browser implementation returns this source unchanged. */\n name(name: string): Flux<T>;\n\n /** Buffers on backpressure. Browser async iteration already buffers by pull demand. */\n onBackpressureBuffer(...args: unknown[]): Flux<T>;\n\n /** Drops on backpressure. Browser async iteration keeps pull demand and returns this source unchanged. */\n onBackpressureDrop(callback?: (value: T) => void): Flux<T>;\n\n /** Fails on backpressure. Browser async iteration keeps pull demand and returns this source unchanged. */\n onBackpressureError(): Flux<T>;\n\n /** Keeps only the latest value on backpressure. Browser async iteration returns this source unchanged. */\n onBackpressureLatest(): Flux<T>;\n\n /** Completes instead of failing when the optional predicate accepts the error. */\n onErrorComplete(predicate?: (error: unknown) => boolean): Flux<T>;\n\n /** Continues with completion after invoking an error continuation callback. */\n onErrorContinue(callback: (error: unknown, value: T | undefined) => void): Flux<T>;\n\n /** Stops error continuation mode. Browser implementation returns this source unchanged. */\n onErrorStop(): Flux<T>;\n\n /** Drops terminal-reference retention hints. Browser implementation returns this source unchanged. */\n onTerminateDetach(): Flux<T>;\n\n /** Transforms a shared source or returns a shared source view. */\n publish<R = T>(transformer?: (source: Flux<T>) => PublisherInput<R>): Flux<R>;\n\n /** Returns a Mono with the next value from this source. */\n publishNext(): import(\"@/publisher/mono.js\").Mono<T>;\n\n /** Returns a replaying view of this source. */\n replay(...args: unknown[]): Flux<T>;\n\n /** Returns a shared browser view of this source. */\n share(): Flux<T>;\n\n /** Returns a Mono with the next value from a shared source. */\n shareNext(): import(\"@/publisher/mono.js\").Mono<T>;\n\n /** Stores a metadata tag. Browser implementation returns this source unchanged. */\n tag(key: string, value: string): Flux<T>;\n\n /** Installs listener callbacks for values, terminal signals, and cancellation. */\n tap(listener: FluxTapListener<T> | (() => FluxTapListener<T>)): Flux<T>;\n\n /** Returns an async iterator stream view of this Flux. */\n toStream(): AsyncIterable<T>;\n }\n}\n\nFlux.prototype.cache = function cache<T>(this: Flux<T>, _ttl?: DurationInput, _scheduler?: Scheduler): Flux<T> {\n const source = this;\n let values: T[] | undefined;\n let failure: unknown;\n let loaded: Promise<void> | undefined;\n return new Flux(async function* (signal, context) {\n loaded ??= collectPublisher<T>(source, signal, context).then(\n nextValues => {\n values = nextValues;\n },\n error => {\n failure = error;\n }\n );\n await loaded;\n if (failure !== undefined) {\n throw failure;\n }\n yield* values ?? [];\n });\n};\n\nFlux.prototype.cancelOn = function cancelOn<T>(this: Flux<T>, _scheduler: Scheduler): Flux<T> {\n return this;\n};\n\nFlux.prototype.checkpoint = function checkpoint<T>(\n this: Flux<T>,\n _description?: string,\n _forceStackTrace?: boolean\n): Flux<T> {\n return this;\n};\n\nFlux.prototype.contextCapture = function contextCapture<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.contextWrite = function contextWrite<T>(\n this: Flux<T>,\n contextUpdate: ContextView | Context | ((context: Context) => Context)\n): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => {\n const nextContext =\n typeof contextUpdate === \"function\"\n ? contextUpdate(context)\n : context.putAll(contextUpdate);\n return source.iterate(signal, nextContext);\n },\n subscriber => {\n const context = subscriberContext(subscriber);\n const nextContext =\n typeof contextUpdate === \"function\"\n ? contextUpdate(context)\n : context.putAll(contextUpdate);\n return {\n onNext: passThrough,\n currentContext: () => nextContext\n };\n }\n );\n};\n\nFlux.prototype.delaySequence = function delaySequence<T>(\n this: Flux<T>,\n delay: DurationInput,\n scheduler?: Scheduler\n): Flux<T> {\n return this.delaySubscription(delay, scheduler);\n};\n\nFlux.prototype.delaySubscription = function delaySubscription<T>(\n this: Flux<T>,\n delay: DurationInput | PublisherInput<unknown>,\n scheduler?: Scheduler\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n if (isDuration(delay)) {\n await scheduleDelay(scheduler ?? Schedulers.timeout(), delay, signal);\n } else {\n await drain(delay, signal, context);\n }\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.delayUntil = function delayUntil<T>(\n this: Flux<T>,\n triggerProvider: (value: T) => PublisherInput<unknown>\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const value of source.iterate(signal, context)) {\n await drain(triggerProvider(value), signal, context);\n yield value;\n }\n });\n};\n\nFlux.prototype.doAfterTerminate = function doAfterTerminate<T>(this: Flux<T>, callback: () => void): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n async function* (signal, context) {\n let terminated = false;\n try {\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n terminated = true;\n } finally {\n if (terminated) {\n callback();\n }\n }\n },\n () => ({\n onNext: passThrough,\n /** Runs the callback after non-cancellation terminal signals. */\n onFinally(signal) {\n if (signal !== \"cancel\") {\n callback();\n }\n }\n })\n );\n};\n\nFlux.prototype.doFirst = function doFirst<T>(this: Flux<T>, callback: () => void): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => {\n callback();\n return source.iterate(signal, context);\n },\n () => {\n callback();\n return {onNext: passThrough};\n }\n );\n};\n\nFlux.prototype.doOnCancel = function doOnCancel<T>(this: Flux<T>, callback: () => void): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => {\n signal.addEventListener(\"abort\", callback, {once: true});\n return source.iterate(signal, context);\n },\n () => ({\n onNext: passThrough,\n onCancel: callback\n })\n );\n};\n\nFlux.prototype.doOnDiscard = function doOnDiscard<T, R>(\n this: Flux<T>,\n _type: new (...args: never[]) => R,\n _callback: (value: R) => void\n): Flux<T> {\n return this;\n};\n\nFlux.prototype.doOnEach = function doOnEach<T>(this: Flux<T>, callback: (signal: Signal<T>) => void): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n async function* (signal, context) {\n try {\n for await (const value of source.iterate(signal, context)) {\n callback(Signal.next(value));\n yield value;\n }\n callback(Signal.complete());\n } catch (error) {\n callback(Signal.error(error));\n throw error;\n }\n },\n () => ({\n /** Observes one next signal and relays its value. */\n onNext(value) {\n callback(Signal.next(value));\n return value;\n },\n onError: error => callback(Signal.error(error)),\n onComplete: () => callback(Signal.complete())\n })\n );\n};\n\nFlux.prototype.doOnRequest = function doOnRequest<T>(this: Flux<T>, callback: (request: number) => void): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => {\n callback(UNBOUNDED_DEMAND);\n return source.iterate(signal, context);\n },\n () => ({\n onNext: passThrough,\n onRequest: callback\n })\n );\n};\n\nFlux.prototype.doOnSubscribe = function doOnSubscribe<T>(\n this: Flux<T>,\n callback: (subscription: Subscription) => void\n): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => {\n callback(noopSubscription());\n return source.iterate(signal, context);\n },\n () => ({\n onNext: passThrough,\n onSubscribe: callback\n })\n );\n};\n\nFlux.prototype.doOnTerminate = function doOnTerminate<T>(this: Flux<T>, callback: () => void): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n async function* (signal, context) {\n try {\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n callback();\n } catch (error) {\n callback();\n throw error;\n }\n },\n () => ({\n onNext: passThrough,\n onError: callback,\n onComplete: callback\n })\n );\n};\n\nFlux.prototype.limitRate = function limitRate<T>(this: Flux<T>, _highTide: number, _lowTide?: number): Flux<T> {\n return this;\n};\n\nFlux.prototype.limitRequest = function limitRequest<T>(this: Flux<T>, n: number): Flux<T> {\n return this.take(n);\n};\n\nFlux.prototype.log = function log<T>(this: Flux<T>, category = \"Flux\"): Flux<T> {\n return this.doOnEach(signal => console.debug(category, signal.type, signal.value ?? signal.error));\n};\n\nFlux.prototype.metrics = function metrics<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.name = function name<T>(this: Flux<T>, _name: string): Flux<T> {\n return this;\n};\n\nFlux.prototype.onBackpressureBuffer = function onBackpressureBuffer<T>(this: Flux<T>, ..._args: unknown[]): Flux<T> {\n return this;\n};\n\nFlux.prototype.onBackpressureDrop = function onBackpressureDrop<T>(\n this: Flux<T>,\n _callback?: (value: T) => void\n): Flux<T> {\n return this;\n};\n\nFlux.prototype.onBackpressureError = function onBackpressureError<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.onBackpressureLatest = function onBackpressureLatest<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.onErrorComplete = function onErrorComplete<T>(\n this: Flux<T>,\n predicate: (error: unknown) => boolean = () => true\n): Flux<T> {\n const source = this;\n return new Flux(async function* (signal, context) {\n try {\n for await (const value of source.iterate(signal, context)) {\n yield value;\n }\n } catch (error) {\n if (!predicate(error)) {\n throw error;\n }\n }\n });\n};\n\nFlux.prototype.onErrorContinue = function onErrorContinue<T>(\n this: Flux<T>,\n callback: (error: unknown, value: T | undefined) => void\n): Flux<T> {\n return this.onErrorResume(error => {\n callback(error, undefined);\n return Flux.empty<T>();\n });\n};\n\nFlux.prototype.onErrorStop = function onErrorStop<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.onTerminateDetach = function onTerminateDetach<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.publish = function publish<T, R = T>(\n this: Flux<T>,\n transformer?: (source: Flux<T>) => PublisherInput<R>\n): Flux<R> {\n return transformer ? Flux.from(transformer(this.share())) : (this.share() as unknown as Flux<R>);\n};\n\nFlux.prototype.publishNext = function publishNext<T>(this: Flux<T>) {\n return this.next();\n};\n\nFlux.prototype.replay = function replay<T>(this: Flux<T>, ..._args: unknown[]): Flux<T> {\n return this.cache();\n};\n\nFlux.prototype.share = function share<T>(this: Flux<T>): Flux<T> {\n return this;\n};\n\nFlux.prototype.shareNext = function shareNext<T>(this: Flux<T>) {\n return this.next();\n};\n\nFlux.prototype.tag = function tag<T>(this: Flux<T>, _key: string, _value: string): Flux<T> {\n return this;\n};\n\nFlux.prototype.tap = function tap<T>(this: Flux<T>, listener: FluxTapListener<T> | (() => FluxTapListener<T>)): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n async function* (signal, context) {\n const actual = typeof listener === \"function\" ? listener() : listener;\n signal.addEventListener(\"abort\", () => actual.onCancel?.(), {once: true});\n try {\n for await (const value of source.iterate(signal, context)) {\n actual.onNext?.(value);\n actual.onSignal?.(Signal.next(value));\n yield value;\n }\n actual.onComplete?.();\n actual.onSignal?.(Signal.complete());\n } catch (error) {\n actual.onError?.(error);\n actual.onSignal?.(Signal.error(error));\n throw error;\n }\n },\n () => {\n const actual = typeof listener === \"function\" ? listener() : listener;\n return {\n /** Notifies the listener about one value and relays it. */\n onNext(value) {\n actual.onNext?.(value);\n actual.onSignal?.(Signal.next(value));\n return value;\n },\n /** Notifies the listener about an error signal. */\n onError(error) {\n actual.onError?.(error);\n actual.onSignal?.(Signal.error(error));\n },\n /** Notifies the listener about successful completion. */\n onComplete() {\n actual.onComplete?.();\n actual.onSignal?.(Signal.complete());\n },\n onCancel: () => actual.onCancel?.()\n };\n }\n );\n};\n\nFlux.prototype.toStream = function toStream<T>(this: Flux<T>): AsyncIterable<T> {\n return this;\n};\n\n/** Returns true when a value can be treated as a duration input. */\nfunction isDuration(value: unknown): value is DurationInput {\n return typeof value === \"number\" || (typeof value === \"object\" && value !== null && !isPublisherLike(value));\n}\n\n/** Returns true when a value looks like a publisher or iterable source. */\nfunction isPublisherLike(value: object): boolean {\n return (\n typeof (value as { subscribe?: unknown }).subscribe === \"function\" ||\n typeof (value as { then?: unknown }).then === \"function\" ||\n typeof (value as { [Symbol.iterator]?: unknown })[Symbol.iterator] === \"function\" ||\n typeof (value as { [Symbol.asyncIterator]?: unknown })[Symbol.asyncIterator] === \"function\"\n );\n}\n\n/** Consumes a publisher input and ignores all emitted values. */\nasync function drain(source: PublisherInput<unknown>, signal: AbortSignal, context: Context): Promise<void> {\n await drainPublisher(Flux.from(source), signal, context);\n}\n\n/** Creates a no-op subscription object for doOnSubscribe callbacks. */\nfunction noopSubscription(): Subscription {\n return {\n /** Ignores request accounting for synthetic subscriptions. */\n request() {\n // no-op\n },\n /** Ignores cancellation for synthetic subscriptions. */\n cancel() {\n // no-op\n }\n };\n}\n\n/** Returns an operator value unchanged. */\nfunction passThrough<T>(value: T): T {\n return value;\n}\n"],"mappings":";;;;;;;;AAuJA,KAAK,UAAU,QAAQ,SAAS,MAAwB,MAAsB,YAAiC;CAC3G,MAAM,SAAS;CACf,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO,IAAI,KAAK,iBAAiB,QAAQ,SAAS;EAC9C,WAAA,SAAW,iBAAoB,QAAQ,QAAQ,OAAO,CAAC,CAAC,MACpD,eAAc;GACV,SAAS;EACb,IACA,UAAS;GACL,UAAU;EACd,CACJ;EACA,MAAM;EACN,IAAI,YAAY,QACZ,MAAM;EAEV,OAAO,UAAU,CAAC;CACtB,CAAC;AACL;AAEA,KAAK,UAAU,WAAW,SAAS,SAA2B,YAAgC;CAC1F,OAAO;AACX;AAEA,KAAK,UAAU,aAAa,SAAS,WAEjC,cACA,kBACO;CACP,OAAO;AACX;AAEA,KAAK,UAAU,iBAAiB,SAAS,iBAA0C;CAC/E,OAAO;AACX;AAEA,KAAK,UAAU,eAAe,SAAS,aAEnC,eACO;CACP,MAAM,SAAS;CACf,OAAO,aACH,SACC,QAAQ,YAAY;EACjB,MAAM,cACF,OAAO,kBAAkB,aACnB,cAAc,OAAO,IACrB,QAAQ,OAAO,aAAa;EACtC,OAAO,OAAO,QAAQ,QAAQ,WAAW;CAC7C,IACA,eAAc;EACV,MAAM,UAAU,kBAAkB,UAAU;EAC5C,MAAM,cACF,OAAO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pB,OAAO,WAAW,OAAO,SAAS,CAAC;EACvC,SAAS,OAAO;GACZ,OAAO,UAAU,KAAK;GACtB,OAAO,WAAW,OAAO,MAAM,KAAK,CAAC;GACrC,MAAM;EACV;CACJ,SACM;EACF,MAAM,SAAS,OAAO,aAAa,aAAa,SAAS,IAAI;EAC7D,OAAO;;GAEH,OAAO,OAAO;IACV,OAAO,SAAS,KAAK;IACrB,OAAO,WAAW,OAAO,KAAK,KAAK,CAAC;IACpC,OAAO;GACX;;GAEA,QAAQ,OAAO;IACX,OAAO,UAAU,KAAK;IACtB,OAAO,WAAW,OAAO,MAAM,KAAK,CAAC;GACzC;;GAEA,aAAa;IACT,OAAO,aAAa;IACpB,OAAO,WAAW,OAAO,SAAS,CAAC;GACvC;GACA,gBAAgB,OAAO,WAAW;EACtC;CACJ,CACJ;AACJ;AAEA,KAAK,UAAU,WAAW,SAAS,WAA6C;CAC5E,OAAO;AACX;;AAGA,SAAS,WAAW,OAAwC;CACxD,OAAO,OAAO,UAAU,YAAa,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,gBAAgB,KAAK;AAC9G;;AAGA,SAAS,gBAAgB,OAAwB;CAC7C,OACI,OAAQ,MAAkC,cAAc,cACxD,OAAQ,MAA6B,SAAS,cAC9C,OAAQ,MAA0C,OAAO,cAAc,cACvE,OAAQ,MAA+C,OAAO,mBAAmB;AAEzF;;AAGA,eAAe,MAAM,QAAiC,QAAqB,SAAiC;CACxG,MAAM,eAAe,KAAK,KAAK,MAAM,GAAG,QAAQ,OAAO;AAC3D;;AAGA,SAAS,mBAAiC;CACtC,OAAO;;EAEH,UAAU,CAEV;;EAEA,SAAS,CAET;CACJ;AACJ;;AAGA,SAAS,YAAe,OAAa;CACjC,OAAO;AACX"}
|
|
@@ -37,6 +37,8 @@ export declare function liftFlux<T, R>(source: Flux<T>, sourceFactory: SourceFac
|
|
|
37
37
|
export declare function liftOneToOne<T, R>(source: Flux<T>, sourceFactory: SourceFactory<R>, hooksFactory: (subscriber: Subscriber<R>) => OneToOneOperatorHooks<T, R>): Flux<R>;
|
|
38
38
|
/** Creates a filtering operator that replenishes only values dropped from finite demand. */
|
|
39
39
|
export declare function liftFilter<T>(source: Flux<T>, sourceFactory: SourceFactory<T>, predicate: (value: T) => boolean): Flux<T>;
|
|
40
|
+
/** Creates a limiting operator that never requests more than its remaining item count. */
|
|
41
|
+
export declare function liftTake<T>(source: Flux<T>, sourceFactory: SourceFactory<T>, count: number): Flux<T>;
|
|
40
42
|
/** Returns the context exposed by a subscriber, or the shared empty context. */
|
|
41
43
|
export declare function subscriberContext<T>(subscriber: Subscriber<T>): Context;
|
|
42
44
|
//# sourceMappingURL=lift.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lift.d.ts","sourceRoot":"","sources":["../../../src/publisher/operators/lift.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"lift.d.ts","sourceRoot":"","sources":["../../../src/publisher/operators/lift.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAG7C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAEzC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAEjE,qFAAqF;AACrF,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC;AAElF,gEAAgE;AAChE,MAAM,WAAW,qBAAqB,CAAC,CAAC,EAAE,CAAC;IACvC,qEAAqE;IACrE,MAAM,CAAC,KAAK,EAAE,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