Pull request: beta client squashed

Merge in DNS/adguard-home from beta-client-2 to master

Squashed commit of the following:

commit b2640cc49a6c5484d730b534dcf5a8013d7fa478
Merge: 659def862 aef4659e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Dec 29 19:23:09 2020 +0300

    Merge branch 'master' into beta-client-2

commit 659def8626467949c35b7a6a0c99ffafb07b4385
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Dec 29 17:25:14 2020 +0300

    all: upgrade github actions node version

commit b4b8cf8dd75672e9155da5d111ac66e8f5ba1535
Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com>
Date:   Tue Dec 29 16:57:14 2020 +0300

    all: beta client squashed
This commit is contained in:
Eugene Burkov
2020-12-29 19:53:56 +03:00
parent aef4659e93
commit 5e20ac7ed5
200 changed files with 20843 additions and 55 deletions

View File

@@ -0,0 +1,222 @@
import WhoisInfo, { IWhoisInfo } from './WhoisInfo';
// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IClientFindSubEntry {
blocked_services?: string[];
disallowed?: boolean;
disallowed_rule?: string;
filtering_enabled?: boolean;
ids?: string[];
name?: string;
parental_enabled?: boolean;
safebrowsing_enabled?: boolean;
safesearch_enabled?: boolean;
upstreams?: string[];
use_global_blocked_services?: boolean;
use_global_settings?: boolean;
whois_info?: IWhoisInfo[];
}
export default class ClientFindSubEntry {
readonly _blocked_services: string[] | undefined;
get blockedServices(): string[] | undefined {
return this._blocked_services;
}
readonly _disallowed: boolean | undefined;
/** */
get disallowed(): boolean | undefined {
return this._disallowed;
}
readonly _disallowed_rule: string | undefined;
/** */
get disallowedRule(): string | undefined {
return this._disallowed_rule;
}
readonly _filtering_enabled: boolean | undefined;
get filteringEnabled(): boolean | undefined {
return this._filtering_enabled;
}
readonly _ids: string[] | undefined;
/** */
get ids(): string[] | undefined {
return this._ids;
}
readonly _name: string | undefined;
/**
* Description: Name
* Example: localhost
*/
get name(): string | undefined {
return this._name;
}
readonly _parental_enabled: boolean | undefined;
get parentalEnabled(): boolean | undefined {
return this._parental_enabled;
}
readonly _safebrowsing_enabled: boolean | undefined;
get safebrowsingEnabled(): boolean | undefined {
return this._safebrowsing_enabled;
}
readonly _safesearch_enabled: boolean | undefined;
get safesearchEnabled(): boolean | undefined {
return this._safesearch_enabled;
}
readonly _upstreams: string[] | undefined;
get upstreams(): string[] | undefined {
return this._upstreams;
}
readonly _use_global_blocked_services: boolean | undefined;
get useGlobalBlockedServices(): boolean | undefined {
return this._use_global_blocked_services;
}
readonly _use_global_settings: boolean | undefined;
get useGlobalSettings(): boolean | undefined {
return this._use_global_settings;
}
readonly _whois_info: WhoisInfo[] | undefined;
get whoisInfo(): WhoisInfo[] | undefined {
return this._whois_info;
}
constructor(props: IClientFindSubEntry) {
if (props.blocked_services) {
this._blocked_services = props.blocked_services;
}
if (typeof props.disallowed === 'boolean') {
this._disallowed = props.disallowed;
}
if (typeof props.disallowed_rule === 'string') {
this._disallowed_rule = props.disallowed_rule.trim();
}
if (typeof props.filtering_enabled === 'boolean') {
this._filtering_enabled = props.filtering_enabled;
}
if (props.ids) {
this._ids = props.ids;
}
if (typeof props.name === 'string') {
this._name = props.name.trim();
}
if (typeof props.parental_enabled === 'boolean') {
this._parental_enabled = props.parental_enabled;
}
if (typeof props.safebrowsing_enabled === 'boolean') {
this._safebrowsing_enabled = props.safebrowsing_enabled;
}
if (typeof props.safesearch_enabled === 'boolean') {
this._safesearch_enabled = props.safesearch_enabled;
}
if (props.upstreams) {
this._upstreams = props.upstreams;
}
if (typeof props.use_global_blocked_services === 'boolean') {
this._use_global_blocked_services = props.use_global_blocked_services;
}
if (typeof props.use_global_settings === 'boolean') {
this._use_global_settings = props.use_global_settings;
}
if (props.whois_info) {
this._whois_info = props.whois_info.map((p) => new WhoisInfo(p));
}
}
serialize(): IClientFindSubEntry {
const data: IClientFindSubEntry = {
};
if (typeof this._blocked_services !== 'undefined') {
data.blocked_services = this._blocked_services;
}
if (typeof this._disallowed !== 'undefined') {
data.disallowed = this._disallowed;
}
if (typeof this._disallowed_rule !== 'undefined') {
data.disallowed_rule = this._disallowed_rule;
}
if (typeof this._filtering_enabled !== 'undefined') {
data.filtering_enabled = this._filtering_enabled;
}
if (typeof this._ids !== 'undefined') {
data.ids = this._ids;
}
if (typeof this._name !== 'undefined') {
data.name = this._name;
}
if (typeof this._parental_enabled !== 'undefined') {
data.parental_enabled = this._parental_enabled;
}
if (typeof this._safebrowsing_enabled !== 'undefined') {
data.safebrowsing_enabled = this._safebrowsing_enabled;
}
if (typeof this._safesearch_enabled !== 'undefined') {
data.safesearch_enabled = this._safesearch_enabled;
}
if (typeof this._upstreams !== 'undefined') {
data.upstreams = this._upstreams;
}
if (typeof this._use_global_blocked_services !== 'undefined') {
data.use_global_blocked_services = this._use_global_blocked_services;
}
if (typeof this._use_global_settings !== 'undefined') {
data.use_global_settings = this._use_global_settings;
}
if (typeof this._whois_info !== 'undefined') {
data.whois_info = this._whois_info.map((p) => p.serialize());
}
return data;
}
validate(): string[] {
const validate = {
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
ids: !this._ids ? true : this._ids.reduce((result, p) => result && typeof p === 'string', true),
use_global_settings: !this._use_global_settings ? true : typeof this._use_global_settings === 'boolean',
filtering_enabled: !this._filtering_enabled ? true : typeof this._filtering_enabled === 'boolean',
parental_enabled: !this._parental_enabled ? true : typeof this._parental_enabled === 'boolean',
safebrowsing_enabled: !this._safebrowsing_enabled ? true : typeof this._safebrowsing_enabled === 'boolean',
safesearch_enabled: !this._safesearch_enabled ? true : typeof this._safesearch_enabled === 'boolean',
use_global_blocked_services: !this._use_global_blocked_services ? true : typeof this._use_global_blocked_services === 'boolean',
blocked_services: !this._blocked_services ? true : this._blocked_services.reduce((result, p) => result && typeof p === 'string', true),
upstreams: !this._upstreams ? true : this._upstreams.reduce((result, p) => result && typeof p === 'string', true),
whois_info: !this._whois_info ? true : this._whois_info.reduce((result, p) => result && p.validate().length === 0, true),
disallowed: !this._disallowed ? true : typeof this._disallowed === 'boolean',
disallowed_rule: !this._disallowed_rule ? true : typeof this._disallowed_rule === 'string' && !this._disallowed_rule ? true : this._disallowed_rule,
};
const isError: string[] = [];
Object.keys(validate).forEach((key) => {
if (!(validate as any)[key]) {
isError.push(key);
}
});
return isError;
}
update(props: Partial<IClientFindSubEntry>): ClientFindSubEntry {
return new ClientFindSubEntry({ ...this.serialize(), ...props });
}
}