-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connection-flow): privade a pure superset node output port
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { CombErr, SupersetFlow } from '../core'; | ||
import { IRcloneServer } from '../extra'; | ||
import { NoopAuthFlowSupNode } from '.'; | ||
import { Observable } from 'rxjs'; | ||
import { distinctUntilChanged } from 'rxjs/operators'; | ||
|
||
export abstract class ConnectionFlow extends SupersetFlow< | ||
NoopAuthFlowSupNode, | ||
IRcloneServer, | ||
IRcloneServer | ||
> { | ||
// public prerequest$: Observable<CombErr<NoopAuthFlowOutNode>>; | ||
protected request(pre: CombErr<NoopAuthFlowSupNode>): Observable<CombErr<IRcloneServer>> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
protected generateSuperset( | ||
current: CombErr<IRcloneServer>, | ||
previous: CombErr<NoopAuthFlowSupNode> | ||
): CombErr<IRcloneServer> { | ||
const err = [].concat(current[1], previous[1]).filter((x, i, a) => a.indexOf(x) === i); | ||
if (err.length !== 0) return [{}, err] as any; | ||
return [{ url: previous[0].url, password: previous[0].password, user: previous[0].user }, []]; | ||
} | ||
public getSupersetOutput(): Observable<CombErr<IRcloneServer>> { | ||
return super | ||
.getSupersetOutput() | ||
.pipe(distinctUntilChanged((x, y) => JSON.stringify(x) === JSON.stringify(y))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters