(tree: Tree)
| 147 | } |
| 148 | |
| 149 | commit(tree: Tree): Observable<void> { |
| 150 | const actions = observableFrom(tree.actions); |
| 151 | |
| 152 | return concat( |
| 153 | this.preCommit() || observableOf(null), |
| 154 | deferObservable(() => actions).pipe( |
| 155 | concatMap((action) => { |
| 156 | const maybeAction = this.preCommitAction(action); |
| 157 | |
| 158 | if (isObservable(maybeAction) || isPromiseLike(maybeAction)) { |
| 159 | return maybeAction; |
| 160 | } |
| 161 | |
| 162 | return observableOf(maybeAction || action); |
| 163 | }), |
| 164 | concatMap((action) => { |
| 165 | return concat( |
| 166 | this.commitSingleAction(action).pipe(ignoreElements()), |
| 167 | observableOf(action), |
| 168 | ); |
| 169 | }), |
| 170 | concatMap((action) => this.postCommitAction(action) || observableOf(null)), |
| 171 | ), |
| 172 | deferObservable(() => this._done()), |
| 173 | deferObservable(() => this.postCommit() || observableOf(null)), |
| 174 | ).pipe(ignoreElements(), defaultIfEmpty(undefined)); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | function isPromiseLike<T, U = unknown>(value: U | PromiseLike<T>): value is PromiseLike<T> { |
nothing calls this directly
no test coverage detected