@reactive-js/core
Advanced tools
Comparing version 0.23.0 to 0.24.0
import { error, pipe, returns } from "../../../functions.js"; | ||
import { DispatcherLike_complete, DispatcherLike_scheduler, } from "../../../rx.js"; | ||
import Observable_concatMap from "../../../rx/Observable/__internal__/Observable.concatMap.js"; | ||
import Observable_create from "../../../rx/Observable/__internal__/Observable.create.js"; | ||
@@ -10,15 +11,10 @@ import Observable_forEach from "../../../rx/Observable/__internal__/Observable.forEach.js"; | ||
import Disposable_onComplete from "../../../util/Disposable/__internal__/Disposable.onComplete.js"; | ||
import Promiseable_toObservable from "../../Promiseable/__internal__/Promiseable.toObservable.js"; | ||
const AsyncIterable_toAsyncEnumerable = | ||
/*@__PURE__*/ returns((iterable) => Streamable_createLifted(observable => Observable_create(observer => { | ||
const iterator = iterable[Symbol.asyncIterator](); | ||
pipe(observable, Observable_forEach(async (_) => { | ||
pipe(observable, Observable_concatMap(_ => pipe(iterator.next(), Promiseable_toObservable())), Observable_forEach(result => { | ||
try { | ||
// Note: In theory a caller could dispatch multiple move requests | ||
// without waiting for the responses. In this case, we don't guarantee | ||
// the order in which they will be produced by the enumerator stream. | ||
// they could very well be out of order depending on when the promises | ||
// resolve. | ||
const next = await iterator.next(); | ||
if (!next.done) { | ||
observer[QueueableLike_push](next.value); | ||
if (!result.done) { | ||
observer[QueueableLike_push](result.value); | ||
} | ||
@@ -25,0 +21,0 @@ else { |
import { compose, returns } from "../../../functions.js"; | ||
import Runnable_toReadonlyArray from "../../../rx/Runnable/__internal__/Runnable.toReadonlyArray.js"; | ||
import Iterable_toObservable from "./Iterable.toObservable.js"; | ||
import Enumerator_toReadonlyArray from "../../Enumerator/__internal__/Enumerator.toReadonlyArray.js"; | ||
import Iterable_enumerate from "./Iterable.enumerate.js"; | ||
const Iterable_toReadonlyArray = | ||
/*@__PURE__*/ (() => returns(compose(Iterable_toObservable(), Runnable_toReadonlyArray())))(); | ||
/*@__PURE__*/ (() => returns(compose(Iterable_enumerate(), Enumerator_toReadonlyArray())))(); | ||
export default Iterable_toReadonlyArray; |
@@ -14,6 +14,6 @@ import { abs } from "../../../__internal__/math.js"; | ||
var _a; | ||
const delay = (_a = options === null || options === void 0 ? void 0 : options.delay) !== null && _a !== void 0 ? _a : 0 > 0; | ||
const delay = (_a = options === null || options === void 0 ? void 0 : options.delay) !== null && _a !== void 0 ? _a : 0; | ||
return Streamable_createLifted(compose(count >= 0 | ||
? Observable_scan(increment, returns(start - 1)) | ||
: Observable_scan(decrement, returns(start + 1)), (delay !== null && delay !== void 0 ? delay : 0 > 0) | ||
: Observable_scan(decrement, returns(start + 1)), delay > 0 | ||
? Observable_concatMap((i) => pipe(array[i], Optional_toObservable(options))) | ||
@@ -20,0 +20,0 @@ : Observable_map((i) => array[i]), Observable_takeFirst({ count: abs(count) })), true, delay <= 0, true); |
import fs from "fs"; | ||
import { createBrotliCompress, createBrotliDecompress, createDeflate, createGunzip, createGzip, createInflate, } from "zlib"; | ||
import { error, ignore, isFunction, isSome, pipe, pipeLazy, } from "../functions.js"; | ||
import { DispatcherLike_complete, DispatcherLike_scheduler, } from "../rx.js"; | ||
import { error, ignore, isFunction, pipe, pipeLazy, } from "../functions.js"; | ||
import { DispatcherLike_complete, DispatcherLike_scheduler, ObservableLike_observe, } from "../rx.js"; | ||
import * as Observable from "../rx/Observable.js"; | ||
@@ -13,2 +13,3 @@ import { SchedulerLike_requestYield } from "../scheduling.js"; | ||
import * as Disposable from "../util/Disposable.js"; | ||
import Disposable_addTo from "../util/Disposable/__internal__/Disposable.addTo.js"; | ||
export const bindNodeCallback = (callback) => function (...args) { | ||
@@ -55,9 +56,4 @@ return Observable.create(observer => { | ||
export const createReadableSource = (factory) => Flowable_createLifted(mode => Observable.create(observer => { | ||
const dispatchDisposable = pipe(Disposable.create(), Disposable.onDisposed(e => { | ||
if (isSome(e)) { | ||
observer[DisposableLike_dispose](e); | ||
} | ||
else { | ||
observer[DispatcherLike_complete](); | ||
} | ||
const dispatchDisposable = pipe(Disposable.create(), Disposable.onError(Disposable.toErrorHandler(observer)), Disposable.onComplete(() => { | ||
observer[DispatcherLike_complete](); | ||
})); | ||
@@ -89,11 +85,6 @@ const readable = isFunction(factory) | ||
export const createWritableSink = /*@__PURE__*/ (() => { | ||
const NODE_JS_PAUSE_EVENT = "__REACTIVE_JS_NODE_WRITABLE_PAUSE__"; | ||
const NODE_JS_PAUSE_EVENT = Symbol("__REACTIVE_JS_NODE_WRITABLE_PAUSE__"); | ||
return (factory) => Streamable_createLifted(events => Observable.create(observer => { | ||
const dispatchDisposable = pipe(Disposable.create(), Disposable.onDisposed(e => { | ||
if (isSome(e)) { | ||
observer[DisposableLike_dispose](e); | ||
} | ||
else { | ||
observer[DispatcherLike_complete](); | ||
} | ||
const dispatchDisposable = pipe(Disposable.create(), Disposable.onError(Disposable.toErrorHandler(observer)), Disposable.onComplete(() => { | ||
observer[DispatcherLike_complete](); | ||
})); | ||
@@ -129,4 +120,5 @@ const writable = isFunction(factory) | ||
const transform = pipe(factory(), addToDisposable(observer)); | ||
pipe(createWritableSink(transform)[StreamableLike_stream](observer[DispatcherLike_scheduler]), Stream.sourceFrom(src), addToNodeStream(transform)); | ||
const transformReadableStream = pipe(createReadableSource(transform)[StreamableLike_stream](observer[DispatcherLike_scheduler]), addToNodeStream(transform), Observable.observeWith(observer)); | ||
pipe(createWritableSink(transform)[StreamableLike_stream](observer[DispatcherLike_scheduler]), Stream.sourceFrom(src), Disposable_addTo(observer)); | ||
const transformReadableStream = createReadableSource(transform)[StreamableLike_stream](observer[DispatcherLike_scheduler]); | ||
transformReadableStream[ObservableLike_observe](observer); | ||
pipe(modeObs, Observable.forEach(v => { | ||
@@ -133,0 +125,0 @@ if (!transformReadableStream[QueueableLike_push](v)) { |
{ | ||
"name": "@reactive-js/core", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"type": "module", | ||
@@ -75,3 +75,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "a2779f2fcb038741d88dedd5118d454678bfca14" | ||
"gitHead": "7b81babd0451c35a72fb3a387ba85ab5722a8bf1" | ||
} |
@@ -1,2 +0,2 @@ | ||
import Enumerator_toReadonlyArray from "../../../containers/Enumerator/__internal__/Enumerator.toArray.js"; | ||
import Enumerator_toReadonlyArray from "../../../containers/Enumerator/__internal__/Enumerator.toReadonlyArray.js"; | ||
import { isSome, pipe, raiseError } from "../../../functions.js"; | ||
@@ -3,0 +3,0 @@ import { DisposableLike_dispose, DisposableLike_error } from "../../../util.js"; |
@@ -1,5 +0,6 @@ | ||
import { isNone, isSome, newInstance, none, pipe, } from "../../../functions.js"; | ||
import { isNone, newInstance, none, pipe, } from "../../../functions.js"; | ||
import Scheduler_createHostScheduler from "../../../scheduling/Scheduler/__internal__/Scheduler.createHostScheduler.js"; | ||
import { DisposableLike_dispose } from "../../../util.js"; | ||
import Disposable_onDisposed from "../../../util/Disposable/__internal__/Disposable.onDisposed.js"; | ||
import Disposable_onComplete from "../../../util/Disposable/__internal__/Disposable.onComplete.js"; | ||
import Disposable_onError from "../../../util/Disposable/__internal__/Disposable.onError.js"; | ||
import Observable_forEach from "./Observable.forEach.js"; | ||
@@ -15,9 +16,4 @@ import Observable_subscribe from "./Observable.subscribe.js"; | ||
result = next; | ||
}), Observable_subscribe(scheduler, options), Disposable_onDisposed(err => { | ||
if (isSome(err)) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(result); | ||
} | ||
}), Observable_subscribe(scheduler, options), Disposable_onError(reject), Disposable_onComplete(() => { | ||
resolve(result); | ||
})); | ||
@@ -24,0 +20,0 @@ }); |
@@ -93,3 +93,2 @@ import Iterable_toObservable from "../containers/Iterable/__internal__/Iterable.toObservable.js"; | ||
export const forkZipLatest = Observable_forkZipLatest; | ||
// FIXME? | ||
export const fromEnumerable = /*@__PURE__*/ returns(identity); | ||
@@ -96,0 +95,0 @@ export const fromIterable = Iterable_toObservable; |
import { max } from "../../../__internal__/math.js"; | ||
import { createInstanceFactory, include, init, mix, props, } from "../../../__internal__/mixins.js"; | ||
import { IndexedQueueLike_get, QueueLike_count, QueueLike_pull, } from "../../../__internal__/util.internal.js"; | ||
import { isSome, newInstance, none, pipe, unsafeCast, } from "../../../functions.js"; | ||
import { newInstance, none, pipe, unsafeCast } from "../../../functions.js"; | ||
import { DispatcherLike_complete, MulticastObservableLike_observerCount, ObservableLike_isEnumerable, ObservableLike_isRunnable, ObservableLike_observe, SubjectLike_publish, } from "../../../rx.js"; | ||
import { DisposableLike_dispose, DisposableLike_isDisposed, QueueableLike_maxBufferSize, QueueableLike_push, } from "../../../util.js"; | ||
import { DisposableLike_isDisposed, QueueableLike_maxBufferSize, QueueableLike_push, } from "../../../util.js"; | ||
import Disposable_mixin from "../../../util/Disposable/__internal__/Disposable.mixin.js"; | ||
import Disposable_onComplete from "../../../util/Disposable/__internal__/Disposable.onComplete.js"; | ||
import Disposable_onDisposed from "../../../util/Disposable/__internal__/Disposable.onDisposed.js"; | ||
import Disposable_onError from "../../../util/Disposable/__internal__/Disposable.onError.js"; | ||
import Disposable_toErrorHandler from "../../../util/Disposable/__internal__/Disposable.toErrorHandler.js"; | ||
import IndexedQueue_fifoQueueMixin from "../../../util/Queue/__internal__/IndexedQueue.fifoQueueMixin.js"; | ||
@@ -28,13 +31,12 @@ const Subject_create = | ||
[SubjectLike_publish](next) { | ||
if (!this[DisposableLike_isDisposed]) { | ||
const replay = this[QueueableLike_maxBufferSize]; | ||
if (replay > 0) { | ||
if (!this[QueueableLike_push](next)) { | ||
this[QueueLike_pull](); | ||
} | ||
} | ||
for (const observer of this[Subject_observers]) { | ||
observer[QueueableLike_push](next); | ||
} | ||
if (this[DisposableLike_isDisposed]) { | ||
return; | ||
} | ||
const replay = this[QueueableLike_maxBufferSize]; | ||
if (replay > 0 && !this[QueueableLike_push](next)) { | ||
this[QueueLike_pull](); | ||
} | ||
for (const observer of this[Subject_observers]) { | ||
observer[QueueableLike_push](next); | ||
} | ||
}, | ||
@@ -57,9 +59,4 @@ [ObservableLike_observe](observer) { | ||
} | ||
pipe(this, Disposable_onDisposed(e => { | ||
if (isSome(e)) { | ||
observer[DisposableLike_dispose](e); | ||
} | ||
else { | ||
observer[DispatcherLike_complete](); | ||
} | ||
pipe(this, Disposable_onError(Disposable_toErrorHandler(observer)), Disposable_onComplete(() => { | ||
observer[DispatcherLike_complete](); | ||
})); | ||
@@ -66,0 +63,0 @@ }, |
@@ -64,7 +64,5 @@ import { MAX_SAFE_INTEGER } from "../../../__internal__/constants.js"; | ||
while (((head = this[QueueLike_pull]()), isSome(head))) { | ||
if (!head[DisposableLike_isDisposed]) { | ||
this[Continuation_childContinuation] = head; | ||
head[ContinuationLike_run](); | ||
this[Continuation_childContinuation] = none; | ||
} | ||
this[Continuation_childContinuation] = head; | ||
head[ContinuationLike_run](); | ||
this[Continuation_childContinuation] = none; | ||
const shouldYield = scheduler[ContinuationSchedulerLike_shouldYield]; | ||
@@ -175,5 +173,2 @@ if (shouldYield && !this[DisposableLike_isDisposed]) { | ||
[PrioritySchedulerImplementationLike_runContinuation](continuation) { | ||
if (continuation[DisposableLike_isDisposed]) { | ||
return; | ||
} | ||
this[SchedulerMixin_currentContinuation] = continuation; | ||
@@ -180,0 +175,0 @@ this[SchedulerMixin_yieldRequested] = false; |
import { Mixin3 } from "../../../__internal__/mixins.js"; | ||
import { ContainerOperator } from "../../../containers.js"; | ||
import { DispatcherLike, ObservableLike } from "../../../rx.js"; | ||
import { ObservableLike } from "../../../rx.js"; | ||
import { SchedulerLike } from "../../../scheduling.js"; | ||
import { StreamLike } from "../../../streaming.js"; | ||
import { DisposableLike } from "../../../util.js"; | ||
export interface DispatchedObservableLike<T> extends ObservableLike<T>, DispatcherLike<T>, DisposableLike { | ||
} | ||
declare const Stream_mixin: <TReq, T>() => Mixin3<StreamLike<TReq, T>, ContainerOperator<ObservableLike, TReq, T>, SchedulerLike, number>; | ||
export default Stream_mixin; |
@@ -8,12 +8,8 @@ import { __DEV__ } from "../../../__internal__/constants.js"; | ||
import { SchedulerLike_inContinuation, } from "../../../scheduling.js"; | ||
import { DisposableLike_dispose, DisposableLike_isDisposed, QueueableLike_maxBufferSize, QueueableLike_push, } from "../../../util.js"; | ||
import Disposable_add from "../../../util/Disposable/__internal__/Disposable.add.js"; | ||
import { DisposableLike_isDisposed, QueueableLike_maxBufferSize, QueueableLike_push, } from "../../../util.js"; | ||
import Disposable_delegatingMixin from "../../../util/Disposable/__internal__/Disposable.delegatingMixin.js"; | ||
import Disposable_mixin from "../../../util/Disposable/__internal__/Disposable.mixin.js"; | ||
import Disposable_onDisposed from "../../../util/Disposable/__internal__/Disposable.onDisposed.js"; | ||
const DispatchedObservable_create = | ||
/*@__PURE__*/ (() => { | ||
const DispatchedObservable_observer = Symbol("DispatchedObservable_observer"); | ||
return createInstanceFactory(mix(include(Disposable_mixin), function DispatchedObservable(instance) { | ||
init(Disposable_mixin, instance); | ||
return createInstanceFactory(mix(function DispatchedObservable(instance) { | ||
return instance; | ||
@@ -77,10 +73,2 @@ }, props({ | ||
this[DispatchedObservable_observer] = observer; | ||
pipe(this, Disposable_onDisposed(e => { | ||
if (isSome(e)) { | ||
observer[DisposableLike_dispose](e); | ||
} | ||
else { | ||
observer[DispatcherLike_complete](); | ||
} | ||
})); | ||
}, | ||
@@ -90,11 +78,12 @@ })); | ||
const Stream_mixin = /*@__PURE__*/ (() => { | ||
const StreamMixin_observable = Symbol("StreamMixin_observable"); | ||
const StreamMixin_dispatcher = Symbol("StreamMixin_dispatcher"); | ||
return returns(mix(include(Disposable_delegatingMixin()), function StreamMixin(instance, op, scheduler, replay) { | ||
instance[DispatcherLike_scheduler] = scheduler; | ||
const dispatchedObservable = DispatchedObservable_create(); | ||
init(Disposable_delegatingMixin(), instance, dispatchedObservable); | ||
instance[DispatcherLike_scheduler] = scheduler; | ||
instance[StreamMixin_observable] = pipe(dispatchedObservable, op, Observable_multicast(scheduler, { replay }), Disposable_add(instance)); | ||
instance[StreamMixin_dispatcher] = dispatchedObservable; | ||
const delegate = pipe(dispatchedObservable, op, Observable_multicast(scheduler, { replay })); | ||
init(Disposable_delegatingMixin(), instance, delegate); | ||
return instance; | ||
}, props({ | ||
[StreamMixin_observable]: none, | ||
[StreamMixin_dispatcher]: none, | ||
[DispatcherLike_scheduler]: none, | ||
@@ -104,7 +93,7 @@ }), { | ||
unsafeCast(this); | ||
return this[StreamMixin_observable][MulticastObservableLike_observerCount]; | ||
return this[DelegatingLike_delegate][MulticastObservableLike_observerCount]; | ||
}, | ||
get [QueueableLike_maxBufferSize]() { | ||
unsafeCast(this); | ||
return this[DelegatingLike_delegate][QueueableLike_maxBufferSize]; | ||
return this[StreamMixin_dispatcher][QueueableLike_maxBufferSize]; | ||
}, | ||
@@ -114,9 +103,9 @@ [ObservableLike_isEnumerable]: false, | ||
[QueueableLike_push](req) { | ||
return this[DelegatingLike_delegate][QueueableLike_push](req); | ||
return this[StreamMixin_dispatcher][QueueableLike_push](req); | ||
}, | ||
[DispatcherLike_complete]() { | ||
this[DelegatingLike_delegate][DispatcherLike_complete](); | ||
this[StreamMixin_dispatcher][DispatcherLike_complete](); | ||
}, | ||
[ObservableLike_observe](observer) { | ||
this[StreamMixin_observable][ObservableLike_observe](observer); | ||
this[DelegatingLike_delegate][ObservableLike_observe](observer); | ||
}, | ||
@@ -123,0 +112,0 @@ })); |
import { pipe } from "../../../functions.js"; | ||
import { DispatcherLike_scheduler } from "../../../rx.js"; | ||
import { DispatcherLike_complete, DispatcherLike_scheduler, } from "../../../rx.js"; | ||
import Observable_forEach from "../../../rx/Observable/__internal__/Observable.forEach.js"; | ||
@@ -20,3 +20,3 @@ import Observable_ignoreElements from "../../../rx/Observable/__internal__/Observable.ignoreElements.js"; | ||
} | ||
}), Observable_ignoreElements(), Observable_onSubscribe(() => dest)), pipe(dest, Observable_forEach(v => { | ||
}), Observable_ignoreElements(), Observable_onSubscribe(() => () => dest[DispatcherLike_complete]())), pipe(dest, Observable_forEach(v => { | ||
if (!srcStream[QueueableLike_push](v)) { | ||
@@ -23,0 +23,0 @@ scheduler[SchedulerLike_requestYield](); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
586877
10742