@cascateer/core 2.1.31 → 2.1.33
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/package.json +1 -1
- package/src/lib/memoizeHashed.ts +1 -2
- package/src/operators/every.ts +4 -0
- package/src/operators/index.ts +2 -0
- package/src/operators/some.ts +4 -0
- package/src/terminal.ts +20 -17
- package/src/types.ts +3 -6
package/package.json
CHANGED
package/src/lib/memoizeHashed.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { memoize } from "lodash";
|
|
2
|
-
import objectHash from "object-hash";
|
|
3
2
|
|
|
4
3
|
export const memoizeHashed = <T extends (...args: any) => any>(func: T) =>
|
|
5
|
-
memoize(func, (...args: Parameters<T>) =>
|
|
4
|
+
memoize(func, (...args: Parameters<T>) => JSON.stringify(args ?? null));
|
package/src/operators/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { concat } from "./concat";
|
|
2
|
+
export { every } from "./every";
|
|
2
3
|
export { exchangeWith } from "./exchangeWith";
|
|
3
4
|
export { flatMap } from "./flatMap";
|
|
4
5
|
export {
|
|
@@ -12,3 +13,4 @@ export {
|
|
|
12
13
|
} from "./multicast";
|
|
13
14
|
export { proxyReplaySubject } from "./proxyReplaySubject";
|
|
14
15
|
export { sequence } from "./sequence";
|
|
16
|
+
export { some } from "./some";
|
package/src/terminal.ts
CHANGED
|
@@ -79,24 +79,27 @@ export class ExtendableTerminalAdapter<
|
|
|
79
79
|
) {
|
|
80
80
|
return new ExtendableTerminalAdapter(
|
|
81
81
|
this.context,
|
|
82
|
-
this.extendableEffects.extend(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
this.extendableEffects.extend(
|
|
83
|
+
(currentEffects) => () =>
|
|
84
|
+
effects({
|
|
85
|
+
effect: (constructor) => {
|
|
86
|
+
const interceptor = new ProxyEffectInterceptor();
|
|
87
|
+
const source = {
|
|
88
|
+
store: {
|
|
89
|
+
effects: asStoreEffects(this.context.store.signals),
|
|
90
|
+
},
|
|
91
|
+
api: {
|
|
92
|
+
effects: interceptor.intercept(this.context.api.effects),
|
|
93
|
+
},
|
|
94
|
+
terminal: {
|
|
95
|
+
effects: interceptor.intercept(currentEffects),
|
|
96
|
+
},
|
|
97
|
+
};
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
return interceptor.proxy(constructor(source));
|
|
100
|
+
},
|
|
101
|
+
}),
|
|
102
|
+
),
|
|
100
103
|
this.extendableActions,
|
|
101
104
|
);
|
|
102
105
|
}
|
package/src/types.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Dictionary, mapValues, tap } from "lodash";
|
|
|
2
2
|
import {
|
|
3
3
|
combineLatest,
|
|
4
4
|
distinct,
|
|
5
|
-
map,
|
|
6
5
|
ReplaySubject,
|
|
7
6
|
switchMap,
|
|
8
7
|
UnaryFunction,
|
|
@@ -11,7 +10,7 @@ import { Observable } from "rxjs/internal/Observable";
|
|
|
11
10
|
import { ObservableInput } from "rxjs/internal/types";
|
|
12
11
|
import { memoizeHashed } from "./lib";
|
|
13
12
|
import { ProxyObservable } from "./observable";
|
|
14
|
-
import { concat } from "./operators";
|
|
13
|
+
import { concat, every, some } from "./operators";
|
|
15
14
|
|
|
16
15
|
export interface Effect<Args, Result> extends UnaryFunction<
|
|
17
16
|
Args,
|
|
@@ -46,9 +45,7 @@ export class ProxyEffectInterceptor extends ReplaySubject<
|
|
|
46
45
|
memoizeHashed((args) =>
|
|
47
46
|
tap(
|
|
48
47
|
new ProxyObservable(effect(args), (target, receiver) =>
|
|
49
|
-
combineLatest([target.pending, receiver.refCount]).pipe(
|
|
50
|
-
map((values) => values.every(Boolean)),
|
|
51
|
-
),
|
|
48
|
+
combineLatest([target.pending, receiver.refCount]).pipe(every()),
|
|
52
49
|
),
|
|
53
50
|
(source) => this.next(source),
|
|
54
51
|
),
|
|
@@ -65,7 +62,7 @@ export class ProxyEffectInterceptor extends ReplaySubject<
|
|
|
65
62
|
switchMap((sources) =>
|
|
66
63
|
combineLatest(sources.map((source) => source.pending)),
|
|
67
64
|
),
|
|
68
|
-
|
|
65
|
+
some(),
|
|
69
66
|
),
|
|
70
67
|
);
|
|
71
68
|
}
|