@cascateer/core 2.1.31 → 2.1.32

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cascateer/core",
3
- "version": "2.1.31",
3
+ "version": "2.1.32",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cascateer/core.git"
@@ -0,0 +1,4 @@
1
+ import { map, OperatorFunction } from "rxjs";
2
+
3
+ export const every = (): OperatorFunction<any[], boolean> => (source) =>
4
+ source.pipe(map((values) => values.every(Boolean)));
@@ -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";
@@ -0,0 +1,4 @@
1
+ import { map, OperatorFunction } from "rxjs";
2
+
3
+ export const some = (): OperatorFunction<any[], boolean> => (source) =>
4
+ source.pipe(map((values) => values.some(Boolean)));
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((currentEffects) => () => {
83
- const interceptor = new ProxyEffectInterceptor();
84
- const source = {
85
- store: {
86
- effects: asStoreEffects(this.context.store.signals),
87
- },
88
- api: {
89
- effects: interceptor.intercept(this.context.api.effects),
90
- },
91
- terminal: {
92
- effects: interceptor.intercept(currentEffects),
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
- return effects({
97
- effect: (constructor) => interceptor.proxy(constructor(source)),
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
- map((values) => values.some(Boolean)),
65
+ some(),
69
66
  ),
70
67
  );
71
68
  }