blob: fc4eeaa682c66b17e499c94b5c07108aeb1f3c34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import { BridgeSettings, IBridgeConstraints } from './daemon-rpc-types';
import makeLocationBuilder, { ILocationBuilder } from './relay-location-builder';
export default class BridgeSettingsBuilder {
private payload: Partial<IBridgeConstraints> = {};
public build(): BridgeSettings {
if (this.payload.location) {
return {
normal: {
location: this.payload.location,
providers: this.payload.providers ?? [],
},
};
} else {
throw new Error('Unsupported configuration');
}
}
get location(): ILocationBuilder<BridgeSettingsBuilder> {
return makeLocationBuilder(this, (location) => {
this.payload.location = location;
});
}
}
|