MCPcopy Create free account
hub / github.com/ngrx/platform / toActions

Method toActions

modules/effects/src/effect_sources.ts:49–89  ·  view source on GitHub ↗

* @internal

()

Source from the content-addressed store, hash-verified

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
92function effectsInstance(sourceInstance: any) {

Callers 1

startMethod · 0.80

Calls 8

isClassInstanceFunction · 0.90
getSourceForInstanceFunction · 0.90
reportInvalidActionsFunction · 0.90
groupByFunction · 0.85
resolveEffectSourceFunction · 0.85
mergeFunction · 0.85
ngrxOnInitEffectsMethod · 0.65
filterFunction · 0.50

Tested by

no test coverage detected