* @internal
()
| 47 | * @internal |
| 48 | */ |
| 49 | toActions(): Observable<Action> { |
| 50 | return this.pipe( |
| 51 | groupBy((effectsInstance) => |
| 52 | isClassInstance(effectsInstance) |
| 53 | ? getSourceForInstance(effectsInstance) |
| 54 | : effectsInstance |
| 55 | ), |
| 56 | mergeMap((source$) => { |
| 57 | return source$.pipe(groupBy(effectsInstance)); |
| 58 | }), |
| 59 | mergeMap((source$) => { |
| 60 | const effect$ = source$.pipe( |
| 61 | exhaustMap((sourceInstance) => { |
| 62 | return resolveEffectSource( |
| 63 | this.errorHandler, |
| 64 | this.effectsErrorHandler |
| 65 | )(sourceInstance); |
| 66 | }), |
| 67 | map((output) => { |
| 68 | reportInvalidActions(output, this.errorHandler); |
| 69 | return output.notification; |
| 70 | }), |
| 71 | filter( |
| 72 | (notification): notification is ObservableNotification<Action> => |
| 73 | notification.kind === 'N' && notification.value != null |
| 74 | ), |
| 75 | dematerialize() |
| 76 | ); |
| 77 | |
| 78 | // start the stream with an INIT action |
| 79 | // do this only for the first Effect instance |
| 80 | const init$ = source$.pipe( |
| 81 | take(1), |
| 82 | filter(isOnInitEffects), |
| 83 | map((instance) => instance.ngrxOnInitEffects()) |
| 84 | ); |
| 85 | |
| 86 | return merge(effect$, init$); |
| 87 | }) |
| 88 | ); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | function effectsInstance(sourceInstance: any) { |
no test coverage detected