reactor-core-ts 3.2.3 → 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/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/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.map +1 -1
- package/dist/publisher/operators/selection.js +3 -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,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UNBOUNDED_DEMAND } from "../../../core/demand.js";
|
|
2
2
|
import { NoSuchElementError } from "../../../errors/classes.js";
|
|
3
|
+
import { consumePublisher } from "../../../internal/publisher-terminal.js";
|
|
3
4
|
import { identity } from "../../helpers.js";
|
|
4
5
|
import { Flux } from "../../flux.js";
|
|
5
|
-
import {
|
|
6
|
+
import { liftOneToOne } from "../lift.js";
|
|
7
|
+
import { terminalMono } from "../terminal-mono.js";
|
|
6
8
|
//#region src/publisher/operators/compat/flux.ts
|
|
7
9
|
/**
|
|
8
10
|
* @packageDocumentation
|
|
@@ -18,19 +20,16 @@ Flux.prototype.blockLast = function blockLast() {
|
|
|
18
20
|
return this.toPromise();
|
|
19
21
|
};
|
|
20
22
|
Flux.prototype.collect = function collect(supplier, accumulator) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
for (const value of values) accumulator(container, value);
|
|
32
|
-
yield container;
|
|
33
|
-
})();
|
|
23
|
+
return terminalMono(this, UNBOUNDED_DEMAND, () => {
|
|
24
|
+
const container = supplier();
|
|
25
|
+
return {
|
|
26
|
+
/** Accumulates one value into the supplied container. */
|
|
27
|
+
onNext(value) {
|
|
28
|
+
accumulator(container, value);
|
|
29
|
+
return false;
|
|
30
|
+
},
|
|
31
|
+
result: () => container
|
|
32
|
+
};
|
|
34
33
|
});
|
|
35
34
|
};
|
|
36
35
|
Flux.prototype.collectMap = function collectMap(keyExtractor, valueExtractor = identity) {
|
|
@@ -53,31 +52,69 @@ Flux.prototype.concatWithValues = function concatWithValues(...values) {
|
|
|
53
52
|
Flux.prototype.elementAt = function elementAt(index, defaultValue) {
|
|
54
53
|
if (!Number.isInteger(index) || index < 0) throw new RangeError("index must be a non-negative integer");
|
|
55
54
|
const hasDefault = arguments.length > 1;
|
|
56
|
-
return this
|
|
55
|
+
return terminalMono(this, index + 1, () => {
|
|
56
|
+
let remaining = index;
|
|
57
|
+
let result;
|
|
58
|
+
let found = false;
|
|
59
|
+
return {
|
|
60
|
+
/** Skips values until the requested index is reached. */
|
|
61
|
+
onNext(value) {
|
|
62
|
+
if (remaining > 0) {
|
|
63
|
+
remaining -= 1;
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
result = value;
|
|
67
|
+
found = true;
|
|
68
|
+
return true;
|
|
69
|
+
},
|
|
70
|
+
/** Resolves the indexed value, default, or missing-value error. */
|
|
71
|
+
result() {
|
|
72
|
+
if (found) return result;
|
|
73
|
+
if (hasDefault) return defaultValue;
|
|
74
|
+
throw new NoSuchElementError();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
});
|
|
57
78
|
};
|
|
58
79
|
Flux.prototype.hasElements = function hasElements() {
|
|
59
|
-
return this
|
|
80
|
+
return terminalMono(this, 1, () => {
|
|
81
|
+
let present = false;
|
|
82
|
+
return {
|
|
83
|
+
/** Marks the source as non-empty and finishes. */
|
|
84
|
+
onNext() {
|
|
85
|
+
present = true;
|
|
86
|
+
return true;
|
|
87
|
+
},
|
|
88
|
+
result: () => present
|
|
89
|
+
};
|
|
90
|
+
});
|
|
60
91
|
};
|
|
61
92
|
Flux.prototype.hide = function hide() {
|
|
62
93
|
const source = this;
|
|
63
|
-
return
|
|
94
|
+
return liftOneToOne(source, (signal, context) => source.iterate(signal, context), () => ({ onNext: identity }));
|
|
64
95
|
};
|
|
65
96
|
Flux.prototype.ignoreElements = function ignoreElements() {
|
|
66
97
|
return this.then();
|
|
67
98
|
};
|
|
68
99
|
Flux.prototype.last = function last(defaultValue) {
|
|
69
|
-
const source = this;
|
|
70
100
|
const hasDefault = arguments.length > 0;
|
|
71
|
-
return
|
|
101
|
+
return terminalMono(this, UNBOUNDED_DEMAND, () => {
|
|
72
102
|
let seen = false;
|
|
73
103
|
let lastValue;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
104
|
+
return {
|
|
105
|
+
/** Retains the latest source value. */
|
|
106
|
+
onNext(value) {
|
|
107
|
+
seen = true;
|
|
108
|
+
lastValue = value;
|
|
109
|
+
return false;
|
|
110
|
+
},
|
|
111
|
+
/** Resolves the last value, default, or empty-source error. */
|
|
112
|
+
result() {
|
|
113
|
+
if (seen) return lastValue;
|
|
114
|
+
if (hasDefault) return defaultValue;
|
|
115
|
+
throw new NoSuchElementError();
|
|
116
|
+
}
|
|
117
|
+
};
|
|
81
118
|
});
|
|
82
119
|
};
|
|
83
120
|
Flux.prototype.mapNotNull = function mapNotNull(mapper) {
|
|
@@ -90,9 +127,16 @@ Flux.prototype.ofType = function ofType(type) {
|
|
|
90
127
|
return this.filter((value) => value instanceof type).cast();
|
|
91
128
|
};
|
|
92
129
|
Flux.prototype.reduceWith = function reduceWith(supplier, accumulator) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
130
|
+
return terminalMono(this, UNBOUNDED_DEMAND, () => {
|
|
131
|
+
let current = supplier();
|
|
132
|
+
return {
|
|
133
|
+
/** Folds one value into the supplied initial state. */
|
|
134
|
+
onNext(value) {
|
|
135
|
+
current = accumulator(current, value);
|
|
136
|
+
return false;
|
|
137
|
+
},
|
|
138
|
+
result: () => current
|
|
139
|
+
};
|
|
96
140
|
});
|
|
97
141
|
};
|
|
98
142
|
Flux.prototype.scanWith = function scanWith(supplier, accumulator) {
|
|
@@ -137,11 +181,18 @@ Flux.prototype.takeLast = function takeLast(n) {
|
|
|
137
181
|
return new Flux(async function* (signal, context) {
|
|
138
182
|
const values = [];
|
|
139
183
|
let head = 0;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
184
|
+
await consumePublisher(source, signal, context, UNBOUNDED_DEMAND, {
|
|
185
|
+
/** Stores one value in the bounded trailing ring. */
|
|
186
|
+
onNext(value) {
|
|
187
|
+
if (values.length < n) values.push(value);
|
|
188
|
+
else {
|
|
189
|
+
values[head] = value;
|
|
190
|
+
head = (head + 1) % n;
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
},
|
|
194
|
+
result: () => void 0
|
|
195
|
+
});
|
|
145
196
|
for (let index = 0; index < values.length; index += 1) {
|
|
146
197
|
if (signal.aborted) return;
|
|
147
198
|
yield values[(head + index) % values.length];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flux.js","names":[],"sources":["../../../../src/publisher/operators/compat/flux.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Flux, Mono and operator implementation modules.\n */\nimport {NoSuchElementError} from \"@/errors/classes.js\";\nimport {isAsyncIterable} from \"@/internal/iterable.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {identity} from \"@/publisher/helpers.js\";\nimport {Mono} from \"@/publisher/mono.js\";\nimport type {PublisherInput} from \"@/publisher/types.js\";\nimport type {Subscriber} from \"@/subscription/subscriber.js\";\n\n/** Constructor-like runtime value used by `ofType`. */\ntype ClassLike<R> = abstract new (...args: never[]) => R;\n\ndeclare module \"@/publisher/flux.js\" {\n /** Reactor compatibility operators added to Flux. */\n interface Flux<T> {\n /** Passes this Flux to a transformer and returns the transformer's result. */\n as<R>(transformer: (source: Flux<T>) => R): R;\n\n /** Resolves with the first value, or undefined when the source completes empty. */\n blockFirst(): Promise<T | undefined>;\n\n /** Resolves with the last value, or undefined when the source completes empty. */\n blockLast(): Promise<T | undefined>;\n\n /** Creates a container per subscription and accumulates every source value into it. */\n collect<R>(supplier: () => R, accumulator: (container: R, value: T) => void): Mono<R>;\n\n /** Collects source values into a Map using extracted keys and optional mapped values. */\n collectMap<K, V = T>(keyExtractor: (value: T) => K, valueExtractor?: (value: T) => V): Mono<Map<K, V>>;\n\n /** Collects source values into a Map whose keys point to arrays of matching values. */\n collectMultimap<K, V = T>(keyExtractor: (value: T) => K, valueExtractor?: (value: T) => V): Mono<Map<K, V[]>>;\n\n /** Collects all source values into an array and sorts it before emitting. */\n collectSortedList(comparator?: (left: T, right: T) => number): Mono<T[]>;\n\n /** Appends literal values after this Flux completes. */\n concatWithValues(...values: readonly T[]): Flux<T>;\n\n /** Emits the value at a zero-based index, a default, or an error when missing. */\n elementAt(index: number, defaultValue?: T): Mono<T>;\n\n /** Emits true when the source emits at least one value. */\n hasElements(): Mono<boolean>;\n\n /** Wraps this source in a new Flux to hide its concrete identity. */\n hide(): Flux<T>;\n\n /** Drops all values and completes when the source completes successfully. */\n ignoreElements(): Mono<void>;\n\n /** Emits the final source value, an optional default, or an error when empty. */\n last(defaultValue?: T): Mono<T>;\n\n /** Maps each value and drops null or undefined mapping results. */\n mapNotNull<R>(mapper: (value: T) => R | null | undefined): Flux<R>;\n\n /** Keeps only values that are instances of the provided runtime class. */\n ofType<R>(type: ClassLike<R>): Flux<R>;\n\n /** Creates an initial state per subscription and reduces source values into it. */\n reduceWith<R>(supplier: () => R, accumulator: (accumulated: R, value: T) => R): Mono<R>;\n\n /** Creates an initial state per subscription and emits each running accumulation. */\n scanWith<R>(supplier: () => R, accumulator: (accumulated: R, value: T) => R): Flux<R>;\n\n /** Drops the final `n` values from the source. */\n skipLast(n: number): Flux<T>;\n\n /** Collects all source values, sorts them, and replays the sorted values. */\n sort(comparator?: (left: T, right: T) => number): Flux<T>;\n\n /** Subscribes the provided subscriber and returns the same subscriber instance. */\n subscribeWith<S extends Subscriber<T>>(subscriber: S): S;\n\n /** Emits only the final `n` values after the source completes. */\n takeLast(n: number): Flux<T>;\n\n /** Waits for this source and then waits for `other`, ignoring all values. */\n thenEmpty(other: PublisherInput<unknown>): Mono<void>;\n }\n}\n\n\nFlux.prototype.as = function as<T, R>(this: Flux<T>, transformer: (source: Flux<T>) => R): R {\n return transformer(this);\n};\n\nFlux.prototype.blockFirst = function blockFirst<T>(this: Flux<T>): Promise<T | undefined> {\n return this.next().block();\n};\n\nFlux.prototype.blockLast = function blockLast<T>(this: Flux<T>): Promise<T | undefined> {\n return this.toPromise();\n};\n\nFlux.prototype.collect = function collect<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (container: R, value: T) => void\n): Mono<R> {\n const source = this;\n return new Mono((signal, context) => {\n const values = source.iterate(signal, context);\n if (isAsyncIterable<T>(values)) {\n return (async function* () {\n const container = supplier();\n for await (const value of values) {\n accumulator(container, value);\n }\n yield container;\n })();\n }\n return (function* () {\n const container = supplier();\n for (const value of values) {\n accumulator(container, value);\n }\n yield container;\n })();\n });\n};\n\nFlux.prototype.collectMap = function collectMap<T, K, V = T>(\n this: Flux<T>,\n keyExtractor: (value: T) => K,\n valueExtractor: (value: T) => V = identity as (value: T) => V\n): Mono<Map<K, V>> {\n return this.collect(\n () => new Map<K, V>(),\n (map, value) => map.set(keyExtractor(value), valueExtractor(value))\n );\n};\n\nFlux.prototype.collectMultimap = function collectMultimap<T, K, V = T>(\n this: Flux<T>,\n keyExtractor: (value: T) => K,\n valueExtractor: (value: T) => V = identity as (value: T) => V\n): Mono<Map<K, V[]>> {\n return this.collect(\n () => new Map<K, V[]>(),\n (map, value) => {\n const key = keyExtractor(value);\n const bucket = map.get(key);\n if (bucket) {\n bucket.push(valueExtractor(value));\n } else {\n map.set(key, [valueExtractor(value)]);\n }\n }\n );\n};\n\nFlux.prototype.collectSortedList = function collectSortedList<T>(\n this: Flux<T>,\n comparator?: (left: T, right: T) => number\n): Mono<T[]> {\n return this.collectList().map(values => values.sort(comparator));\n};\n\nFlux.prototype.concatWithValues = function concatWithValues<T>(this: Flux<T>, ...values: readonly T[]): Flux<T> {\n return this.concatWith(Flux.just(...values));\n};\n\nFlux.prototype.elementAt = function elementAt<T>(this: Flux<T>, index: number, defaultValue?: T): Mono<T> {\n if (!Number.isInteger(index) || index < 0) {\n throw new RangeError(\"index must be a non-negative integer\");\n }\n const hasDefault = arguments.length > 1;\n return this.skip(index).next().switchIfEmpty(hasDefault ? Mono.just(defaultValue as T) : Mono.error(new NoSuchElementError()));\n};\n\nFlux.prototype.hasElements = function hasElements<T>(this: Flux<T>): Mono<boolean> {\n return this.any(() => true);\n};\n\nFlux.prototype.hide = function hide<T>(this: Flux<T>): Flux<T> {\n const source = this;\n return new Flux((signal, context) => source.iterate(signal, context));\n};\n\nFlux.prototype.ignoreElements = function ignoreElements<T>(this: Flux<T>): Mono<void> {\n return this.then();\n};\n\nFlux.prototype.last = function last<T>(this: Flux<T>, defaultValue?: T): Mono<T> {\n const source = this;\n const hasDefault = arguments.length > 0;\n return new Mono(async function* (signal, context) {\n let seen = false;\n let lastValue: T | undefined;\n for await (const value of source.iterate(signal, context)) {\n seen = true;\n lastValue = value;\n }\n if (seen) {\n yield lastValue as T;\n } else if (hasDefault) {\n yield defaultValue as T;\n } else {\n throw new NoSuchElementError();\n }\n });\n};\n\nFlux.prototype.mapNotNull = function mapNotNull<T, R>(\n this: Flux<T>,\n mapper: (value: T) => R | null | undefined\n): Flux<R> {\n return this.handle((value, sink) => {\n const mapped = mapper(value);\n if (mapped !== null && mapped !== undefined) {\n sink.next(mapped);\n }\n });\n};\n\nFlux.prototype.ofType = function ofType<T, R>(this: Flux<T>, type: ClassLike<R>): Flux<R> {\n return this.filter(value => value instanceof type).cast<R>();\n};\n\nFlux.prototype.reduceWith = function reduceWith<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (accumulated: R, value: T) => R\n): Mono<R> {\n const source = this;\n return new Mono(async function* (signal, context) {\n for await (const value of source.reduce(supplier(), accumulator).iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.scanWith = function scanWith<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (accumulated: R, value: T) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const value of source.scan(supplier(), accumulator).iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.skipLast = function skipLast<T>(this: Flux<T>, n: number): Flux<T> {\n if (!Number.isInteger(n) || n < 0) {\n throw new RangeError(\"skipLast expects a non-negative integer\");\n }\n if (n === 0) {\n return this;\n }\n const source = this;\n return new Flux(async function* (signal, context) {\n const queue: T[] = [];\n let head = 0;\n for await (const value of source.iterate(signal, context)) {\n queue.push(value);\n if (queue.length - head > n) {\n const next = queue[head] as T;\n head += 1;\n if (head > 1024 && head * 2 > queue.length) {\n queue.copyWithin(0, head);\n queue.length -= head;\n head = 0;\n }\n yield next;\n }\n }\n });\n};\n\nFlux.prototype.sort = function sort<T>(this: Flux<T>, comparator?: (left: T, right: T) => number): Flux<T> {\n return new Flux((signal, context) => this.collectSortedList(comparator).flatMapMany(Flux.fromIterable).iterate(signal, context));\n};\n\nFlux.prototype.subscribeWith = function subscribeWith<T, S extends Subscriber<T>>(this: Flux<T>, subscriber: S): S {\n this.subscribe(subscriber);\n return subscriber;\n};\n\nFlux.prototype.takeLast = function takeLast<T>(this: Flux<T>, n: number): Flux<T> {\n if (!Number.isInteger(n) || n < 0) {\n throw new RangeError(\"takeLast expects a non-negative integer\");\n }\n if (n === 0) {\n return Flux.empty<T>();\n }\n const source = this;\n return new Flux(async function* (signal, context) {\n const values: T[] = [];\n let head = 0;\n for await (const value of source.iterate(signal, context)) {\n if (values.length < n) {\n values.push(value);\n } else {\n values[head] = value;\n head = (head + 1) % n;\n }\n }\n for (let index = 0; index < values.length; index += 1) {\n if (signal.aborted) {\n return;\n }\n yield values[(head + index) % values.length] as T;\n }\n });\n};\n\nFlux.prototype.thenEmpty = function thenEmpty<T>(this: Flux<T>, other: PublisherInput<unknown>): Mono<void> {\n return this.thenMany(other).then();\n};\n"],"mappings":";;;;;;;;;;AAuFA,KAAK,UAAU,KAAK,SAAS,GAAwB,aAAwC;CACzF,OAAO,YAAY,IAAI;AAC3B;AAEA,KAAK,UAAU,aAAa,SAAS,aAAqD;CACtF,OAAO,KAAK,KAAK,CAAC,CAAC,MAAM;AAC7B;AAEA,KAAK,UAAU,YAAY,SAAS,YAAoD;CACpF,OAAO,KAAK,UAAU;AAC1B;AAEA,KAAK,UAAU,UAAU,SAAS,QAE9B,UACA,aACO;CACP,MAAM,SAAS;CACf,OAAO,IAAI,MAAM,QAAQ,YAAY;EACjC,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO;EAC7C,IAAI,gBAAmB,MAAM,GACzB,QAAQ,mBAAmB;GACvB,MAAM,YAAY,SAAS;GAC3B,WAAW,MAAM,SAAS,QACtB,YAAY,WAAW,KAAK;GAEhC,MAAM;EACV,EAAA,CAAG;EAEP,QAAQ,aAAa;GACjB,MAAM,YAAY,SAAS;GAC3B,KAAK,MAAM,SAAS,QAChB,YAAY,WAAW,KAAK;GAEhC,MAAM;EACV,EAAA,CAAG;CACP,CAAC;AACL;AAEA,KAAK,UAAU,aAAa,SAAS,WAEjC,cACA,iBAAkC,UACnB;CACf,OAAO,KAAK,8BACF,IAAI,IAAU,IACnB,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AAEA,KAAK,UAAU,YAAY,SAAS,UAA4B,OAA4C;CACxG,OAAO,KAAK,SAAS,KAAK,CAAC,CAAC,KAAK;AACrC"}
|
|
1
|
+
{"version":3,"file":"flux.js","names":[],"sources":["../../../../src/publisher/operators/compat/flux.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Flux, Mono and operator implementation modules.\n */\nimport {UNBOUNDED_DEMAND} from \"@/core/demand.js\";\nimport {NoSuchElementError} from \"@/errors/classes.js\";\nimport {consumePublisher} from \"@/internal/publisher-terminal.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {identity} from \"@/publisher/helpers.js\";\nimport {Mono} from \"@/publisher/mono.js\";\nimport {liftOneToOne} from \"@/publisher/operators/lift.js\";\nimport {terminalMono} from \"@/publisher/operators/terminal-mono.js\";\nimport type {PublisherInput} from \"@/publisher/types.js\";\nimport type {Subscriber} from \"@/subscription/subscriber.js\";\n\n/** Constructor-like runtime value used by `ofType`. */\ntype ClassLike<R> = abstract new (...args: never[]) => R;\n\ndeclare module \"@/publisher/flux.js\" {\n /** Reactor compatibility operators added to Flux. */\n interface Flux<T> {\n /** Passes this Flux to a transformer and returns the transformer's result. */\n as<R>(transformer: (source: Flux<T>) => R): R;\n\n /** Resolves with the first value, or undefined when the source completes empty. */\n blockFirst(): Promise<T | undefined>;\n\n /** Resolves with the last value, or undefined when the source completes empty. */\n blockLast(): Promise<T | undefined>;\n\n /** Creates a container per subscription and accumulates every source value into it. */\n collect<R>(supplier: () => R, accumulator: (container: R, value: T) => void): Mono<R>;\n\n /** Collects source values into a Map using extracted keys and optional mapped values. */\n collectMap<K, V = T>(keyExtractor: (value: T) => K, valueExtractor?: (value: T) => V): Mono<Map<K, V>>;\n\n /** Collects source values into a Map whose keys point to arrays of matching values. */\n collectMultimap<K, V = T>(keyExtractor: (value: T) => K, valueExtractor?: (value: T) => V): Mono<Map<K, V[]>>;\n\n /** Collects all source values into an array and sorts it before emitting. */\n collectSortedList(comparator?: (left: T, right: T) => number): Mono<T[]>;\n\n /** Appends literal values after this Flux completes. */\n concatWithValues(...values: readonly T[]): Flux<T>;\n\n /** Emits the value at a zero-based index, a default, or an error when missing. */\n elementAt(index: number, defaultValue?: T): Mono<T>;\n\n /** Emits true when the source emits at least one value. */\n hasElements(): Mono<boolean>;\n\n /** Wraps this source in a new Flux to hide its concrete identity. */\n hide(): Flux<T>;\n\n /** Drops all values and completes when the source completes successfully. */\n ignoreElements(): Mono<void>;\n\n /** Emits the final source value, an optional default, or an error when empty. */\n last(defaultValue?: T): Mono<T>;\n\n /** Maps each value and drops null or undefined mapping results. */\n mapNotNull<R>(mapper: (value: T) => R | null | undefined): Flux<R>;\n\n /** Keeps only values that are instances of the provided runtime class. */\n ofType<R>(type: ClassLike<R>): Flux<R>;\n\n /** Creates an initial state per subscription and reduces source values into it. */\n reduceWith<R>(supplier: () => R, accumulator: (accumulated: R, value: T) => R): Mono<R>;\n\n /** Creates an initial state per subscription and emits each running accumulation. */\n scanWith<R>(supplier: () => R, accumulator: (accumulated: R, value: T) => R): Flux<R>;\n\n /** Drops the final `n` values from the source. */\n skipLast(n: number): Flux<T>;\n\n /** Collects all source values, sorts them, and replays the sorted values. */\n sort(comparator?: (left: T, right: T) => number): Flux<T>;\n\n /** Subscribes the provided subscriber and returns the same subscriber instance. */\n subscribeWith<S extends Subscriber<T>>(subscriber: S): S;\n\n /** Emits only the final `n` values after the source completes. */\n takeLast(n: number): Flux<T>;\n\n /** Waits for this source and then waits for `other`, ignoring all values. */\n thenEmpty(other: PublisherInput<unknown>): Mono<void>;\n }\n}\n\n\nFlux.prototype.as = function as<T, R>(this: Flux<T>, transformer: (source: Flux<T>) => R): R {\n return transformer(this);\n};\n\nFlux.prototype.blockFirst = function blockFirst<T>(this: Flux<T>): Promise<T | undefined> {\n return this.next().block();\n};\n\nFlux.prototype.blockLast = function blockLast<T>(this: Flux<T>): Promise<T | undefined> {\n return this.toPromise();\n};\n\nFlux.prototype.collect = function collect<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (container: R, value: T) => void\n): Mono<R> {\n return terminalMono(this, UNBOUNDED_DEMAND, () => {\n const container = supplier();\n return {\n /** Accumulates one value into the supplied container. */\n onNext(value) {\n accumulator(container, value);\n return false;\n },\n result: () => container\n };\n });\n};\n\nFlux.prototype.collectMap = function collectMap<T, K, V = T>(\n this: Flux<T>,\n keyExtractor: (value: T) => K,\n valueExtractor: (value: T) => V = identity as (value: T) => V\n): Mono<Map<K, V>> {\n return this.collect(\n () => new Map<K, V>(),\n (map, value) => map.set(keyExtractor(value), valueExtractor(value))\n );\n};\n\nFlux.prototype.collectMultimap = function collectMultimap<T, K, V = T>(\n this: Flux<T>,\n keyExtractor: (value: T) => K,\n valueExtractor: (value: T) => V = identity as (value: T) => V\n): Mono<Map<K, V[]>> {\n return this.collect(\n () => new Map<K, V[]>(),\n (map, value) => {\n const key = keyExtractor(value);\n const bucket = map.get(key);\n if (bucket) {\n bucket.push(valueExtractor(value));\n } else {\n map.set(key, [valueExtractor(value)]);\n }\n }\n );\n};\n\nFlux.prototype.collectSortedList = function collectSortedList<T>(\n this: Flux<T>,\n comparator?: (left: T, right: T) => number\n): Mono<T[]> {\n return this.collectList().map(values => values.sort(comparator));\n};\n\nFlux.prototype.concatWithValues = function concatWithValues<T>(this: Flux<T>, ...values: readonly T[]): Flux<T> {\n return this.concatWith(Flux.just(...values));\n};\n\nFlux.prototype.elementAt = function elementAt<T>(this: Flux<T>, index: number, defaultValue?: T): Mono<T> {\n if (!Number.isInteger(index) || index < 0) {\n throw new RangeError(\"index must be a non-negative integer\");\n }\n const hasDefault = arguments.length > 1;\n return terminalMono<T, T>(this, index + 1, () => {\n let remaining = index;\n let result: T | undefined;\n let found = false;\n return {\n /** Skips values until the requested index is reached. */\n onNext(value) {\n if (remaining > 0) {\n remaining -= 1;\n return false;\n }\n result = value;\n found = true;\n return true;\n },\n /** Resolves the indexed value, default, or missing-value error. */\n result() {\n if (found) {\n return result as T;\n }\n if (hasDefault) {\n return defaultValue as T;\n }\n throw new NoSuchElementError();\n }\n };\n });\n};\n\nFlux.prototype.hasElements = function hasElements<T>(this: Flux<T>): Mono<boolean> {\n return terminalMono(this, 1, () => {\n let present = false;\n return {\n /** Marks the source as non-empty and finishes. */\n onNext() {\n present = true;\n return true;\n },\n result: () => present\n };\n });\n};\n\nFlux.prototype.hide = function hide<T>(this: Flux<T>): Flux<T> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => source.iterate(signal, context),\n () => ({onNext: identity})\n );\n};\n\nFlux.prototype.ignoreElements = function ignoreElements<T>(this: Flux<T>): Mono<void> {\n return this.then();\n};\n\nFlux.prototype.last = function last<T>(this: Flux<T>, defaultValue?: T): Mono<T> {\n const hasDefault = arguments.length > 0;\n return terminalMono(this, UNBOUNDED_DEMAND, () => {\n let seen = false;\n let lastValue: T | undefined;\n return {\n /** Retains the latest source value. */\n onNext(value) {\n seen = true;\n lastValue = value;\n return false;\n },\n /** Resolves the last value, default, or empty-source error. */\n result() {\n if (seen) {\n return lastValue as T;\n }\n if (hasDefault) {\n return defaultValue as T;\n }\n throw new NoSuchElementError();\n }\n };\n });\n};\n\nFlux.prototype.mapNotNull = function mapNotNull<T, R>(\n this: Flux<T>,\n mapper: (value: T) => R | null | undefined\n): Flux<R> {\n return this.handle((value, sink) => {\n const mapped = mapper(value);\n if (mapped !== null && mapped !== undefined) {\n sink.next(mapped);\n }\n });\n};\n\nFlux.prototype.ofType = function ofType<T, R>(this: Flux<T>, type: ClassLike<R>): Flux<R> {\n return this.filter(value => value instanceof type).cast<R>();\n};\n\nFlux.prototype.reduceWith = function reduceWith<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (accumulated: R, value: T) => R\n): Mono<R> {\n return terminalMono(this, UNBOUNDED_DEMAND, () => {\n let current = supplier();\n return {\n /** Folds one value into the supplied initial state. */\n onNext(value) {\n current = accumulator(current, value);\n return false;\n },\n result: () => current\n };\n });\n};\n\nFlux.prototype.scanWith = function scanWith<T, R>(\n this: Flux<T>,\n supplier: () => R,\n accumulator: (accumulated: R, value: T) => R\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const value of source.scan(supplier(), accumulator).iterate(signal, context)) {\n yield value;\n }\n });\n};\n\nFlux.prototype.skipLast = function skipLast<T>(this: Flux<T>, n: number): Flux<T> {\n if (!Number.isInteger(n) || n < 0) {\n throw new RangeError(\"skipLast expects a non-negative integer\");\n }\n if (n === 0) {\n return this;\n }\n const source = this;\n return new Flux(async function* (signal, context) {\n const queue: T[] = [];\n let head = 0;\n for await (const value of source.iterate(signal, context)) {\n queue.push(value);\n if (queue.length - head > n) {\n const next = queue[head] as T;\n head += 1;\n if (head > 1024 && head * 2 > queue.length) {\n queue.copyWithin(0, head);\n queue.length -= head;\n head = 0;\n }\n yield next;\n }\n }\n });\n};\n\nFlux.prototype.sort = function sort<T>(this: Flux<T>, comparator?: (left: T, right: T) => number): Flux<T> {\n return new Flux((signal, context) => this.collectSortedList(comparator).flatMapMany(Flux.fromIterable).iterate(signal, context));\n};\n\nFlux.prototype.subscribeWith = function subscribeWith<T, S extends Subscriber<T>>(this: Flux<T>, subscriber: S): S {\n this.subscribe(subscriber);\n return subscriber;\n};\n\nFlux.prototype.takeLast = function takeLast<T>(this: Flux<T>, n: number): Flux<T> {\n if (!Number.isInteger(n) || n < 0) {\n throw new RangeError(\"takeLast expects a non-negative integer\");\n }\n if (n === 0) {\n return Flux.empty<T>();\n }\n const source = this;\n return new Flux(async function* (signal, context) {\n const values: T[] = [];\n let head = 0;\n await consumePublisher<T, void>(source, signal, context, UNBOUNDED_DEMAND, {\n /** Stores one value in the bounded trailing ring. */\n onNext(value) {\n if (values.length < n) {\n values.push(value);\n } else {\n values[head] = value;\n head = (head + 1) % n;\n }\n return false;\n },\n result: () => undefined\n });\n for (let index = 0; index < values.length; index += 1) {\n if (signal.aborted) {\n return;\n }\n yield values[(head + index) % values.length] as T;\n }\n });\n};\n\nFlux.prototype.thenEmpty = function thenEmpty<T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KAChB,OAAO;IACX;IACA,MAAM;GACV;EACJ;CACJ,CAAC;AACL;AAEA,KAAK,UAAU,OAAO,SAAS,KAAuB,YAAqD;CACvG,OAAO,IAAI,MAAM,QAAQ,YAAY,KAAK,kBAAkB,UAAU,CAAC,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC,QAAQ,QAAQ,OAAO,CAAC;AACnI;AAEA,KAAK,UAAU,gBAAgB,SAAS,cAAyD,YAAkB;CAC/G,KAAK,UAAU,UAAU;CACzB,OAAO;AACX;AAEA,KAAK,UAAU,WAAW,SAAS,SAA2B,GAAoB;CAC9E,IAAI,CAAC,OAAO,UAAU,CAAC,KAAK,IAAI,GAC5B,MAAM,IAAI,WAAW,yCAAyC;CAElE,IAAI,MAAM,GACN,OAAO,KAAK,MAAS;CAEzB,MAAM,SAAS;CACf,OAAO,IAAI,KAAK,iBAAiB,QAAQ,SAAS;EAC9C,MAAM,SAAc,CAAC;EACrB,IAAI,OAAO;EACX,MAAM,iBAA0B,QAAQ,QAAQ,SAAS,kBAAkB;;GAEvE,OAAO,OAAO;IACV,IAAI,OAAO,SAAS,GAChB,OAAO,KAAK,KAAK;SACd;KACH,OAAO,QAAQ;KACf,QAAQ,OAAO,KAAK;IACxB;IACA,OAAO;GACX;GACA,cAAc;EAClB,CAAC;EACD,KAAK,IAAI,QAAQ,GAAG,QAAQ,OAAO,QAAQ,SAAS,GAAG;GACnD,IAAI,OAAO,SACP;GAEJ,MAAM,QAAQ,OAAO,SAAS,OAAO;EACzC;CACJ,CAAC;AACL;AAEA,KAAK,UAAU,YAAY,SAAS,UAA4B,OAA4C;CACxG,OAAO,KAAK,SAAS,KAAK,CAAC,CAAC,KAAK;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordination.d.ts","sourceRoot":"","sources":["../../../src/publisher/operators/coordination.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,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,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAElG,qDAAqD;QACrD,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAExD,oDAAoD;QACpD,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAE7C,wEAAwE;QACxE,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEjH,oDAAoD;QACpD,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;KAC/G;CACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toAsyncIterator } from "../../internal/iterable.js";
|
|
2
2
|
import { AsyncQueue } from "../../internal/async-queue.js";
|
|
3
|
+
import { collectPublisher, drainPublisher } from "../../internal/publisher-terminal.js";
|
|
3
4
|
import { Schedulers } from "../../schedulers/schedulers.js";
|
|
4
5
|
import { scheduleDelay } from "../helpers.js";
|
|
5
6
|
import { Flux } from "../flux.js";
|
|
@@ -258,13 +259,11 @@ function delayErrors(source) {
|
|
|
258
259
|
}
|
|
259
260
|
/** Collects a finite publisher input into an array. */
|
|
260
261
|
async function collect(source, signal, context) {
|
|
261
|
-
|
|
262
|
-
for await (const value of Flux.from(source).iterate(signal, context)) values.push(value);
|
|
263
|
-
return values;
|
|
262
|
+
return collectPublisher(Flux.from(source), signal, context);
|
|
264
263
|
}
|
|
265
264
|
/** Consumes a publisher input and ignores all values. */
|
|
266
265
|
async function drain(source, signal, context) {
|
|
267
|
-
|
|
266
|
+
await drainPublisher(Flux.from(source), signal, context);
|
|
268
267
|
}
|
|
269
268
|
/** Resolves the first value from a publisher input using the current subscriber context. */
|
|
270
269
|
async function firstValueFromContext(source, signal, context) {
|
|
@@ -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 } catch (error) {\n queue.error(error);\n }\n })();\n return queue;\n });\n}\n"],"mappings":";;;;;;;AAoIA,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,MAA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AY;IAChB;IACA,SAAS,QAAQ;IACjB,MAAM,SAAS;GACnB,SAAS,OAAO;IACZ,SAAS,QAAQ;IACjB,MAAM,MAAM,KAAK;GACrB;EACJ,EAAA,CAAG;EACH,OAAO;CACX,CAAC;AACL;;AAGA,SAAS,oBAAuB,QAAiB,SAA2C;CACxF,OAAO,IAAI,MAAM,QAAQ,YAAY;EACjC,MAAM,QAAQ,IAAI,WAAc,MAAM;EACtC,IAAI;EACJ,IAAI,YAAY;EAChB,CAAM,YAAY;GACd,IAAI;IACA,MAAM,QAAQ,IAAI,EACb,YAAY;KACT,WAAW,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO,GAAG;MACvD,SAAS;MACT,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
|
+
{"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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W;IACtB,YAAY;GAChB;EACJ,GAAG,QAAQ,MAAM;EACjB,OAAO,iBAAiB,eAAe,SAAS,QAAQ,GAAG,EAAC,MAAM,KAAI,CAAC;EACvE,CAAM,YAAY;GACd,IAAI;IACA,WAAW,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO,GAAG;KACvD,SAAS;KACT,YAAY;IAChB;IACA,SAAS,QAAQ;IACjB,MAAM,SAAS;GACnB,SAAS,OAAO;IACZ,SAAS,QAAQ;IACjB,MAAM,MAAM,KAAK;GACrB;EACJ,EAAA,CAAG;EACH,OAAO;CACX,CAAC;AACL;;AAGA,SAAS,oBAAuB,QAAiB,SAA2C;CACxF,OAAO,IAAI,MAAM,QAAQ,YAAY;EACjC,MAAM,QAAQ,IAAI,WAAc,MAAM;EACtC,IAAI;EACJ,IAAI,YAAY;EAChB,CAAM,YAAY;GACd,IAAI;IACA,MAAM,QAAQ,IAAI,EACb,YAAY;KACT,WAAW,MAAM,SAAS,OAAO,QAAQ,QAAQ,OAAO,GAAG;MACvD,SAAS;MACT,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.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