reactor-core-ts 3.2.1 → 3.2.3
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/LICENSE.md +56 -0
- package/README.md +5 -0
- package/dist/core/demand.js +2 -2
- package/dist/core/demand.js.map +1 -1
- package/dist/internal/deep-value.d.ts +9 -0
- package/dist/internal/deep-value.d.ts.map +1 -0
- package/dist/internal/deep-value.js +159 -0
- package/dist/internal/deep-value.js.map +1 -0
- package/dist/internal/iterable-transform.d.ts +8 -1
- package/dist/internal/iterable-transform.d.ts.map +1 -1
- package/dist/internal/iterable-transform.js +7 -5
- package/dist/internal/iterable-transform.js.map +1 -1
- package/dist/publisher/flux.d.ts.map +1 -1
- package/dist/publisher/flux.js +92 -22
- package/dist/publisher/flux.js.map +1 -1
- package/dist/publisher/operators/lifecycle.d.ts.map +1 -1
- package/dist/publisher/operators/lifecycle.js +29 -3
- package/dist/publisher/operators/lifecycle.js.map +1 -1
- package/dist/publisher/operators/lift.d.ts +42 -0
- package/dist/publisher/operators/lift.d.ts.map +1 -0
- package/dist/publisher/operators/lift.js +343 -0
- package/dist/publisher/operators/lift.js.map +1 -0
- package/dist/publisher/operators/selection.d.ts +5 -0
- package/dist/publisher/operators/selection.d.ts.map +1 -1
- package/dist/publisher/operators/selection.js +8 -0
- package/dist/publisher/operators/selection.js.map +1 -1
- package/dist/publisher/operators/side-effect.d.ts.map +1 -1
- package/dist/publisher/operators/side-effect.js +34 -9
- package/dist/publisher/operators/side-effect.js.map +1 -1
- package/dist/publisher/operators/transform.d.ts.map +1 -1
- package/dist/publisher/operators/transform.js +3 -2
- package/dist/publisher/operators/transform.js.map +1 -1
- package/dist/subscription/iterable-subscription.js +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","names":[],"sources":["../../../src/publisher/operators/transform.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Flux, Mono and operator implementation modules.\n */\nimport type {ContextView} from \"@/context/context-view.js\";\nimport {filterIterable, mapIterable} from \"@/internal/iterable-transform.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport type {Mapper, PublisherInput, SynchronousSink} from \"@/publisher/types.js\";\nimport {Signal} from \"@/signal/signal.js\";\n\ndeclare module \"@/publisher/flux.js\" {\n /** Transforming and materialization operators added to Flux. */\n interface Flux<T> {\n /** Maps each source value with the provided function. */\n map<R>(mapper: Mapper<T, R>): Flux<R>;\n\n /** Treats this Flux as a Flux of another TypeScript type. */\n cast<R>(): Flux<R>;\n\n /** Keeps only source values accepted by the predicate. */\n filter(predicate: (value: T) => boolean): Flux<T>;\n\n /** Handles each value with a synchronous sink that may emit, complete, or fail. */\n handle<R>(handler: (value: T, sink: SynchronousSink<R>) => void): Flux<R>;\n\n /** Converts values and terminal events into `Signal` values. */\n materialize(): Flux<Signal<T>>;\n\n /** Converts `Signal` values back into normal values and terminal events. */\n dematerialize<R>(this: Flux<Signal<R>>): Flux<R>;\n\n /** Applies a transformer to this Flux immediately and adapts its result. */\n transform<R>(transformer: (source: Flux<T>) => PublisherInput<R>): Flux<R>;\n\n /** Applies a transformer separately for each subscription. */\n transformDeferred<R>(transformer: (source: Flux<T>) => PublisherInput<R>): Flux<R>;\n\n /** Applies a transformer per subscription with access to the subscriber context. */\n transformDeferredContextual<R>(transformer: (source: Flux<T>, context: ContextView) => PublisherInput<R>): Flux<R>;\n }\n}\n\nFlux.prototype.map = function map<T, R>(this: Flux<T>, mapper: Mapper<T, R>): Flux<R> {\n const source = this;\n return
|
|
1
|
+
{"version":3,"file":"transform.js","names":[],"sources":["../../../src/publisher/operators/transform.ts"],"sourcesContent":["/**\n * @packageDocumentation\n * Flux, Mono and operator implementation modules.\n */\nimport type {ContextView} from \"@/context/context-view.js\";\nimport {filterIterable, mapIterable} from \"@/internal/iterable-transform.js\";\nimport {Flux} from \"@/publisher/flux.js\";\nimport {liftFilter, liftOneToOne} from \"@/publisher/operators/lift.js\";\nimport type {Mapper, PublisherInput, SynchronousSink} from \"@/publisher/types.js\";\nimport {Signal} from \"@/signal/signal.js\";\n\ndeclare module \"@/publisher/flux.js\" {\n /** Transforming and materialization operators added to Flux. */\n interface Flux<T> {\n /** Maps each source value with the provided function. */\n map<R>(mapper: Mapper<T, R>): Flux<R>;\n\n /** Treats this Flux as a Flux of another TypeScript type. */\n cast<R>(): Flux<R>;\n\n /** Keeps only source values accepted by the predicate. */\n filter(predicate: (value: T) => boolean): Flux<T>;\n\n /** Handles each value with a synchronous sink that may emit, complete, or fail. */\n handle<R>(handler: (value: T, sink: SynchronousSink<R>) => void): Flux<R>;\n\n /** Converts values and terminal events into `Signal` values. */\n materialize(): Flux<Signal<T>>;\n\n /** Converts `Signal` values back into normal values and terminal events. */\n dematerialize<R>(this: Flux<Signal<R>>): Flux<R>;\n\n /** Applies a transformer to this Flux immediately and adapts its result. */\n transform<R>(transformer: (source: Flux<T>) => PublisherInput<R>): Flux<R>;\n\n /** Applies a transformer separately for each subscription. */\n transformDeferred<R>(transformer: (source: Flux<T>) => PublisherInput<R>): Flux<R>;\n\n /** Applies a transformer per subscription with access to the subscriber context. */\n transformDeferredContextual<R>(transformer: (source: Flux<T>, context: ContextView) => PublisherInput<R>): Flux<R>;\n }\n}\n\nFlux.prototype.map = function map<T, R>(this: Flux<T>, mapper: Mapper<T, R>): Flux<R> {\n const source = this;\n return liftOneToOne(\n source,\n (signal, context) => mapIterable(source.iterate(signal, context), mapper),\n () => ({onNext: mapper})\n );\n};\n\nFlux.prototype.cast = function cast<T, R>(this: Flux<T>): Flux<R> {\n return this as unknown as Flux<R>;\n};\n\nFlux.prototype.filter = function filter<T>(this: Flux<T>, predicate: (value: T) => boolean): Flux<T> {\n const source = this;\n return liftFilter(\n source,\n (signal, context) => filterIterable(source.iterate(signal, context), predicate),\n predicate\n );\n};\n\nFlux.prototype.handle = function handle<T, R>(\n this: Flux<T>,\n handler: (value: T, sink: SynchronousSink<R>) => void\n): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const value of source.iterate(signal, context)) {\n let done = false;\n let output: R | undefined;\n const sink: SynchronousSink<R> = {\n /** Emits one mapped value for the current source value. */\n next(nextValue) {\n if (done) {\n throw new Error(\"SynchronousSink allows only one signal per source value\");\n }\n output = nextValue;\n done = true;\n },\n /** Suppresses emission for the current source value. */\n complete() {\n done = true;\n },\n /** Fails the sequence with the provided error. */\n error(error) {\n throw error;\n }\n };\n handler(value, sink);\n if (done && output !== undefined) {\n yield output;\n }\n }\n });\n};\n\nFlux.prototype.materialize = function materialize<T>(this: Flux<T>): Flux<Signal<T>> {\n const source = this;\n return new Flux(async function* (signal, context) {\n try {\n for await (const value of source.iterate(signal, context)) {\n yield Signal.next(value);\n }\n yield Signal.complete();\n } catch (error) {\n yield Signal.error(error);\n }\n });\n};\n\nFlux.prototype.dematerialize = function dematerialize<R>(this: Flux<Signal<R>>): Flux<R> {\n const source = this;\n return new Flux(async function* (signal, context) {\n for await (const signalValue of source.iterate(signal, context)) {\n if (signalValue.isOnNext()) {\n yield signalValue.get() as R;\n } else if (signalValue.isOnError()) {\n throw signalValue.getThrowable();\n } else if (signalValue.isOnComplete()) {\n return;\n }\n }\n });\n};\n\nFlux.prototype.transform = function transform<T, R>(\n this: Flux<T>,\n transformer: (source: Flux<T>) => PublisherInput<R>\n): Flux<R> {\n return Flux.from(transformer(this));\n};\n\nFlux.prototype.transformDeferred = function transformDeferred<T, R>(\n this: Flux<T>,\n transformer: (source: Flux<T>) => PublisherInput<R>\n): Flux<R> {\n const source = this;\n return Flux.defer(() => transformer(source));\n};\n\nFlux.prototype.transformDeferredContextual = function transformDeferredContextual<T, R>(\n this: Flux<T>,\n transformer: (source: Flux<T>, context: ContextView) => PublisherInput<R>\n): Flux<R> {\n const source = this;\n return new Flux((signal, context) => Flux.from(transformer(source, context.readOnly())).iterate(signal, context));\n};\n"],"mappings":";;;;;AA2CA,KAAK,UAAU,MAAM,SAAS,IAAyB,QAA+B;CAClF,MAAM,SAAS;CAC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AY,SAAS,GACrB,MAAM,YAAY,IAAI;OACnB,IAAI,YAAY,UAAU,GAC7B,MAAM,YAAY,aAAa;OAC5B,IAAI,YAAY,aAAa,GAChC;CAGZ,CAAC;AACL;AAEA,KAAK,UAAU,YAAY,SAAS,UAEhC,aACO;CACP,OAAO,KAAK,KAAK,YAAY,IAAI,CAAC;AACtC;AAEA,KAAK,UAAU,oBAAoB,SAAS,kBAExC,aACO;CACP,MAAM,SAAS;CACf,OAAO,KAAK,YAAY,YAAY,MAAM,CAAC;AAC/C;AAEA,KAAK,UAAU,8BAA8B,SAAS,4BAElD,aACO;CACP,MAAM,SAAS;CACf,OAAO,IAAI,MAAM,QAAQ,YAAY,KAAK,KAAK,YAAY,QAAQ,QAAQ,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,QAAQ,OAAO,CAAC;AACpH"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/defineProperty.js";
|
|
2
2
|
import { doneResult, isAsyncIterable, resolvedDoneResult } from "../internal/iterable.js";
|
|
3
|
-
import { scheduleMicrotask } from "../internal/microtask.js";
|
|
4
3
|
import { addCap, normalizeRequest } from "../core/demand.js";
|
|
4
|
+
import { scheduleMicrotask } from "../internal/microtask.js";
|
|
5
5
|
//#region src/subscription/iterable-subscription.ts
|
|
6
6
|
/**
|
|
7
7
|
* @packageDocumentation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactor-core-ts",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "Browser-first TypeScript implementation inspired by Project Reactor Core.",
|
|
5
5
|
"license": "LGPL-3.0-only",
|
|
6
6
|
"author": "CKATEPTb",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"files": [
|
|
90
90
|
"dist",
|
|
91
|
+
"LICENSE.md",
|
|
91
92
|
"README.md"
|
|
92
93
|
],
|
|
93
94
|
"sideEffects": [
|