Skip to content

Commit

Permalink
feat(connection-flow): privade a pure superset node output port
Browse files Browse the repository at this point in the history
  • Loading branch information
ElonH committed May 24, 2020
1 parent 25b1c73 commit 3744893
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/app/@dataflow/rclone/connection-flow.ts
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)));
}
}
1 change: 1 addition & 0 deletions src/app/@dataflow/rclone/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './noop-auth-flow';
export * from './core-stats-flow';
export * from './list-remotes-flow';
export * from './operations-list-flow';
export * from './connection-flow';

0 comments on commit 3744893

Please sign in to comment.