Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rx-signals/store

Package Overview
Dependencies
Maintainers
1
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rx-signals/store - npm Package Compare versions

Comparing version 2.6.2 to 2.7.0-rc1

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 2.7.0
### Breaking change (yes as minor version, because it's a simple refactoring)
- changed definition for TypeIdentifier: From now on, you have to use getIdentifier<T>() to get your identifiers
# 2.6.2 (2021-09-07)

@@ -2,0 +8,0 @@

4

dist/cjs/controlled-subject.js

@@ -147,4 +147,4 @@ "use strict";

this.pipe = this.isBehavior
? this.subject.pipe(operators_1.filter(value => value !== store_utils_1.NO_VALUE), operators_1.distinctUntilChanged())
: this.delayedEventQueue.getQueueDelayedObservable(this.subject).pipe(operators_1.share());
? this.subject.pipe((0, operators_1.filter)(value => value !== store_utils_1.NO_VALUE), (0, operators_1.distinctUntilChanged)())
: this.delayedEventQueue.getQueueDelayedObservable(this.subject).pipe((0, operators_1.share)());
localSources.forEach(source => {

@@ -151,0 +151,0 @@ this.addSource(source);

@@ -11,3 +11,3 @@ "use strict";

getQueueDelayedObservable(observable) {
return observable.pipe(operators_1.mergeMap(value => this.fromDelayedQueue().pipe(operators_1.mapTo(value))));
return observable.pipe((0, operators_1.mergeMap)(value => this.fromDelayedQueue().pipe((0, operators_1.mapTo)(value))));
}

@@ -26,4 +26,4 @@ fromDelayedQueue() {

signalNext() {
rxjs_1.of(null)
.pipe(operators_1.delay(1, rxjs_1.asyncScheduler))
(0, rxjs_1.of)(null)
.pipe((0, operators_1.delay)(1, rxjs_1.asyncScheduler))
.subscribe(() => {

@@ -30,0 +30,0 @@ const queueLength = this.queueArray.length;

@@ -20,7 +20,7 @@ "use strict";

const getSignalIds = () => ({
combinedBehavior: store_utils_1.getIdentifier(),
errorEvents: store_utils_1.getIdentifier(),
successEvents: store_utils_1.getIdentifier(),
invalidateEvent: store_utils_1.getIdentifier(),
triggerEvent: store_utils_1.getIdentifier(),
combinedBehavior: (0, store_utils_1.getIdentifier)(),
errorEvents: (0, store_utils_1.getIdentifier)(),
successEvents: (0, store_utils_1.getIdentifier)(),
invalidateEvent: (0, store_utils_1.getIdentifier)(),
triggerEvent: (0, store_utils_1.getIdentifier)(),
});

@@ -34,3 +34,3 @@ const getEffectBuilder = () => {

catch (error) {
return rxjs_1.throwError(error);
return (0, rxjs_1.throwError)(error);
}

@@ -40,6 +40,6 @@ };

const setup = (store) => {
const invalidateTokenBehavior = store_utils_1.getIdentifier();
store.addNonLazyBehavior(invalidateTokenBehavior, store.getEventStream(ids.invalidateEvent).pipe(operators_1.map(() => ({}))), null);
const resultEvent = store_utils_1.getIdentifier();
const resultBehavior = store_utils_1.getIdentifier();
const invalidateTokenBehavior = (0, store_utils_1.getIdentifier)();
store.addNonLazyBehavior(invalidateTokenBehavior, store.getEventStream(ids.invalidateEvent).pipe((0, operators_1.map)(() => ({}))), null);
const resultEvent = (0, store_utils_1.getIdentifier)();
const resultBehavior = (0, store_utils_1.getIdentifier)();
const initialResult = config.initialResultGetter ? config.initialResultGetter() : undefined;

@@ -50,9 +50,9 @@ store.addLazyBehavior(resultBehavior, store.getEventStream(resultEvent), {

});
const triggeredInputEvent = store_utils_1.getIdentifier();
const triggeredInputBehavior = store_utils_1.getIdentifier();
const triggeredInputEvent = (0, store_utils_1.getIdentifier)();
const triggeredInputBehavior = (0, store_utils_1.getIdentifier)();
store.addLazyBehavior(triggeredInputBehavior, store.getEventStream(triggeredInputEvent), null);
// It is important to setup the combined observable as behavior,
// because a simple shareReplay (event with refCount) would create a memory leak!!!
const combinedId = store_utils_1.getIdentifier();
store.addLazyBehavior(combinedId, rxjs_1.combineLatest([
const combinedId = (0, store_utils_1.getIdentifier)();
store.addLazyBehavior(combinedId, (0, rxjs_1.combineLatest)([
config.inputGetter(store),

@@ -66,11 +66,11 @@ store.getBehavior(resultBehavior),

? combined
: combined.pipe(operators_1.debounceTime(config.effectDebounceTime));
store.add4TypedEventSource(Symbol(''), resultEvent, triggeredInputEvent, ids.errorEvents, ids.successEvents, eventSourceInput.pipe(operators_1.filter(([input, resultState, token]) => token !== resultState.resultToken ||
: combined.pipe((0, operators_1.debounceTime)(config.effectDebounceTime));
store.add4TypedEventSource(Symbol(''), resultEvent, triggeredInputEvent, ids.errorEvents, ids.successEvents, eventSourceInput.pipe((0, operators_1.filter)(([input, resultState, token]) => token !== resultState.resultToken ||
resultState.resultInput === undefined ||
!config.effectInputEquals(input, resultState.resultInput)), operators_1.switchMap(([input, resultState, token, triggeredInput]) => config.withTrigger && input !== triggeredInput
? store.getEventStream(ids.triggerEvent).pipe(operators_1.mapTo({
!config.effectInputEquals(input, resultState.resultInput)), (0, operators_1.switchMap)(([input, resultState, token, triggeredInput]) => config.withTrigger && input !== triggeredInput
? store.getEventStream(ids.triggerEvent).pipe((0, operators_1.mapTo)({
type: triggeredInputEvent,
event: input,
}))
: internalResultEffect(input, store, resultState.resultInput, resultState.result).pipe(operators_1.switchMap(result => rxjs_1.of({
: internalResultEffect(input, store, resultState.resultInput, resultState.result).pipe((0, operators_1.switchMap)(result => (0, rxjs_1.of)({
type: resultEvent,

@@ -88,3 +88,3 @@ event: {

},
})), operators_1.catchError(error => rxjs_1.of({
})), (0, operators_1.catchError)(error => (0, rxjs_1.of)({
type: ids.errorEvents,

@@ -102,3 +102,3 @@ event: {

}))))), resultEvent);
store.addLazyBehavior(ids.combinedBehavior, combined.pipe(operators_1.map(([input, resultState, token, triggeredInput]) => ({
store.addLazyBehavior(ids.combinedBehavior, combined.pipe((0, operators_1.map)(([input, resultState, token, triggeredInput]) => ({
currentInput: input,

@@ -137,3 +137,3 @@ result: resultState.result,

const withCustomEffectInputEquals = (effectInputEquals) => getEffectSignalsFactoryIntern(Object.assign(Object.assign({}, config), { effectInputEquals }));
return Object.assign(Object.assign({}, signals_factory_1.createSignalsFactory(build)), { withTrigger,
return Object.assign(Object.assign({}, (0, signals_factory_1.createSignalsFactory)(build)), { withTrigger,
withInitialResult,

@@ -140,0 +140,0 @@ withEffectDebounce,

@@ -18,4 +18,4 @@ "use strict";

let factory2;
const newMap = (mapper2) => exports.signalsFactoryMap(factory2, mapper2);
const newBind = (mapper2) => exports.signalsFactoryBind(factory2, mapper2);
const newMap = (mapper2) => (0, exports.signalsFactoryMap)(factory2, mapper2);
const newBind = (mapper2) => (0, exports.signalsFactoryBind)(factory2, mapper2);
factory2 = {

@@ -56,4 +56,4 @@ build: newBuild,

let factory2;
const newBind = (mapper2) => exports.signalsFactoryBind(factory2, mapper2);
const newMap = (mapper2) => exports.signalsFactoryMap(factory2, mapper2);
const newBind = (mapper2) => (0, exports.signalsFactoryBind)(factory2, mapper2);
const newMap = (mapper2) => (0, exports.signalsFactoryMap)(factory2, mapper2);
factory2 = {

@@ -78,4 +78,4 @@ build: newBuild,

let factory;
const bind = (mapper) => exports.signalsFactoryBind(factory, mapper);
const fmap = (mapper) => exports.signalsFactoryMap(factory, mapper);
const bind = (mapper) => (0, exports.signalsFactoryBind)(factory, mapper);
const fmap = (mapper) => (0, exports.signalsFactoryMap)(factory, mapper);
factory = {

@@ -82,0 +82,0 @@ build,

@@ -76,4 +76,4 @@ "use strict";

addBehavior(identifier, observable, subscribeLazy, initialValueOrValueGetter = store_utils_1.NO_VALUE) {
this.assertSourceExists(identifier.symbol, identifier.symbol);
this.getBehaviorControlledSubject(identifier).addSource(new source_observable_1.SourceObservable(identifier.symbol, observable, subscribeLazy, initialValueOrValueGetter));
this.assertSourceExists(identifier, identifier);
this.getBehaviorControlledSubject(identifier).addSource(new source_observable_1.SourceObservable(identifier, observable, subscribeLazy, initialValueOrValueGetter));
}

@@ -111,4 +111,4 @@ /**

addState(identifier, initialValueOrValueGetter) {
this.assertSourceExists(identifier.symbol, identifier.symbol);
this.getBehaviorControlledSubject(identifier).addSource(new source_observable_1.SourceObservable(identifier.symbol, rxjs_1.NEVER, false, initialValueOrValueGetter));
this.assertSourceExists(identifier, identifier);
this.getBehaviorControlledSubject(identifier).addSource(new source_observable_1.SourceObservable(identifier, rxjs_1.NEVER, false, initialValueOrValueGetter));
}

@@ -126,4 +126,4 @@ /**

addReducer(stateIdentifier, eventIdentifier, reducer) {
const sourceObservable = this.getEventStream(eventIdentifier).pipe(operators_1.withLatestFrom(this.getBehavior(stateIdentifier)), operators_1.map(([event, state]) => reducer(state, event)));
this.getBehaviorControlledSubject(stateIdentifier).addSource(new source_observable_1.SourceObservable(eventIdentifier.symbol, sourceObservable, false));
const sourceObservable = this.getEventStream(eventIdentifier).pipe((0, operators_1.withLatestFrom)(this.getBehavior(stateIdentifier)), (0, operators_1.map)(([event, state]) => reducer(state, event)));
this.getBehaviorControlledSubject(stateIdentifier).addSource(new source_observable_1.SourceObservable(eventIdentifier, sourceObservable, false));
}

@@ -138,3 +138,3 @@ /**

removeReducer(stateIdentifier, eventIdentifier) {
this.getBehaviorControlledSubject(stateIdentifier).removeSource(eventIdentifier.symbol);
this.getBehaviorControlledSubject(stateIdentifier).removeSource(eventIdentifier);
}

@@ -164,3 +164,3 @@ /**

behavior.complete();
this.behaviors.delete(identifier.symbol);
this.behaviors.delete(identifier);
this.behaviorsSubject.next(this.behaviors);

@@ -212,5 +212,5 @@ }

.asObservable()
.pipe(operators_1.switchMap(s => {
.pipe((0, operators_1.switchMap)(s => {
var _a, _b;
return ((_b = (_a = s.get(identifier.symbol)) === null || _a === void 0 ? void 0 : _a.getNumberOfSources()) !== null && _b !== void 0 ? _b : 0) > 0
return ((_b = (_a = s.get(identifier)) === null || _a === void 0 ? void 0 : _a.getNumberOfSources()) !== null && _b !== void 0 ? _b : 0) > 0
? this.getBehaviorControlledSubject(identifier).getObservable()

@@ -250,3 +250,3 @@ : parent.getBehavior(identifier);

const result = this.getEventStream(identifier)
.pipe(operators_1.filter(val => val === event), operators_1.take(1), operators_1.mapTo(true), operators_1.delay(1, rxjs_1.asyncScheduler))
.pipe((0, operators_1.filter)(val => val === event), (0, operators_1.take)(1), (0, operators_1.mapTo)(true), (0, operators_1.delay)(1, rxjs_1.asyncScheduler))
.toPromise();

@@ -293,3 +293,3 @@ controlledSubject.next(event);

this.assertSourceExists(sourceIdentifier, sourceIdentifier);
const sharedSource = this.getDependentObservable(observable.pipe(operators_1.delay(1, rxjs_1.asyncScheduler), operators_1.share()), subscribeObservableOnlyIfEventIsSubscribed);
const sharedSource = this.getDependentObservable(observable.pipe((0, operators_1.delay)(1, rxjs_1.asyncScheduler), (0, operators_1.share)()), subscribeObservableOnlyIfEventIsSubscribed);
this.addTypedEventSource(sourceIdentifier, eventIdentifierA, sharedSource);

@@ -311,3 +311,3 @@ this.addTypedEventSource(sourceIdentifier, eventIdentifierB, sharedSource);

this.assertSourceExists(sourceIdentifier, sourceIdentifier);
const sharedSource = this.getDependentObservable(observable.pipe(operators_1.delay(1, rxjs_1.asyncScheduler), operators_1.share()), subscribeObservableOnlyIfEventIsSubscribed);
const sharedSource = this.getDependentObservable(observable.pipe((0, operators_1.delay)(1, rxjs_1.asyncScheduler), (0, operators_1.share)()), subscribeObservableOnlyIfEventIsSubscribed);
this.addTypedEventSource(sourceIdentifier, eventIdentifierA, sharedSource);

@@ -331,3 +331,3 @@ this.addTypedEventSource(sourceIdentifier, eventIdentifierB, sharedSource);

this.assertSourceExists(sourceIdentifier, sourceIdentifier);
const sharedSource = this.getDependentObservable(observable.pipe(operators_1.delay(1, rxjs_1.asyncScheduler), operators_1.share()), subscribeObservableOnlyIfEventIsSubscribed);
const sharedSource = this.getDependentObservable(observable.pipe((0, operators_1.delay)(1, rxjs_1.asyncScheduler), (0, operators_1.share)()), subscribeObservableOnlyIfEventIsSubscribed);
this.addTypedEventSource(sourceIdentifier, eventIdentifierA, sharedSource);

@@ -353,3 +353,3 @@ this.addTypedEventSource(sourceIdentifier, eventIdentifierB, sharedSource);

this.assertSourceExists(sourceIdentifier, sourceIdentifier);
const sharedSource = this.getDependentObservable(observable.pipe(operators_1.delay(1, rxjs_1.asyncScheduler), operators_1.share()), subscribeObservableOnlyIfEventIsSubscribed);
const sharedSource = this.getDependentObservable(observable.pipe((0, operators_1.delay)(1, rxjs_1.asyncScheduler), (0, operators_1.share)()), subscribeObservableOnlyIfEventIsSubscribed);
this.addTypedEventSource(sourceIdentifier, eventIdentifierA, sharedSource);

@@ -377,3 +377,3 @@ this.addTypedEventSource(sourceIdentifier, eventIdentifierB, sharedSource);

this.assertSourceExists(sourceIdentifier, sourceIdentifier);
const sharedSource = this.getDependentObservable(observable.pipe(operators_1.delay(1, rxjs_1.asyncScheduler), operators_1.share()), subscribeObservableOnlyIfEventIsSubscribed);
const sharedSource = this.getDependentObservable(observable.pipe((0, operators_1.delay)(1, rxjs_1.asyncScheduler), (0, operators_1.share)()), subscribeObservableOnlyIfEventIsSubscribed);
this.addTypedEventSource(sourceIdentifier, eventIdentifierA, sharedSource);

@@ -406,3 +406,3 @@ this.addTypedEventSource(sourceIdentifier, eventIdentifierB, sharedSource);

getEventStream(identifier) {
return rxjs_1.merge(this.getEventStreamControlledSubject(identifier).getObservable(), this.parentStore ? this.parentStore.getEventStream(identifier) : rxjs_1.NEVER);
return (0, rxjs_1.merge)(this.getEventStreamControlledSubject(identifier).getObservable(), this.parentStore ? this.parentStore.getEventStream(identifier) : rxjs_1.NEVER);
}

@@ -416,5 +416,5 @@ /**

getTypedEventStream(identifier) {
return rxjs_1.merge(this.getEventStreamControlledSubject(identifier)
return (0, rxjs_1.merge)(this.getEventStreamControlledSubject(identifier)
.getObservable()
.pipe(operators_1.map(event => ({
.pipe((0, operators_1.map)(event => ({
type: identifier,

@@ -433,4 +433,4 @@ event,

var _a, _b;
return (((_a = this.behaviors.get(identifier.symbol)) === null || _a === void 0 ? void 0 : _a.isObservableSubscribed()) === true ||
((_b = this.eventStreams.get(identifier.symbol)) === null || _b === void 0 ? void 0 : _b.isObservableSubscribed()) === true);
return (((_a = this.behaviors.get(identifier)) === null || _a === void 0 ? void 0 : _a.isObservableSubscribed()) === true ||
((_b = this.eventStreams.get(identifier)) === null || _b === void 0 ? void 0 : _b.isObservableSubscribed()) === true);
}

@@ -447,11 +447,11 @@ /**

getIsSubscribedObservable(identifier) {
const sym = identifier.symbol;
return rxjs_1.combineLatest([
const sym = identifier;
return (0, rxjs_1.combineLatest)([
this.behaviorsSubject
.asObservable()
.pipe(operators_1.switchMap(s => { var _a, _b; return (_b = (_a = s.get(sym)) === null || _a === void 0 ? void 0 : _a.getIsSubscribedObservable()) !== null && _b !== void 0 ? _b : rxjs_1.of(false); })),
.pipe((0, operators_1.switchMap)(s => { var _a, _b; return (_b = (_a = s.get(sym)) === null || _a === void 0 ? void 0 : _a.getIsSubscribedObservable()) !== null && _b !== void 0 ? _b : (0, rxjs_1.of)(false); })),
this.eventStreamsSubject
.asObservable()
.pipe(operators_1.switchMap(s => { var _a, _b; return (_b = (_a = s.get(sym)) === null || _a === void 0 ? void 0 : _a.getIsSubscribedObservable()) !== null && _b !== void 0 ? _b : rxjs_1.of(false); })),
]).pipe(operators_1.map(([s1, s2]) => s1 || s2), operators_1.distinctUntilChanged(), operators_1.share());
.pipe((0, operators_1.switchMap)(s => { var _a, _b; return (_b = (_a = s.get(sym)) === null || _a === void 0 ? void 0 : _a.getIsSubscribedObservable()) !== null && _b !== void 0 ? _b : (0, rxjs_1.of)(false); })),
]).pipe((0, operators_1.map)(([s1, s2]) => s1 || s2), (0, operators_1.distinctUntilChanged)(), (0, operators_1.share)());
}

@@ -484,10 +484,10 @@ /**

.getIsSubscribedObservable()
.pipe(operators_1.switchMap(isSubscribed => (isSubscribed ? observable : rxjs_1.NEVER)));
.pipe((0, operators_1.switchMap)(isSubscribed => (isSubscribed ? observable : rxjs_1.NEVER)));
}
addTypedEventSource(sourceIdentifier, eventIdentifier, sharedSource) {
const source = sharedSource.pipe(operators_1.filter(typedEvent => typedEvent.type === eventIdentifier), operators_1.map(event => event.event));
const source = sharedSource.pipe((0, operators_1.filter)(typedEvent => typedEvent.type === eventIdentifier), (0, operators_1.map)(event => event.event));
this.getEventStreamControlledSubject(eventIdentifier).addSource(new source_observable_1.SourceObservable(sourceIdentifier, source, true));
}
createBehaviorControlledSubject(identifier) {
const controlledSubject = new controlled_subject_1.ControlledSubject(identifier.symbol, true, (_, error) => {
const controlledSubject = new controlled_subject_1.ControlledSubject(identifier, true, (_, error) => {
// If the source errors, error for the target.

@@ -501,3 +501,3 @@ controlledSubject.error(error);

}, this.delayedEventQueue);
this.behaviors.set(identifier.symbol, controlledSubject);
this.behaviors.set(identifier, controlledSubject);
this.behaviorsSubject.next(this.behaviors);

@@ -508,6 +508,6 @@ return controlledSubject;

var _a;
return ((_a = this.behaviors.get(identifier.symbol)) !== null && _a !== void 0 ? _a : this.createBehaviorControlledSubject(identifier));
return (_a = this.behaviors.get(identifier)) !== null && _a !== void 0 ? _a : this.createBehaviorControlledSubject(identifier);
}
createEventStreamControlledSubject(identifier) {
const controlledSubject = new controlled_subject_1.ControlledSubject(identifier.symbol, false, (_, error) => {
const controlledSubject = new controlled_subject_1.ControlledSubject(identifier, false, (_, error) => {
// If a source errors, error for the target.

@@ -521,3 +521,3 @@ controlledSubject.error(error);

}, this.delayedEventQueue);
this.eventStreams.set(identifier.symbol, controlledSubject);
this.eventStreams.set(identifier, controlledSubject);
this.eventStreamsSubject.next(this.eventStreams);

@@ -528,3 +528,3 @@ return controlledSubject;

var _a;
return ((_a = this.eventStreams.get(identifier.symbol)) !== null && _a !== void 0 ? _a : this.createEventStreamControlledSubject(identifier));
return (_a = this.eventStreams.get(identifier)) !== null && _a !== void 0 ? _a : this.createEventStreamControlledSubject(identifier);
}

@@ -531,0 +531,0 @@ assertSourceExists(symbol, sourceIdentifier) {

@@ -11,7 +11,5 @@ "use strict";

*/
const getIdentifier = (name) => ({
symbol: Symbol(name),
});
const getIdentifier = (name) => Symbol(name);
exports.getIdentifier = getIdentifier;
exports.NO_VALUE = Symbol('NO_VALUE');
//# sourceMappingURL=store.utils.js.map

@@ -8,4 +8,4 @@ "use strict";

const store_utils_1 = require("./store.utils");
const resultInputGetter = (store, validationBehaviorId, isValidationResultValid) => store.getBehavior(validationBehaviorId).pipe(operators_1.filter(c => c.resultInput !== undefined && c.result !== undefined), operators_1.filter(c => c.currentInput === c.resultInput), operators_1.filter(c => isValidationResultValid(c.result)), // cast is OK, cause we checked for undefined in the first filter
operators_1.map(c => c.resultInput), operators_1.distinctUntilChanged(), operators_1.map(resultInput => resultInput));
const resultInputGetter = (store, validationBehaviorId, isValidationResultValid) => store.getBehavior(validationBehaviorId).pipe((0, operators_1.filter)(c => c.resultInput !== undefined && c.result !== undefined), (0, operators_1.filter)(c => c.currentInput === c.resultInput), (0, operators_1.filter)(c => isValidationResultValid(c.result)), // cast is OK, cause we checked for undefined in the first filter
(0, operators_1.map)(c => c.resultInput), (0, operators_1.distinctUntilChanged)(), (0, operators_1.map)(resultInput => resultInput));
const mapBehaviors = ([v, r], isValidationResultValid) => ({

@@ -23,5 +23,5 @@ currentInput: v.currentInput,

signals.setup(store);
store.addLazyBehavior(id, rxjs_1.combineLatest([
store.addLazyBehavior(id, (0, rxjs_1.combineLatest)([
store.getBehavior(signals.signals.signals1.combinedBehavior),
store.getBehavior(signals.signals.signals2.combinedBehavior).pipe(operators_1.startWith({
store.getBehavior(signals.signals.signals2.combinedBehavior).pipe((0, operators_1.startWith)({
currentInput: undefined,

@@ -32,6 +32,6 @@ resultInput: undefined,

})),
]).pipe(operators_1.filter(([v, r]) => v.resultPending ||
]).pipe((0, operators_1.filter)(([v, r]) => v.resultPending ||
r.currentInput === v.resultInput ||
v.result === undefined ||
!isValidationResultValid(v.result)), operators_1.map(pair => mapBehaviors(pair, isValidationResultValid)), operators_1.distinctUntilChanged((a, b) => a.currentInput === b.currentInput &&
!isValidationResultValid(v.result)), (0, operators_1.map)(pair => mapBehaviors(pair, isValidationResultValid)), (0, operators_1.distinctUntilChanged)((a, b) => a.currentInput === b.currentInput &&
a.isValid === b.isValid &&

@@ -46,5 +46,5 @@ a.result === b.result &&

const getValidatedInputWithTriggeredResultSignalsFactoryIntern = (config) => {
const validationFactory = effect_signals_factory_1.getEffectSignalsFactory(config.inputGetter, config.validationEffect);
const validationFactory = (0, effect_signals_factory_1.getEffectSignalsFactory)(config.inputGetter, config.validationEffect);
const factory = validationFactory
.bind(validationSignals => effect_signals_factory_1.getEffectSignalsFactory((store) => resultInputGetter(store, validationSignals.signals.combinedBehavior, config.isValidationResultValid), config.resultEffect)
.bind(validationSignals => (0, effect_signals_factory_1.getEffectSignalsFactory)((store) => resultInputGetter(store, validationSignals.signals.combinedBehavior, config.isValidationResultValid), config.resultEffect)
.withTrigger()

@@ -54,3 +54,3 @@ .withInitialResult(config.initialResultGetter)

.fmap(signals => {
const combinedBehavior = store_utils_1.getIdentifier();
const combinedBehavior = (0, store_utils_1.getIdentifier)();
const setup = (store) => setupCombinedBehavior(store, signals, combinedBehavior, config.isValidationResultValid);

@@ -74,9 +74,9 @@ return {

const getValidatedInputWithResultSignalsFactoryIntern = (config) => {
const validationFactory = effect_signals_factory_1.getEffectSignalsFactory(config.inputGetter, config.validationEffect);
const validationFactory = (0, effect_signals_factory_1.getEffectSignalsFactory)(config.inputGetter, config.validationEffect);
const factory = validationFactory
.bind(validationSignals => effect_signals_factory_1.getEffectSignalsFactory((store) => resultInputGetter(store, validationSignals.signals.combinedBehavior, config.isValidationResultValid), config.resultEffect)
.bind(validationSignals => (0, effect_signals_factory_1.getEffectSignalsFactory)((store) => resultInputGetter(store, validationSignals.signals.combinedBehavior, config.isValidationResultValid), config.resultEffect)
.withInitialResult(config.initialResultGetter)
.withCustomEffectInputEquals(config.resultEffectInputEquals))
.fmap(signals => {
const combinedBehavior = store_utils_1.getIdentifier();
const combinedBehavior = (0, store_utils_1.getIdentifier)();
const setup = (store) => setupCombinedBehavior(store, signals, combinedBehavior, config.isValidationResultValid);

@@ -83,0 +83,0 @@ return {

@@ -18,5 +18,5 @@ import { Observable } from 'rxjs';

/**
* This interface specifies the type for the lazy behavior produced by an EffectSignalsFactory.
* This specifies the type for the lazy behavior produced by an EffectSignalsFactory.
*
* @typedef {object} CombinedEffectResult<InputType, ResultType> - interface for the behavior produced by effect signal factories
* @typedef {object} CombinedEffectResult<InputType, ResultType> - type for the behavior produced by effect signal factories
* @template InputType - specifies the input type for the effect

@@ -29,12 +29,12 @@ * @template ResultType - specifies the result type of the effect

*/
export interface CombinedEffectResult<InputType, ResultType> {
readonly currentInput?: InputType;
readonly result?: ResultType;
readonly resultInput?: InputType;
readonly resultPending: boolean;
}
export declare type CombinedEffectResult<InputType, ResultType> = Readonly<{
currentInput?: InputType;
result?: ResultType;
resultInput?: InputType;
resultPending: boolean;
}>;
/**
* Interface for error events produced by an EffectSignalsFactory (unhandled effect errors).
* Type for error events produced by an EffectSignalsFactory (unhandled effect errors).
*
* @typedef {object} EffectError<InputType> - interface for error events produced by effect signal factories
* @typedef {object} EffectError<InputType> - type for error events produced by effect signal factories
* @template InputType - specifies the input type for the effect

@@ -44,10 +44,10 @@ * @property {any} error - the unhandled error thrown by an effect

*/
export interface EffectError<InputType> {
readonly error: any;
readonly errorInput: InputType;
}
export declare type EffectError<InputType> = Readonly<{
error: any;
errorInput: InputType;
}>;
/**
* Interface for success events produced by an EffectSignalsFactory.
* Type for success events produced by an EffectSignalsFactory.
*
* @typedef {object} EffectSuccess<InputType, ResultType> - interface for success events produced by effect signal factories
* @typedef {object} EffectSuccess<InputType, ResultType> - type for success events produced by effect signal factories
* @template InputType - specifies the input type for the effect

@@ -58,8 +58,8 @@ * @template ResultType - specifies the result type of the effect

*/
export interface EffectSuccess<InputType, ResultType> {
readonly result: ResultType;
readonly resultInput: InputType;
}
export declare type EffectSuccess<InputType, ResultType> = Readonly<{
result: ResultType;
resultInput: InputType;
}>;
/**
* Interface specifying the signals of an EffectSignalsFactory.
* Type specifying the signals of an EffectSignalsFactory.
*

@@ -74,10 +74,10 @@ * @typedef {object} EffectSignalsType<InputType, ResultType> - object holding the signal identifiers of effect signal factories

*/
export interface EffectSignalsType<InputType, ResultType> {
readonly combinedBehavior: TypeIdentifier<CombinedEffectResult<InputType, ResultType>>;
readonly errorEvents: TypeIdentifier<EffectError<InputType>>;
readonly successEvents: TypeIdentifier<EffectSuccess<InputType, ResultType>>;
readonly invalidateEvent: TypeIdentifier<void>;
}
export declare type EffectSignalsType<InputType, ResultType> = Readonly<{
combinedBehavior: TypeIdentifier<CombinedEffectResult<InputType, ResultType>>;
errorEvents: TypeIdentifier<EffectError<InputType>>;
successEvents: TypeIdentifier<EffectSuccess<InputType, ResultType>>;
invalidateEvent: TypeIdentifier<void>;
}>;
/**
* This interface extends the EffectSignalsType interface for manually triggered effects.
* This type extends the EffectSignalsType type for manually triggered effects.
*

@@ -89,7 +89,7 @@ * @typedef {object} TriggeredEffectSignalsType<InputType, ResultType> - object holding the signal identifiers of effect signal factories with effect trigger event

*/
export interface TriggeredEffectSignalsType<InputType, ResultType> extends EffectSignalsType<InputType, ResultType> {
export declare type TriggeredEffectSignalsType<InputType, ResultType> = EffectSignalsType<InputType, ResultType> & {
readonly triggerEvent: TypeIdentifier<void>;
}
};
/**
* This interface specifies effect signal factories (extending signal factories). An effect signals factory is a signals factory
* This type specifies effect signal factories (extending signal factories). An effect signals factory is a signals factory
* to generically handle sideeffects (hence, an abstraction over sideeffects). Furthermore, they are implemeted as builders to

@@ -118,3 +118,3 @@ * allow for easy custom configuration.

*/
export interface EffectSignalsFactory<InputType, ResultType, SignalsType> extends SignalsFactory<SignalsType> {
export declare type EffectSignalsFactory<InputType, ResultType, SignalsType> = SignalsFactory<SignalsType> & {
withTrigger: () => EffectSignalsFactory<InputType, ResultType, TriggeredEffectSignalsType<InputType, ResultType>>;

@@ -124,3 +124,3 @@ withInitialResult: (resultGetter?: () => ResultType) => EffectSignalsFactory<InputType, ResultType, SignalsType>;

withCustomEffectInputEquals: (effectInputEquals: (a: InputType, b: InputType) => boolean) => EffectSignalsFactory<InputType, ResultType, SignalsType>;
}
};
/**

@@ -135,2 +135,18 @@ * This function creates a configurable EffectSignalsFactory<InputType, ResultType, SignalsType>.

*/
export declare const getEffectSignalsFactory: <InputType, ResultType>(inputGetter: (store: Store) => Observable<InputType>, effect: EffectType<InputType, ResultType>) => EffectSignalsFactory<InputType, ResultType, EffectSignalsType<InputType, ResultType>>;
export declare const getEffectSignalsFactory: <InputType, ResultType>(inputGetter: (store: Store) => Observable<InputType>, effect: EffectType<InputType, ResultType>) => EffectSignalsFactory<InputType, ResultType, Readonly<{
combinedBehavior: TypeIdentifier<Readonly<{
currentInput?: InputType | undefined;
result?: ResultType | undefined;
resultInput?: InputType | undefined;
resultPending: boolean;
}>>;
errorEvents: TypeIdentifier<Readonly<{
error: any;
errorInput: InputType;
}>>;
successEvents: TypeIdentifier<Readonly<{
result: ResultType;
resultInput: InputType;
}>>;
invalidateEvent: TypeIdentifier<void>;
}>>;
import { Store } from './store';
interface SetupWithStore {
declare type SetupWithStore = {
readonly setup: (store: Store) => void;
}
interface SignalsTypeWrapper<SignalsType> {
signals: SignalsType;
}
};
declare type SignalsTypeWrapper<SignalsType> = {
readonly signals: SignalsType;
};
export declare type Signals<SignalsType> = SetupWithStore & SignalsTypeWrapper<SignalsType>;
export interface MappedSignalsType<SignalsType1, SignalsType2> {
readonly signals1: SignalsType1;
readonly signals2: SignalsType2;
}
export declare type MappedSignalsType<SignalsType1, SignalsType2> = Readonly<{
signals1: SignalsType1;
signals2: SignalsType2;
}>;
/**

@@ -20,13 +20,14 @@ * This is the interface for signal factories, which represent a higher abstraction over the usage

*
* @typedef {object} SignalsFactory<SignalsType> - interface for monadic signal factories
* @template SignalsType - specifies the interface for signals provided by the factory (type identifiers)
* @typedef {object} SignalsFactory<SignalsType> - type for monadic signal factories
* @template SignalsType - specifies the type for signals provided by the factory (type identifiers)
* @property {function} build - returns an object with a setup function (taking a store as argument) and the signals being setup
* @property {function} bind - the monadic bind (aka flatMap) to compose with other signal factories
* @property {function} fmap - (aka map) a functor to map the signals produced by the factory
* @property {function} fmap - (aka map) the functor map, to map the signals produced by the factory
*/
export interface SignalsFactory<SignalsType> {
readonly build: () => Signals<SignalsType>;
readonly bind: <SignalsType2>(mapper: (signals: Signals<SignalsType>) => SignalsFactory<SignalsType2>) => SignalsFactory<MappedSignalsType<SignalsType, SignalsType2>>;
readonly fmap: <SignalsType2>(mapper: (signals: Signals<SignalsType>) => Signals<SignalsType2>) => SignalsFactory<SignalsType2>;
}
export declare type SignalsFactory<SignalsType> = Readonly<{
build: () => Signals<SignalsType>;
bind: <SignalsType2>(mapper: (signals: Signals<SignalsType>) => SignalsFactory<SignalsType2>) => SignalsFactory<MappedSignalsType<SignalsType, SignalsType2>>;
fmap: <SignalsType2>(mapper: (signals: Signals<SignalsType>) => Signals<SignalsType2>) => SignalsFactory<SignalsType2>;
}>;
declare type SignalsFactoryMapCreate = <SignalsType1, SignalsType2>(factory1: SignalsFactory<SignalsType1>, mapper: (signals: Signals<SignalsType1>) => Signals<SignalsType2>) => SignalsFactory<SignalsType2>;
/**

@@ -42,3 +43,4 @@ * A utility function that implements fmap for signal factories. However, instead of using this

*/
export declare const signalsFactoryMap: <SignalsType1, SignalsType2>(factory1: SignalsFactory<SignalsType1>, mapper: (signals: Signals<SignalsType1>) => Signals<SignalsType2>) => SignalsFactory<SignalsType2>;
export declare const signalsFactoryMap: SignalsFactoryMapCreate;
declare type SignalsFactoryBindCreate = <SignalsType1, SignalsType2>(factory1: SignalsFactory<SignalsType1>, mapper: (signals: Signals<SignalsType1>) => SignalsFactory<SignalsType2>) => SignalsFactory<MappedSignalsType<SignalsType1, SignalsType2>>;
/**

@@ -54,3 +56,4 @@ * A utility function that implements bind for signal factories. However, instead of using this

*/
export declare const signalsFactoryBind: <SignalsType1, SignalsType2>(factory1: SignalsFactory<SignalsType1>, mapper: (signals: Signals<SignalsType1>) => SignalsFactory<SignalsType2>) => SignalsFactory<MappedSignalsType<SignalsType1, SignalsType2>>;
export declare const signalsFactoryBind: SignalsFactoryBindCreate;
declare type SignalsFactoryCreate = <SignalsType>(build: () => Signals<SignalsType>) => SignalsFactory<SignalsType>;
/**

@@ -65,3 +68,3 @@ * This utility function creates an object that implements the SignalsFactory interface. It should be

*/
export declare const createSignalsFactory: <SignalsType>(build: () => Signals<SignalsType>) => SignalsFactory<SignalsType>;
export declare const createSignalsFactory: SignalsFactoryCreate;
export {};
import { Observable } from 'rxjs';
import { TypeIdentifier } from './store.utils';
/**
* The RX-SIGNALS Store uses the TypedEvent<T> interface to bundle certain event and their
* The RX-SIGNALS Store uses the TypedEvent<T> to bundle certain events and their
* corresponding TypeIdentifier<T>. This is used for EventSources that can dispatch events
* of different types (see addXTypedEventSource mehtods) or for cases where you want to
* of different types (see addXTypedEventSource methods) or for cases where you want to
* subscribe multiple event and need to differentiate between them at runtime.
*
* @typedef {object} TypedEvent<T> - interface for an object used to identify a certain behavior or event
* @typedef {object} TypedEvent<T> - type for an object bundling identifier and corresponding event.
* @template T - specifies the type for the corresponding TypeIdentifier<T>

@@ -14,11 +14,8 @@ * @property {TypeIdentifier<T>} type - the TypeIdentifier for the event

*/
export interface TypedEvent<T> {
readonly type: TypeIdentifier<T>;
readonly event: T;
}
export declare type TypedEvent<T> = Readonly<{
type: TypeIdentifier<T>;
event: T;
}>;
/**
* The RX-SIGNALS Store uses the TypedEvent<T> interface to bundle certain event and their
* corresponding TypeIdentifier<T>. This is used for EventSources that can dispatch events
* of different types (see addXTypedEventSource mehtods) or for cases where you want to
* subscribe multiple event and need to differentiate between them at runtime.
* The state reducer type specifies the signature for reducers used by the store.
*

@@ -25,0 +22,0 @@ * @typedef {function} StateReducer<T, E> - type for a function that takes a state and an event and returns a new state

@@ -73,4 +73,4 @@ import { asyncScheduler, BehaviorSubject, combineLatest, merge, NEVER, of } from 'rxjs';

addBehavior(identifier, observable, subscribeLazy, initialValueOrValueGetter = NO_VALUE) {
this.assertSourceExists(identifier.symbol, identifier.symbol);
this.getBehaviorControlledSubject(identifier).addSource(new SourceObservable(identifier.symbol, observable, subscribeLazy, initialValueOrValueGetter));
this.assertSourceExists(identifier, identifier);
this.getBehaviorControlledSubject(identifier).addSource(new SourceObservable(identifier, observable, subscribeLazy, initialValueOrValueGetter));
}

@@ -108,4 +108,4 @@ /**

addState(identifier, initialValueOrValueGetter) {
this.assertSourceExists(identifier.symbol, identifier.symbol);
this.getBehaviorControlledSubject(identifier).addSource(new SourceObservable(identifier.symbol, NEVER, false, initialValueOrValueGetter));
this.assertSourceExists(identifier, identifier);
this.getBehaviorControlledSubject(identifier).addSource(new SourceObservable(identifier, NEVER, false, initialValueOrValueGetter));
}

@@ -124,3 +124,3 @@ /**

const sourceObservable = this.getEventStream(eventIdentifier).pipe(withLatestFrom(this.getBehavior(stateIdentifier)), map(([event, state]) => reducer(state, event)));
this.getBehaviorControlledSubject(stateIdentifier).addSource(new SourceObservable(eventIdentifier.symbol, sourceObservable, false));
this.getBehaviorControlledSubject(stateIdentifier).addSource(new SourceObservable(eventIdentifier, sourceObservable, false));
}

@@ -135,3 +135,3 @@ /**

removeReducer(stateIdentifier, eventIdentifier) {
this.getBehaviorControlledSubject(stateIdentifier).removeSource(eventIdentifier.symbol);
this.getBehaviorControlledSubject(stateIdentifier).removeSource(eventIdentifier);
}

@@ -161,3 +161,3 @@ /**

behavior.complete();
this.behaviors.delete(identifier.symbol);
this.behaviors.delete(identifier);
this.behaviorsSubject.next(this.behaviors);

@@ -211,3 +211,3 @@ }

var _a, _b;
return ((_b = (_a = s.get(identifier.symbol)) === null || _a === void 0 ? void 0 : _a.getNumberOfSources()) !== null && _b !== void 0 ? _b : 0) > 0
return ((_b = (_a = s.get(identifier)) === null || _a === void 0 ? void 0 : _a.getNumberOfSources()) !== null && _b !== void 0 ? _b : 0) > 0
? this.getBehaviorControlledSubject(identifier).getObservable()

@@ -422,4 +422,4 @@ : parent.getBehavior(identifier);

var _a, _b;
return (((_a = this.behaviors.get(identifier.symbol)) === null || _a === void 0 ? void 0 : _a.isObservableSubscribed()) === true ||
((_b = this.eventStreams.get(identifier.symbol)) === null || _b === void 0 ? void 0 : _b.isObservableSubscribed()) === true);
return (((_a = this.behaviors.get(identifier)) === null || _a === void 0 ? void 0 : _a.isObservableSubscribed()) === true ||
((_b = this.eventStreams.get(identifier)) === null || _b === void 0 ? void 0 : _b.isObservableSubscribed()) === true);
}

@@ -436,3 +436,3 @@ /**

getIsSubscribedObservable(identifier) {
const sym = identifier.symbol;
const sym = identifier;
return combineLatest([

@@ -480,3 +480,3 @@ this.behaviorsSubject

createBehaviorControlledSubject(identifier) {
const controlledSubject = new ControlledSubject(identifier.symbol, true, (_, error) => {
const controlledSubject = new ControlledSubject(identifier, true, (_, error) => {
// If the source errors, error for the target.

@@ -490,3 +490,3 @@ controlledSubject.error(error);

}, this.delayedEventQueue);
this.behaviors.set(identifier.symbol, controlledSubject);
this.behaviors.set(identifier, controlledSubject);
this.behaviorsSubject.next(this.behaviors);

@@ -497,6 +497,6 @@ return controlledSubject;

var _a;
return ((_a = this.behaviors.get(identifier.symbol)) !== null && _a !== void 0 ? _a : this.createBehaviorControlledSubject(identifier));
return (_a = this.behaviors.get(identifier)) !== null && _a !== void 0 ? _a : this.createBehaviorControlledSubject(identifier);
}
createEventStreamControlledSubject(identifier) {
const controlledSubject = new ControlledSubject(identifier.symbol, false, (_, error) => {
const controlledSubject = new ControlledSubject(identifier, false, (_, error) => {
// If a source errors, error for the target.

@@ -510,3 +510,3 @@ controlledSubject.error(error);

}, this.delayedEventQueue);
this.eventStreams.set(identifier.symbol, controlledSubject);
this.eventStreams.set(identifier, controlledSubject);
this.eventStreamsSubject.next(this.eventStreams);

@@ -517,3 +517,3 @@ return controlledSubject;

var _a;
return ((_a = this.eventStreams.get(identifier.symbol)) !== null && _a !== void 0 ? _a : this.createEventStreamControlledSubject(identifier));
return (_a = this.eventStreams.get(identifier)) !== null && _a !== void 0 ? _a : this.createEventStreamControlledSubject(identifier);
}

@@ -520,0 +520,0 @@ assertSourceExists(symbol, sourceIdentifier) {

@@ -5,11 +5,11 @@ /**

* parameter only as a trick to let Typescript infer and thus enforce the correct types.
* Use the getIdentifier<T>() method to generate a corresponding ID.
*
* @typedef {object} TypeIdentifier<T> - interface for an object used to identify a certain behavior or event
* @typedef {object} TypeIdentifier<T> - type to uniquely identify a certain behavior or event
* @template T - specifies the type for the corresponding behavior or event observable
* @property {symbol} symbol - a symbol, making the TypeIdentifier unique
*/
export interface TypeIdentifier<T> {
_typeTemplate?: T | undefined;
readonly symbol: symbol;
}
export declare type TypeIdentifier<T> = symbol & {
_typeTemplate: T;
};
/**

@@ -16,0 +16,0 @@ * A simple helper function to get a new TypeIdentifier for the RX-SIGNALS store.

@@ -8,6 +8,4 @@ /**

*/
export const getIdentifier = (name) => ({
symbol: Symbol(name),
});
export const getIdentifier = (name) => Symbol(name);
export const NO_VALUE = Symbol('NO_VALUE');
//# sourceMappingURL=store.utils.js.map

@@ -6,29 +6,58 @@ import { Observable } from 'rxjs';

import { TypeIdentifier } from './store.utils';
export interface ValidatedInputWithResult<InputType, ValidationType, ResultType> {
readonly currentInput?: InputType;
readonly validationPending: boolean;
readonly validatedInput?: InputType;
readonly validationResult?: ValidationType;
readonly isValid: boolean;
readonly resultPending: boolean;
readonly resultInput?: InputType;
readonly result?: ResultType;
}
export interface ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType> {
readonly combinedBehavior: TypeIdentifier<ValidatedInputWithResult<InputType, ValidationType, ResultType>>;
readonly validationErrorEvents: TypeIdentifier<EffectError<InputType>>;
readonly validationSuccessEvents: TypeIdentifier<EffectSuccess<InputType, ValidationType>>;
readonly validationInvalidateEvent: TypeIdentifier<void>;
readonly resultErrorEvents: TypeIdentifier<EffectError<InputType>>;
readonly resultSuccessEvents: TypeIdentifier<EffectSuccess<InputType, ResultType>>;
readonly resultInvalidateEvent: TypeIdentifier<void>;
}
export interface ValidatedInputWithTriggeredResultSignalsType<InputType, ValidationType, ResultType> extends ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType> {
export declare type ValidatedInputWithResult<InputType, ValidationType, ResultType> = Readonly<{
currentInput?: InputType;
validationPending: boolean;
validatedInput?: InputType;
validationResult?: ValidationType;
isValid: boolean;
resultPending: boolean;
resultInput?: InputType;
result?: ResultType;
}>;
export declare type ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType> = Readonly<{
combinedBehavior: TypeIdentifier<ValidatedInputWithResult<InputType, ValidationType, ResultType>>;
validationErrorEvents: TypeIdentifier<EffectError<InputType>>;
validationSuccessEvents: TypeIdentifier<EffectSuccess<InputType, ValidationType>>;
validationInvalidateEvent: TypeIdentifier<void>;
resultErrorEvents: TypeIdentifier<EffectError<InputType>>;
resultSuccessEvents: TypeIdentifier<EffectSuccess<InputType, ResultType>>;
resultInvalidateEvent: TypeIdentifier<void>;
}>;
export declare type ValidatedInputWithTriggeredResultSignalsType<InputType, ValidationType, ResultType> = ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType> & {
readonly resultTriggerEvent: TypeIdentifier<void>;
}
export interface ValidatedInputWithResultSignalsFactory<InputType, ValidationType, ResultType, SignalsType> extends SignalsFactory<SignalsType> {
};
export declare type ValidatedInputWithResultSignalsFactory<InputType, ValidationType, ResultType, SignalsType> = SignalsFactory<SignalsType> & {
withTrigger: () => ValidatedInputWithResultSignalsFactory<InputType, ValidationType, ResultType, ValidatedInputWithTriggeredResultSignalsType<InputType, ValidationType, ResultType>>;
withInitialResult: (resultGetter?: () => ResultType) => ValidatedInputWithResultSignalsFactory<InputType, ValidationType, ResultType, SignalsType>;
withCustomResultEffectInputEquals: (resultEffectInputEquals: (a: InputType, b: InputType) => boolean) => ValidatedInputWithResultSignalsFactory<InputType, ValidationType, ResultType, SignalsType>;
}
export declare const getValidatedInputWithResultSignalsFactory: <InputType, ValidationType, ResultType>(inputGetter: (store: Store) => Observable<InputType>, validationEffect: EffectType<InputType, ValidationType>, isValidationResultValid: (validationResult: ValidationType) => boolean, resultEffect: EffectType<InputType, ResultType>) => ValidatedInputWithResultSignalsFactory<InputType, ValidationType, ResultType, ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType>>;
};
export declare const getValidatedInputWithResultSignalsFactory: <InputType, ValidationType, ResultType>(inputGetter: (store: Store) => Observable<InputType>, validationEffect: EffectType<InputType, ValidationType>, isValidationResultValid: (validationResult: ValidationType) => boolean, resultEffect: EffectType<InputType, ResultType>) => ValidatedInputWithResultSignalsFactory<InputType, ValidationType, ResultType, Readonly<{
combinedBehavior: TypeIdentifier<Readonly<{
currentInput?: InputType | undefined;
validationPending: boolean;
validatedInput?: InputType | undefined;
validationResult?: ValidationType | undefined;
isValid: boolean;
resultPending: boolean;
resultInput?: InputType | undefined;
result?: ResultType | undefined;
}>>;
validationErrorEvents: TypeIdentifier<Readonly<{
error: any;
errorInput: InputType;
}>>;
validationSuccessEvents: TypeIdentifier<Readonly<{
result: ValidationType;
resultInput: InputType;
}>>;
validationInvalidateEvent: TypeIdentifier<void>;
resultErrorEvents: TypeIdentifier<Readonly<{
error: any;
errorInput: InputType;
}>>;
resultSuccessEvents: TypeIdentifier<Readonly<{
result: ResultType;
resultInput: InputType;
}>>;
resultInvalidateEvent: TypeIdentifier<void>;
}>>;
{
"name": "@rx-signals/store",
"version": "2.6.2",
"version": "2.7.0-rc1",
"description": "Reactive effects management with behaviors and event streams",

@@ -45,20 +45,21 @@ "author": "Gerd Neudert",

"peerDependencies": {
"rxjs": "^6.4.0"
"rxjs": ">6.4.0"
},
"devDependencies": {
"@types/jest": "^26.0.22",
"@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.20.0",
"eslint": "^7.23.0",
"rxjs": "^7.3.0",
"@types/jest": "^26.0.24",
"@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2",
"eslint": "^7.32.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.3.3",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^24.4.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-prettier": "^3.4.1",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"ts-jest": "^26.5.4",
"typescript": "^4.2.3"
"prettier": "^2.4.1",
"ts-jest": "^26.5.6",
"typescript": "^4.3.5"
}
}

@@ -181,7 +181,7 @@ /* eslint no-underscore-dangle: ["error", { "allow": ["_rxs_id"] }] */

this.subject = this.isBehavior
? new BehaviorSubject<T>((NO_VALUE as unknown) as T)
? new BehaviorSubject<T>(NO_VALUE as unknown as T)
: new Subject<T>();
this.pipe = this.isBehavior
? this.subject.pipe(
filter(value => value !== ((NO_VALUE as unknown) as T)),
filter(value => value !== (NO_VALUE as unknown as T)),
distinctUntilChanged(),

@@ -188,0 +188,0 @@ )

@@ -26,5 +26,5 @@ import { combineLatest, Observable, of, throwError } from 'rxjs';

/**
* This interface specifies the type for the lazy behavior produced by an EffectSignalsFactory.
* This specifies the type for the lazy behavior produced by an EffectSignalsFactory.
*
* @typedef {object} CombinedEffectResult<InputType, ResultType> - interface for the behavior produced by effect signal factories
* @typedef {object} CombinedEffectResult<InputType, ResultType> - type for the behavior produced by effect signal factories
* @template InputType - specifies the input type for the effect

@@ -37,13 +37,13 @@ * @template ResultType - specifies the result type of the effect

*/
export interface CombinedEffectResult<InputType, ResultType> {
readonly currentInput?: InputType;
readonly result?: ResultType;
readonly resultInput?: InputType;
readonly resultPending: boolean;
}
export type CombinedEffectResult<InputType, ResultType> = Readonly<{
currentInput?: InputType;
result?: ResultType;
resultInput?: InputType;
resultPending: boolean;
}>;
/**
* Interface for error events produced by an EffectSignalsFactory (unhandled effect errors).
* Type for error events produced by an EffectSignalsFactory (unhandled effect errors).
*
* @typedef {object} EffectError<InputType> - interface for error events produced by effect signal factories
* @typedef {object} EffectError<InputType> - type for error events produced by effect signal factories
* @template InputType - specifies the input type for the effect

@@ -53,11 +53,11 @@ * @property {any} error - the unhandled error thrown by an effect

*/
export interface EffectError<InputType> {
readonly error: any;
readonly errorInput: InputType;
}
export type EffectError<InputType> = Readonly<{
error: any;
errorInput: InputType;
}>;
/**
* Interface for success events produced by an EffectSignalsFactory.
* Type for success events produced by an EffectSignalsFactory.
*
* @typedef {object} EffectSuccess<InputType, ResultType> - interface for success events produced by effect signal factories
* @typedef {object} EffectSuccess<InputType, ResultType> - type for success events produced by effect signal factories
* @template InputType - specifies the input type for the effect

@@ -68,9 +68,9 @@ * @template ResultType - specifies the result type of the effect

*/
export interface EffectSuccess<InputType, ResultType> {
readonly result: ResultType;
readonly resultInput: InputType;
}
export type EffectSuccess<InputType, ResultType> = Readonly<{
result: ResultType;
resultInput: InputType;
}>;
/**
* Interface specifying the signals of an EffectSignalsFactory.
* Type specifying the signals of an EffectSignalsFactory.
*

@@ -85,11 +85,11 @@ * @typedef {object} EffectSignalsType<InputType, ResultType> - object holding the signal identifiers of effect signal factories

*/
export interface EffectSignalsType<InputType, ResultType> {
readonly combinedBehavior: TypeIdentifier<CombinedEffectResult<InputType, ResultType>>;
readonly errorEvents: TypeIdentifier<EffectError<InputType>>;
readonly successEvents: TypeIdentifier<EffectSuccess<InputType, ResultType>>;
readonly invalidateEvent: TypeIdentifier<void>;
}
export type EffectSignalsType<InputType, ResultType> = Readonly<{
combinedBehavior: TypeIdentifier<CombinedEffectResult<InputType, ResultType>>;
errorEvents: TypeIdentifier<EffectError<InputType>>;
successEvents: TypeIdentifier<EffectSuccess<InputType, ResultType>>;
invalidateEvent: TypeIdentifier<void>;
}>;
/**
* This interface extends the EffectSignalsType interface for manually triggered effects.
* This type extends the EffectSignalsType type for manually triggered effects.
*

@@ -101,6 +101,8 @@ * @typedef {object} TriggeredEffectSignalsType<InputType, ResultType> - object holding the signal identifiers of effect signal factories with effect trigger event

*/
export interface TriggeredEffectSignalsType<InputType, ResultType>
extends EffectSignalsType<InputType, ResultType> {
export type TriggeredEffectSignalsType<InputType, ResultType> = EffectSignalsType<
InputType,
ResultType
> & {
readonly triggerEvent: TypeIdentifier<void>;
}
};

@@ -118,3 +120,3 @@ const getSignalIds = <InputType, ResultType>(): TriggeredEffectSignalsType<

interface EffectFactoryConfiguration<InputType, ResultType> {
type EffectFactoryConfiguration<InputType, ResultType> = Readonly<{
inputGetter: (store: Store) => Observable<InputType>;

@@ -126,3 +128,3 @@ effect: EffectType<InputType, ResultType>;

effectDebounceTime?: number;
}
}>;

@@ -316,3 +318,3 @@ type FactoryBuild<SignalsType, ConfigurationType> = (

setup,
signals: ((config.withTrigger ? ids : withoutTriggerID) as unknown) as SignalsType,
signals: (config.withTrigger ? ids : withoutTriggerID) as unknown as SignalsType,
};

@@ -324,3 +326,3 @@ };

/**
* This interface specifies effect signal factories (extending signal factories). An effect signals factory is a signals factory
* This type specifies effect signal factories (extending signal factories). An effect signals factory is a signals factory
* to generically handle sideeffects (hence, an abstraction over sideeffects). Furthermore, they are implemeted as builders to

@@ -349,19 +351,19 @@ * allow for easy custom configuration.

*/
export interface EffectSignalsFactory<InputType, ResultType, SignalsType>
extends SignalsFactory<SignalsType> {
withTrigger: () => EffectSignalsFactory<
InputType,
ResultType,
TriggeredEffectSignalsType<InputType, ResultType>
>;
withInitialResult: (
resultGetter?: () => ResultType,
) => EffectSignalsFactory<InputType, ResultType, SignalsType>;
withEffectDebounce: (
debounceMS: number,
) => EffectSignalsFactory<InputType, ResultType, SignalsType>;
withCustomEffectInputEquals: (
effectInputEquals: (a: InputType, b: InputType) => boolean,
) => EffectSignalsFactory<InputType, ResultType, SignalsType>;
}
export type EffectSignalsFactory<InputType, ResultType, SignalsType> =
SignalsFactory<SignalsType> & {
withTrigger: () => EffectSignalsFactory<
InputType,
ResultType,
TriggeredEffectSignalsType<InputType, ResultType>
>;
withInitialResult: (
resultGetter?: () => ResultType,
) => EffectSignalsFactory<InputType, ResultType, SignalsType>;
withEffectDebounce: (
debounceMS: number,
) => EffectSignalsFactory<InputType, ResultType, SignalsType>;
withCustomEffectInputEquals: (
effectInputEquals: (a: InputType, b: InputType) => boolean,
) => EffectSignalsFactory<InputType, ResultType, SignalsType>;
};

@@ -371,3 +373,3 @@ const getEffectSignalsFactoryIntern = <

ResultType,
SignalsType extends EffectSignalsType<InputType, ResultType>
SignalsType extends EffectSignalsType<InputType, ResultType>,
>(

@@ -374,0 +376,0 @@ config: EffectFactoryConfiguration<InputType, ResultType>,

@@ -5,16 +5,16 @@ /* eslint-disable @typescript-eslint/no-use-before-define */

interface SetupWithStore {
type SetupWithStore = {
readonly setup: (store: Store) => void;
}
};
interface SignalsTypeWrapper<SignalsType> {
signals: SignalsType;
}
type SignalsTypeWrapper<SignalsType> = {
readonly signals: SignalsType;
};
export type Signals<SignalsType> = SetupWithStore & SignalsTypeWrapper<SignalsType>;
export interface MappedSignalsType<SignalsType1, SignalsType2> {
readonly signals1: SignalsType1;
readonly signals2: SignalsType2;
}
export type MappedSignalsType<SignalsType1, SignalsType2> = Readonly<{
signals1: SignalsType1;
signals2: SignalsType2;
}>;

@@ -28,18 +28,23 @@ /**

*
* @typedef {object} SignalsFactory<SignalsType> - interface for monadic signal factories
* @template SignalsType - specifies the interface for signals provided by the factory (type identifiers)
* @typedef {object} SignalsFactory<SignalsType> - type for monadic signal factories
* @template SignalsType - specifies the type for signals provided by the factory (type identifiers)
* @property {function} build - returns an object with a setup function (taking a store as argument) and the signals being setup
* @property {function} bind - the monadic bind (aka flatMap) to compose with other signal factories
* @property {function} fmap - (aka map) a functor to map the signals produced by the factory
* @property {function} fmap - (aka map) the functor map, to map the signals produced by the factory
*/
export interface SignalsFactory<SignalsType> {
readonly build: () => Signals<SignalsType>;
readonly bind: <SignalsType2>(
export type SignalsFactory<SignalsType> = Readonly<{
build: () => Signals<SignalsType>;
bind: <SignalsType2>(
mapper: (signals: Signals<SignalsType>) => SignalsFactory<SignalsType2>,
) => SignalsFactory<MappedSignalsType<SignalsType, SignalsType2>>;
readonly fmap: <SignalsType2>(
fmap: <SignalsType2>(
mapper: (signals: Signals<SignalsType>) => Signals<SignalsType2>,
) => SignalsFactory<SignalsType2>;
}
}>;
type SignalsFactoryMapCreate = <SignalsType1, SignalsType2>(
factory1: SignalsFactory<SignalsType1>,
mapper: (signals: Signals<SignalsType1>) => Signals<SignalsType2>,
) => SignalsFactory<SignalsType2>;
/**

@@ -55,3 +60,3 @@ * A utility function that implements fmap for signal factories. However, instead of using this

*/
export const signalsFactoryMap = <SignalsType1, SignalsType2>(
export const signalsFactoryMap: SignalsFactoryMapCreate = <SignalsType1, SignalsType2>(
factory1: SignalsFactory<SignalsType1>,

@@ -76,2 +81,7 @@ mapper: (signals: Signals<SignalsType1>) => Signals<SignalsType2>,

type SignalsFactoryBindCreate = <SignalsType1, SignalsType2>(
factory1: SignalsFactory<SignalsType1>,
mapper: (signals: Signals<SignalsType1>) => SignalsFactory<SignalsType2>,
) => SignalsFactory<MappedSignalsType<SignalsType1, SignalsType2>>;
/**

@@ -87,3 +97,3 @@ * A utility function that implements bind for signal factories. However, instead of using this

*/
export const signalsFactoryBind = <SignalsType1, SignalsType2>(
export const signalsFactoryBind: SignalsFactoryBindCreate = <SignalsType1, SignalsType2>(
factory1: SignalsFactory<SignalsType1>,

@@ -126,2 +136,6 @@ mapper: (signals: Signals<SignalsType1>) => SignalsFactory<SignalsType2>,

type SignalsFactoryCreate = <SignalsType>(
build: () => Signals<SignalsType>,
) => SignalsFactory<SignalsType>;
/**

@@ -136,3 +150,3 @@ * This utility function creates an object that implements the SignalsFactory interface. It should be

*/
export const createSignalsFactory = <SignalsType>(
export const createSignalsFactory: SignalsFactoryCreate = <SignalsType>(
build: () => Signals<SignalsType>,

@@ -139,0 +153,0 @@ ): SignalsFactory<SignalsType> => {

@@ -19,8 +19,8 @@ import { asyncScheduler, BehaviorSubject, combineLatest, merge, NEVER, Observable, of } from 'rxjs';

/**
* The RX-SIGNALS Store uses the TypedEvent<T> interface to bundle certain event and their
* The RX-SIGNALS Store uses the TypedEvent<T> to bundle certain events and their
* corresponding TypeIdentifier<T>. This is used for EventSources that can dispatch events
* of different types (see addXTypedEventSource mehtods) or for cases where you want to
* of different types (see addXTypedEventSource methods) or for cases where you want to
* subscribe multiple event and need to differentiate between them at runtime.
*
* @typedef {object} TypedEvent<T> - interface for an object used to identify a certain behavior or event
* @typedef {object} TypedEvent<T> - type for an object bundling identifier and corresponding event.
* @template T - specifies the type for the corresponding TypeIdentifier<T>

@@ -30,12 +30,9 @@ * @property {TypeIdentifier<T>} type - the TypeIdentifier for the event

*/
export interface TypedEvent<T> {
readonly type: TypeIdentifier<T>;
readonly event: T;
}
export type TypedEvent<T> = Readonly<{
type: TypeIdentifier<T>;
event: T;
}>;
/**
* The RX-SIGNALS Store uses the TypedEvent<T> interface to bundle certain event and their
* corresponding TypeIdentifier<T>. This is used for EventSources that can dispatch events
* of different types (see addXTypedEventSource mehtods) or for cases where you want to
* subscribe multiple event and need to differentiate between them at runtime.
* The state reducer type specifies the signature for reducers used by the store.
*

@@ -132,10 +129,5 @@ * @typedef {function} StateReducer<T, E> - type for a function that takes a state and an event and returns a new state

): void {
this.assertSourceExists(identifier.symbol, identifier.symbol);
this.assertSourceExists(identifier, identifier);
this.getBehaviorControlledSubject(identifier).addSource(
new SourceObservable<T>(
identifier.symbol,
observable,
subscribeLazy,
initialValueOrValueGetter,
),
new SourceObservable<T>(identifier, observable, subscribeLazy, initialValueOrValueGetter),
);

@@ -185,5 +177,5 @@ }

addState<T>(identifier: TypeIdentifier<T>, initialValueOrValueGetter: T | (() => T)): void {
this.assertSourceExists(identifier.symbol, identifier.symbol);
this.assertSourceExists(identifier, identifier);
this.getBehaviorControlledSubject(identifier).addSource(
new SourceObservable<T>(identifier.symbol, NEVER, false, initialValueOrValueGetter),
new SourceObservable<T>(identifier, NEVER, false, initialValueOrValueGetter),
);

@@ -212,3 +204,3 @@ }

this.getBehaviorControlledSubject(stateIdentifier).addSource(
new SourceObservable<T>(eventIdentifier.symbol, sourceObservable, false),
new SourceObservable<T>(eventIdentifier, sourceObservable, false),
);

@@ -228,3 +220,3 @@ }

): void {
this.getBehaviorControlledSubject(stateIdentifier).removeSource(eventIdentifier.symbol);
this.getBehaviorControlledSubject(stateIdentifier).removeSource(eventIdentifier);
}

@@ -256,3 +248,3 @@

behavior.complete();
this.behaviors.delete(identifier.symbol);
this.behaviors.delete(identifier);
this.behaviorsSubject.next(this.behaviors);

@@ -308,3 +300,3 @@ }

switchMap(s =>
(s.get(identifier.symbol)?.getNumberOfSources() ?? 0) > 0
(s.get(identifier)?.getNumberOfSources() ?? 0) > 0
? this.getBehaviorControlledSubject(identifier).getObservable()

@@ -353,3 +345,3 @@ : parent.getBehavior(identifier),

)
.toPromise();
.toPromise() as Promise<boolean>;
controlledSubject.next(event);

@@ -691,4 +683,4 @@ return result;

return (
this.behaviors.get(identifier.symbol)?.isObservableSubscribed() === true ||
this.eventStreams.get(identifier.symbol)?.isObservableSubscribed() === true
this.behaviors.get(identifier)?.isObservableSubscribed() === true ||
this.eventStreams.get(identifier)?.isObservableSubscribed() === true
);

@@ -707,3 +699,3 @@ }

getIsSubscribedObservable<T>(identifier: TypeIdentifier<T>): Observable<boolean> {
const sym = identifier.symbol;
const sym = identifier;
return combineLatest([

@@ -773,3 +765,3 @@ this.behaviorsSubject

const controlledSubject = new ControlledSubject<T>(
identifier.symbol,
identifier,
true,

@@ -788,3 +780,3 @@ (_, error) => {

);
this.behaviors.set(identifier.symbol, controlledSubject);
this.behaviors.set(identifier, controlledSubject);
this.behaviorsSubject.next(this.behaviors);

@@ -795,5 +787,3 @@ return controlledSubject;

private getBehaviorControlledSubject<T>(identifier: TypeIdentifier<T>): ControlledSubject<T> {
return (
this.behaviors.get(identifier.symbol) ?? this.createBehaviorControlledSubject(identifier)
);
return this.behaviors.get(identifier) ?? this.createBehaviorControlledSubject(identifier);
}

@@ -805,3 +795,3 @@

const controlledSubject = new ControlledSubject<T>(
identifier.symbol,
identifier,
false,

@@ -820,3 +810,3 @@ (_, error) => {

);
this.eventStreams.set(identifier.symbol, controlledSubject);
this.eventStreams.set(identifier, controlledSubject);
this.eventStreamsSubject.next(this.eventStreams);

@@ -827,6 +817,3 @@ return controlledSubject;

private getEventStreamControlledSubject<T>(identifier: TypeIdentifier<T>): ControlledSubject<T> {
return (
this.eventStreams.get(identifier.symbol) ??
this.createEventStreamControlledSubject(identifier)
);
return this.eventStreams.get(identifier) ?? this.createEventStreamControlledSubject(identifier);
}

@@ -833,0 +820,0 @@

@@ -5,11 +5,11 @@ /**

* parameter only as a trick to let Typescript infer and thus enforce the correct types.
* Use the getIdentifier<T>() method to generate a corresponding ID.
*
* @typedef {object} TypeIdentifier<T> - interface for an object used to identify a certain behavior or event
* @typedef {object} TypeIdentifier<T> - type to uniquely identify a certain behavior or event
* @template T - specifies the type for the corresponding behavior or event observable
* @property {symbol} symbol - a symbol, making the TypeIdentifier unique
*/
export interface TypeIdentifier<T> {
_typeTemplate?: T | undefined; // should always be undefined (just here to make TS happy)
readonly symbol: symbol;
}
export type TypeIdentifier<T> = symbol & {
_typeTemplate: T;
};

@@ -23,6 +23,5 @@ /**

*/
export const getIdentifier = <T>(name?: string): TypeIdentifier<T> => ({
symbol: Symbol(name),
});
export const getIdentifier = <T>(name?: string): TypeIdentifier<T> =>
Symbol(name) as TypeIdentifier<T>;
export const NO_VALUE: symbol = Symbol('NO_VALUE');

@@ -15,36 +15,34 @@ import { combineLatest, Observable } from 'rxjs';

export interface ValidatedInputWithResult<InputType, ValidationType, ResultType> {
readonly currentInput?: InputType;
readonly validationPending: boolean;
readonly validatedInput?: InputType;
readonly validationResult?: ValidationType;
readonly isValid: boolean;
readonly resultPending: boolean;
readonly resultInput?: InputType;
readonly result?: ResultType;
}
export type ValidatedInputWithResult<InputType, ValidationType, ResultType> = Readonly<{
currentInput?: InputType;
validationPending: boolean;
validatedInput?: InputType;
validationResult?: ValidationType;
isValid: boolean;
resultPending: boolean;
resultInput?: InputType;
result?: ResultType;
}>;
export interface ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType> {
readonly combinedBehavior: TypeIdentifier<
ValidatedInputWithResult<InputType, ValidationType, ResultType>
>;
readonly validationErrorEvents: TypeIdentifier<EffectError<InputType>>;
readonly validationSuccessEvents: TypeIdentifier<EffectSuccess<InputType, ValidationType>>;
readonly validationInvalidateEvent: TypeIdentifier<void>;
readonly resultErrorEvents: TypeIdentifier<EffectError<InputType>>;
readonly resultSuccessEvents: TypeIdentifier<EffectSuccess<InputType, ResultType>>;
readonly resultInvalidateEvent: TypeIdentifier<void>;
}
export type ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType> = Readonly<{
combinedBehavior: TypeIdentifier<ValidatedInputWithResult<InputType, ValidationType, ResultType>>;
validationErrorEvents: TypeIdentifier<EffectError<InputType>>;
validationSuccessEvents: TypeIdentifier<EffectSuccess<InputType, ValidationType>>;
validationInvalidateEvent: TypeIdentifier<void>;
resultErrorEvents: TypeIdentifier<EffectError<InputType>>;
resultSuccessEvents: TypeIdentifier<EffectSuccess<InputType, ResultType>>;
resultInvalidateEvent: TypeIdentifier<void>;
}>;
export interface ValidatedInputWithTriggeredResultSignalsType<InputType, ValidationType, ResultType>
extends ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType> {
readonly resultTriggerEvent: TypeIdentifier<void>;
}
export type ValidatedInputWithTriggeredResultSignalsType<InputType, ValidationType, ResultType> =
ValidatedInputWithResultSignalsType<InputType, ValidationType, ResultType> & {
readonly resultTriggerEvent: TypeIdentifier<void>;
};
export interface ValidatedInputWithResultSignalsFactory<
export type ValidatedInputWithResultSignalsFactory<
InputType,
ValidationType,
ResultType,
SignalsType
> extends SignalsFactory<SignalsType> {
SignalsType,
> = SignalsFactory<SignalsType> & {
withTrigger: () => ValidatedInputWithResultSignalsFactory<

@@ -62,5 +60,5 @@ InputType,

) => ValidatedInputWithResultSignalsFactory<InputType, ValidationType, ResultType, SignalsType>;
}
};
interface FactoryConfiguration<InputType, ValidationType, ResultType> {
type FactoryConfiguration<InputType, ValidationType, ResultType> = {
inputGetter: (store: Store) => Observable<InputType>;

@@ -73,3 +71,3 @@ validationEffect: EffectType<InputType, ValidationType>;

initialResultGetter?: () => ResultType;
}
};

@@ -159,3 +157,3 @@ const resultInputGetter = <InputType, ValidationType>(

ValidationType,
ResultType
ResultType,
>(

@@ -189,5 +187,4 @@ config: FactoryConfiguration<InputType, ValidationType, ResultType>,

.fmap(signals => {
const combinedBehavior = getIdentifier<
ValidatedInputWithResult<InputType, ValidationType, ResultType>
>();
const combinedBehavior =
getIdentifier<ValidatedInputWithResult<InputType, ValidationType, ResultType>>();
const setup = (store: Store) =>

@@ -258,5 +255,4 @@ setupCombinedBehavior(store, signals, combinedBehavior, config.isValidationResultValid);

.fmap(signals => {
const combinedBehavior = getIdentifier<
ValidatedInputWithResult<InputType, ValidationType, ResultType>
>();
const combinedBehavior =
getIdentifier<ValidatedInputWithResult<InputType, ValidationType, ResultType>>();
const setup = (store: Store) =>

@@ -263,0 +259,0 @@ setupCombinedBehavior(store, signals, combinedBehavior, config.isValidationResultValid);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc