blob: 2ee5469707860712fc273067b627caf93ac7bc83 (
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
26
27
28
|
import { BridgeSettings, IBridgeConstraints, Ownership } 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 {
type: 'normal',
normal: {
location: this.payload.location,
providers: this.payload.providers ?? [],
ownership: this.payload.ownership ?? Ownership.any,
},
custom: undefined,
};
} else {
throw new Error('Unsupported configuration');
}
}
get location(): ILocationBuilder<BridgeSettingsBuilder> {
return makeLocationBuilder(this, (location) => {
this.payload.location = location;
});
}
}
|